av-live-query-weapp.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["AV"] = factory();
  8. else
  9. root["AV"] = factory();
  10. })(typeof self !== 'undefined' ? self : this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, {
  50. /******/ configurable: false,
  51. /******/ enumerable: true,
  52. /******/ get: getter
  53. /******/ });
  54. /******/ }
  55. /******/ };
  56. /******/
  57. /******/ // getDefaultExport function for compatibility with non-harmony modules
  58. /******/ __webpack_require__.n = function(module) {
  59. /******/ var getter = module && module.__esModule ?
  60. /******/ function getDefault() { return module['default']; } :
  61. /******/ function getModuleExports() { return module; };
  62. /******/ __webpack_require__.d(getter, 'a', getter);
  63. /******/ return getter;
  64. /******/ };
  65. /******/
  66. /******/ // Object.prototype.hasOwnProperty.call
  67. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  68. /******/
  69. /******/ // __webpack_public_path__
  70. /******/ __webpack_require__.p = "";
  71. /******/
  72. /******/ // Load entry module and return exports
  73. /******/ return __webpack_require__(__webpack_require__.s = 277);
  74. /******/ })
  75. /************************************************************************/
  76. /******/ ([
  77. /* 0 */
  78. /***/ (function(module, exports, __webpack_require__) {
  79. "use strict";
  80. var global = __webpack_require__(7);
  81. var apply = __webpack_require__(75);
  82. var uncurryThis = __webpack_require__(4);
  83. var isCallable = __webpack_require__(8);
  84. var getOwnPropertyDescriptor = __webpack_require__(62).f;
  85. var isForced = __webpack_require__(159);
  86. var path = __webpack_require__(5);
  87. var bind = __webpack_require__(48);
  88. var createNonEnumerableProperty = __webpack_require__(37);
  89. var hasOwn = __webpack_require__(13);
  90. var wrapConstructor = function (NativeConstructor) {
  91. var Wrapper = function (a, b, c) {
  92. if (this instanceof Wrapper) {
  93. switch (arguments.length) {
  94. case 0: return new NativeConstructor();
  95. case 1: return new NativeConstructor(a);
  96. case 2: return new NativeConstructor(a, b);
  97. } return new NativeConstructor(a, b, c);
  98. } return apply(NativeConstructor, this, arguments);
  99. };
  100. Wrapper.prototype = NativeConstructor.prototype;
  101. return Wrapper;
  102. };
  103. /*
  104. options.target - name of the target object
  105. options.global - target is the global object
  106. options.stat - export as static methods of target
  107. options.proto - export as prototype methods of target
  108. options.real - real prototype method for the `pure` version
  109. options.forced - export even if the native feature is available
  110. options.bind - bind methods to the target, required for the `pure` version
  111. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  112. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  113. options.sham - add a flag to not completely full polyfills
  114. options.enumerable - export as enumerable property
  115. options.dontCallGetSet - prevent calling a getter on target
  116. options.name - the .name of the function if it does not match the key
  117. */
  118. module.exports = function (options, source) {
  119. var TARGET = options.target;
  120. var GLOBAL = options.global;
  121. var STATIC = options.stat;
  122. var PROTO = options.proto;
  123. var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
  124. var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
  125. var targetPrototype = target.prototype;
  126. var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
  127. var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
  128. for (key in source) {
  129. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  130. // contains in native
  131. USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
  132. targetProperty = target[key];
  133. if (USE_NATIVE) if (options.dontCallGetSet) {
  134. descriptor = getOwnPropertyDescriptor(nativeSource, key);
  135. nativeProperty = descriptor && descriptor.value;
  136. } else nativeProperty = nativeSource[key];
  137. // export native or implementation
  138. sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
  139. if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
  140. // bind timers to global for call from export context
  141. if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
  142. // wrap global constructors for prevent changs in this version
  143. else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
  144. // make static versions for prototype methods
  145. else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
  146. // default case
  147. else resultProperty = sourceProperty;
  148. // add a flag to not completely full polyfills
  149. if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
  150. createNonEnumerableProperty(resultProperty, 'sham', true);
  151. }
  152. createNonEnumerableProperty(target, key, resultProperty);
  153. if (PROTO) {
  154. VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
  155. if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
  156. createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
  157. }
  158. // export virtual prototype methods
  159. createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
  160. // export real prototype methods
  161. if (options.real && targetPrototype && !targetPrototype[key]) {
  162. createNonEnumerableProperty(targetPrototype, key, sourceProperty);
  163. }
  164. }
  165. }
  166. };
  167. /***/ }),
  168. /* 1 */
  169. /***/ (function(module, exports) {
  170. function _interopRequireDefault(obj) {
  171. return obj && obj.__esModule ? obj : {
  172. "default": obj
  173. };
  174. }
  175. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  176. /***/ }),
  177. /* 2 */
  178. /***/ (function(module, exports) {
  179. module.exports = function (exec) {
  180. try {
  181. return !!exec();
  182. } catch (error) {
  183. return true;
  184. }
  185. };
  186. /***/ }),
  187. /* 3 */
  188. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  189. "use strict";
  190. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  191. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(318);
  192. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; });
  193. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(132);
  194. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; });
  195. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; });
  196. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; });
  197. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; });
  198. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; });
  199. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; });
  200. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; });
  201. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; });
  202. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; });
  203. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; });
  204. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; });
  205. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; });
  206. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; });
  207. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; });
  208. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; });
  209. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; });
  210. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; });
  211. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; });
  212. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; });
  213. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; });
  214. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; });
  215. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; });
  216. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; });
  217. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; });
  218. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; });
  219. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; });
  220. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; });
  221. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; });
  222. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; });
  223. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; });
  224. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; });
  225. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; });
  226. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; });
  227. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; });
  228. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; });
  229. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; });
  230. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; });
  231. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; });
  232. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; });
  233. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; });
  234. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; });
  235. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; });
  236. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; });
  237. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; });
  238. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; });
  239. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; });
  240. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; });
  241. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; });
  242. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; });
  243. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; });
  244. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; });
  245. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; });
  246. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; });
  247. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; });
  248. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; });
  249. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; });
  250. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; });
  251. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; });
  252. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; });
  253. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; });
  254. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; });
  255. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; });
  256. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; });
  257. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; });
  258. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; });
  259. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; });
  260. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; });
  261. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; });
  262. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; });
  263. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; });
  264. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; });
  265. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; });
  266. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; });
  267. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; });
  268. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; });
  269. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; });
  270. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; });
  271. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; });
  272. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; });
  273. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; });
  274. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; });
  275. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; });
  276. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; });
  277. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; });
  278. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; });
  279. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; });
  280. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; });
  281. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; });
  282. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; });
  283. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; });
  284. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; });
  285. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; });
  286. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; });
  287. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; });
  288. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; });
  289. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; });
  290. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; });
  291. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; });
  292. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; });
  293. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; });
  294. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; });
  295. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; });
  296. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; });
  297. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; });
  298. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; });
  299. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; });
  300. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; });
  301. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; });
  302. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; });
  303. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; });
  304. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; });
  305. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; });
  306. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; });
  307. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; });
  308. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; });
  309. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; });
  310. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; });
  311. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; });
  312. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; });
  313. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; });
  314. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; });
  315. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; });
  316. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; });
  317. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; });
  318. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; });
  319. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; });
  320. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; });
  321. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; });
  322. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; });
  323. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; });
  324. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; });
  325. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; });
  326. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; });
  327. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; });
  328. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; });
  329. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; });
  330. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; });
  331. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; });
  332. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; });
  333. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; });
  334. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; });
  335. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; });
  336. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; });
  337. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; });
  338. /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; });
  339. // ESM Exports
  340. // ===========
  341. // This module is the package entry point for ES module users. In other words,
  342. // it is the module they are interfacing with when they import from the whole
  343. // package instead of from a submodule, like this:
  344. //
  345. // ```js
  346. // import { map } from 'underscore';
  347. // ```
  348. //
  349. // The difference with `./index-default`, which is the package entry point for
  350. // CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
  351. // default exports are considered to be siblings, so when you have a default
  352. // export, its properties are not automatically available as named exports. For
  353. // this reason, we re-export the named exports in addition to providing the same
  354. // default export as in `./index-default`.
  355. /***/ }),
  356. /* 4 */
  357. /***/ (function(module, exports, __webpack_require__) {
  358. var NATIVE_BIND = __webpack_require__(76);
  359. var FunctionPrototype = Function.prototype;
  360. var bind = FunctionPrototype.bind;
  361. var call = FunctionPrototype.call;
  362. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  363. module.exports = NATIVE_BIND ? function (fn) {
  364. return fn && uncurryThis(fn);
  365. } : function (fn) {
  366. return fn && function () {
  367. return call.apply(fn, arguments);
  368. };
  369. };
  370. /***/ }),
  371. /* 5 */
  372. /***/ (function(module, exports) {
  373. module.exports = {};
  374. /***/ }),
  375. /* 6 */
  376. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  377. "use strict";
  378. /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
  379. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
  380. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
  381. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
  382. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
  383. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
  384. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
  385. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
  386. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
  387. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
  388. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
  389. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
  390. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
  391. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
  392. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
  393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
  394. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
  395. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
  396. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
  397. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
  398. // Current version.
  399. var VERSION = '1.12.1';
  400. // Establish the root object, `window` (`self`) in the browser, `global`
  401. // on the server, or `this` in some virtual machines. We use `self`
  402. // instead of `window` for `WebWorker` support.
  403. var root = typeof self == 'object' && self.self === self && self ||
  404. typeof global == 'object' && global.global === global && global ||
  405. Function('return this')() ||
  406. {};
  407. // Save bytes in the minified (but not gzipped) version:
  408. var ArrayProto = Array.prototype, ObjProto = Object.prototype;
  409. var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
  410. // Create quick reference variables for speed access to core prototypes.
  411. var push = ArrayProto.push,
  412. slice = ArrayProto.slice,
  413. toString = ObjProto.toString,
  414. hasOwnProperty = ObjProto.hasOwnProperty;
  415. // Modern feature detection.
  416. var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
  417. supportsDataView = typeof DataView !== 'undefined';
  418. // All **ECMAScript 5+** native function implementations that we hope to use
  419. // are declared here.
  420. var nativeIsArray = Array.isArray,
  421. nativeKeys = Object.keys,
  422. nativeCreate = Object.create,
  423. nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
  424. // Create references to these builtin functions because we override them.
  425. var _isNaN = isNaN,
  426. _isFinite = isFinite;
  427. // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
  428. var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
  429. var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
  430. 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
  431. // The largest integer that can be represented exactly.
  432. var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
  433. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(74)))
  434. /***/ }),
  435. /* 7 */
  436. /***/ (function(module, exports, __webpack_require__) {
  437. /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
  438. return it && it.Math == Math && it;
  439. };
  440. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  441. module.exports =
  442. // eslint-disable-next-line es-x/no-global-this -- safe
  443. check(typeof globalThis == 'object' && globalThis) ||
  444. check(typeof window == 'object' && window) ||
  445. // eslint-disable-next-line no-restricted-globals -- safe
  446. check(typeof self == 'object' && self) ||
  447. check(typeof global == 'object' && global) ||
  448. // eslint-disable-next-line no-new-func -- fallback
  449. (function () { return this; })() || Function('return this')();
  450. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  451. /***/ }),
  452. /* 8 */
  453. /***/ (function(module, exports) {
  454. // `IsCallable` abstract operation
  455. // https://tc39.es/ecma262/#sec-iscallable
  456. module.exports = function (argument) {
  457. return typeof argument == 'function';
  458. };
  459. /***/ }),
  460. /* 9 */
  461. /***/ (function(module, exports, __webpack_require__) {
  462. var global = __webpack_require__(7);
  463. var shared = __webpack_require__(79);
  464. var hasOwn = __webpack_require__(13);
  465. var uid = __webpack_require__(99);
  466. var NATIVE_SYMBOL = __webpack_require__(64);
  467. var USE_SYMBOL_AS_UID = __webpack_require__(157);
  468. var WellKnownSymbolsStore = shared('wks');
  469. var Symbol = global.Symbol;
  470. var symbolFor = Symbol && Symbol['for'];
  471. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  472. module.exports = function (name) {
  473. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  474. var description = 'Symbol.' + name;
  475. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  476. WellKnownSymbolsStore[name] = Symbol[name];
  477. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  478. WellKnownSymbolsStore[name] = symbolFor(description);
  479. } else {
  480. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  481. }
  482. } return WellKnownSymbolsStore[name];
  483. };
  484. /***/ }),
  485. /* 10 */
  486. /***/ (function(module, exports, __webpack_require__) {
  487. var path = __webpack_require__(5);
  488. var hasOwn = __webpack_require__(13);
  489. var wrappedWellKnownSymbolModule = __webpack_require__(148);
  490. var defineProperty = __webpack_require__(23).f;
  491. module.exports = function (NAME) {
  492. var Symbol = path.Symbol || (path.Symbol = {});
  493. if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
  494. value: wrappedWellKnownSymbolModule.f(NAME)
  495. });
  496. };
  497. /***/ }),
  498. /* 11 */
  499. /***/ (function(module, exports, __webpack_require__) {
  500. var isCallable = __webpack_require__(8);
  501. module.exports = function (it) {
  502. return typeof it == 'object' ? it !== null : isCallable(it);
  503. };
  504. /***/ }),
  505. /* 12 */
  506. /***/ (function(module, exports, __webpack_require__) {
  507. module.exports = __webpack_require__(281);
  508. /***/ }),
  509. /* 13 */
  510. /***/ (function(module, exports, __webpack_require__) {
  511. var uncurryThis = __webpack_require__(4);
  512. var toObject = __webpack_require__(34);
  513. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  514. // `HasOwnProperty` abstract operation
  515. // https://tc39.es/ecma262/#sec-hasownproperty
  516. // eslint-disable-next-line es-x/no-object-hasown -- safe
  517. module.exports = Object.hasOwn || function hasOwn(it, key) {
  518. return hasOwnProperty(toObject(it), key);
  519. };
  520. /***/ }),
  521. /* 14 */
  522. /***/ (function(module, exports, __webpack_require__) {
  523. var fails = __webpack_require__(2);
  524. // Detect IE8's incomplete defineProperty implementation
  525. module.exports = !fails(function () {
  526. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  527. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  528. });
  529. /***/ }),
  530. /* 15 */
  531. /***/ (function(module, exports, __webpack_require__) {
  532. var NATIVE_BIND = __webpack_require__(76);
  533. var call = Function.prototype.call;
  534. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  535. return call.apply(call, arguments);
  536. };
  537. /***/ }),
  538. /* 16 */
  539. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  540. "use strict";
  541. /* harmony export (immutable) */ __webpack_exports__["a"] = keys;
  542. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
  543. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  544. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
  545. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(190);
  546. // Retrieve the names of an object's own properties.
  547. // Delegates to **ECMAScript 5**'s native `Object.keys`.
  548. function keys(obj) {
  549. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
  550. if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
  551. var keys = [];
  552. for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
  553. // Ahem, IE < 9.
  554. if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
  555. return keys;
  556. }
  557. /***/ }),
  558. /* 17 */
  559. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  560. "use strict";
  561. /* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
  562. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  563. // Internal function for creating a `toString`-based type tester.
  564. function tagTester(name) {
  565. var tag = '[object ' + name + ']';
  566. return function(obj) {
  567. return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
  568. };
  569. }
  570. /***/ }),
  571. /* 18 */
  572. /***/ (function(module, exports, __webpack_require__) {
  573. var path = __webpack_require__(5);
  574. var global = __webpack_require__(7);
  575. var isCallable = __webpack_require__(8);
  576. var aFunction = function (variable) {
  577. return isCallable(variable) ? variable : undefined;
  578. };
  579. module.exports = function (namespace, method) {
  580. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
  581. : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  582. };
  583. /***/ }),
  584. /* 19 */
  585. /***/ (function(module, exports, __webpack_require__) {
  586. var uncurryThis = __webpack_require__(4);
  587. module.exports = uncurryThis({}.isPrototypeOf);
  588. /***/ }),
  589. /* 20 */
  590. /***/ (function(module, exports, __webpack_require__) {
  591. var isObject = __webpack_require__(11);
  592. var $String = String;
  593. var $TypeError = TypeError;
  594. // `Assert: Type(argument) is Object`
  595. module.exports = function (argument) {
  596. if (isObject(argument)) return argument;
  597. throw $TypeError($String(argument) + ' is not an object');
  598. };
  599. /***/ }),
  600. /* 21 */
  601. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  602. "use strict";
  603. /* harmony export (immutable) */ __webpack_exports__["a"] = cb;
  604. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  605. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
  606. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(201);
  607. // The function we call internally to generate a callback. It invokes
  608. // `_.iteratee` if overridden, otherwise `baseIteratee`.
  609. function cb(value, context, argCount) {
  610. if (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee !== __WEBPACK_IMPORTED_MODULE_2__iteratee_js__["a" /* default */]) return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee(value, context);
  611. return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
  612. }
  613. /***/ }),
  614. /* 22 */
  615. /***/ (function(module, exports, __webpack_require__) {
  616. module.exports = __webpack_require__(390);
  617. /***/ }),
  618. /* 23 */
  619. /***/ (function(module, exports, __webpack_require__) {
  620. var DESCRIPTORS = __webpack_require__(14);
  621. var IE8_DOM_DEFINE = __webpack_require__(158);
  622. var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
  623. var anObject = __webpack_require__(20);
  624. var toPropertyKey = __webpack_require__(96);
  625. var $TypeError = TypeError;
  626. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  627. var $defineProperty = Object.defineProperty;
  628. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  629. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  630. var ENUMERABLE = 'enumerable';
  631. var CONFIGURABLE = 'configurable';
  632. var WRITABLE = 'writable';
  633. // `Object.defineProperty` method
  634. // https://tc39.es/ecma262/#sec-object.defineproperty
  635. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  636. anObject(O);
  637. P = toPropertyKey(P);
  638. anObject(Attributes);
  639. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  640. var current = $getOwnPropertyDescriptor(O, P);
  641. if (current && current[WRITABLE]) {
  642. O[P] = Attributes.value;
  643. Attributes = {
  644. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  645. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  646. writable: false
  647. };
  648. }
  649. } return $defineProperty(O, P, Attributes);
  650. } : $defineProperty : function defineProperty(O, P, Attributes) {
  651. anObject(O);
  652. P = toPropertyKey(P);
  653. anObject(Attributes);
  654. if (IE8_DOM_DEFINE) try {
  655. return $defineProperty(O, P, Attributes);
  656. } catch (error) { /* empty */ }
  657. if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
  658. if ('value' in Attributes) O[P] = Attributes.value;
  659. return O;
  660. };
  661. /***/ }),
  662. /* 24 */
  663. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  664. "use strict";
  665. /* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
  666. // Some functions take a variable number of arguments, or a few expected
  667. // arguments at the beginning and then a variable number of values to operate
  668. // on. This helper accumulates all remaining arguments past the function’s
  669. // argument length (or an explicit `startIndex`), into an array that becomes
  670. // the last argument. Similar to ES6’s "rest parameter".
  671. function restArguments(func, startIndex) {
  672. startIndex = startIndex == null ? func.length - 1 : +startIndex;
  673. return function() {
  674. var length = Math.max(arguments.length - startIndex, 0),
  675. rest = Array(length),
  676. index = 0;
  677. for (; index < length; index++) {
  678. rest[index] = arguments[index + startIndex];
  679. }
  680. switch (startIndex) {
  681. case 0: return func.call(this, rest);
  682. case 1: return func.call(this, arguments[0], rest);
  683. case 2: return func.call(this, arguments[0], arguments[1], rest);
  684. }
  685. var args = Array(startIndex + 1);
  686. for (index = 0; index < startIndex; index++) {
  687. args[index] = arguments[index];
  688. }
  689. args[startIndex] = rest;
  690. return func.apply(this, args);
  691. };
  692. }
  693. /***/ }),
  694. /* 25 */
  695. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  696. "use strict";
  697. /* harmony export (immutable) */ __webpack_exports__["a"] = _;
  698. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  699. // If Underscore is called as a function, it returns a wrapped object that can
  700. // be used OO-style. This wrapper holds altered versions of all functions added
  701. // through `_.mixin`. Wrapped objects may be chained.
  702. function _(obj) {
  703. if (obj instanceof _) return obj;
  704. if (!(this instanceof _)) return new _(obj);
  705. this._wrapped = obj;
  706. }
  707. _.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
  708. // Extracts the result from a wrapped and chained object.
  709. _.prototype.value = function() {
  710. return this._wrapped;
  711. };
  712. // Provide unwrapping proxies for some methods used in engine operations
  713. // such as arithmetic and JSON stringification.
  714. _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
  715. _.prototype.toString = function() {
  716. return String(this._wrapped);
  717. };
  718. /***/ }),
  719. /* 26 */
  720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  721. "use strict";
  722. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
  723. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
  724. // Internal helper for collection methods to determine whether a collection
  725. // should be iterated as an array or as an object.
  726. // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
  727. // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
  728. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
  729. /***/ }),
  730. /* 27 */
  731. /***/ (function(module, exports, __webpack_require__) {
  732. "use strict";
  733. var _interopRequireDefault = __webpack_require__(1);
  734. var _concat = _interopRequireDefault(__webpack_require__(22));
  735. var _promise = _interopRequireDefault(__webpack_require__(12));
  736. var _ = __webpack_require__(3);
  737. var md5 = __webpack_require__(526);
  738. var _require = __webpack_require__(3),
  739. extend = _require.extend;
  740. var AV = __webpack_require__(69);
  741. var AVError = __webpack_require__(46);
  742. var _require2 = __webpack_require__(30),
  743. getSessionToken = _require2.getSessionToken;
  744. var ajax = __webpack_require__(116); // 计算 X-LC-Sign 的签名方法
  745. var sign = function sign(key, isMasterKey) {
  746. var _context2;
  747. var now = new Date().getTime();
  748. var signature = md5(now + key);
  749. if (isMasterKey) {
  750. var _context;
  751. return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master");
  752. }
  753. return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now);
  754. };
  755. var setAppKey = function setAppKey(headers, signKey) {
  756. if (signKey) {
  757. headers['X-LC-Sign'] = sign(AV.applicationKey);
  758. } else {
  759. headers['X-LC-Key'] = AV.applicationKey;
  760. }
  761. };
  762. var setHeaders = function setHeaders() {
  763. var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  764. var signKey = arguments.length > 1 ? arguments[1] : undefined;
  765. var headers = {
  766. 'X-LC-Id': AV.applicationId,
  767. 'Content-Type': 'application/json;charset=UTF-8'
  768. };
  769. var useMasterKey = false;
  770. if (typeof authOptions.useMasterKey === 'boolean') {
  771. useMasterKey = authOptions.useMasterKey;
  772. } else if (typeof AV._config.useMasterKey === 'boolean') {
  773. useMasterKey = AV._config.useMasterKey;
  774. }
  775. if (useMasterKey) {
  776. if (AV.masterKey) {
  777. if (signKey) {
  778. headers['X-LC-Sign'] = sign(AV.masterKey, true);
  779. } else {
  780. headers['X-LC-Key'] = "".concat(AV.masterKey, ",master");
  781. }
  782. } else {
  783. console.warn('masterKey is not set, fall back to use appKey');
  784. setAppKey(headers, signKey);
  785. }
  786. } else {
  787. setAppKey(headers, signKey);
  788. }
  789. if (AV.hookKey) {
  790. headers['X-LC-Hook-Key'] = AV.hookKey;
  791. }
  792. if (AV._config.production !== null) {
  793. headers['X-LC-Prod'] = String(AV._config.production);
  794. }
  795. headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
  796. return _promise.default.resolve().then(function () {
  797. // Pass the session token
  798. var sessionToken = getSessionToken(authOptions);
  799. if (sessionToken) {
  800. headers['X-LC-Session'] = sessionToken;
  801. } else if (!AV._config.disableCurrentUser) {
  802. return AV.User.currentAsync().then(function (currentUser) {
  803. if (currentUser && currentUser._sessionToken) {
  804. headers['X-LC-Session'] = currentUser._sessionToken;
  805. }
  806. return headers;
  807. });
  808. }
  809. return headers;
  810. });
  811. };
  812. var createApiUrl = function createApiUrl(_ref) {
  813. var _ref$service = _ref.service,
  814. service = _ref$service === void 0 ? 'api' : _ref$service,
  815. _ref$version = _ref.version,
  816. version = _ref$version === void 0 ? '1.1' : _ref$version,
  817. path = _ref.path;
  818. var apiURL = AV._config.serverURLs[service];
  819. if (!apiURL) throw new Error("undefined server URL for ".concat(service));
  820. if (apiURL.charAt(apiURL.length - 1) !== '/') {
  821. apiURL += '/';
  822. }
  823. apiURL += version;
  824. if (path) {
  825. apiURL += path;
  826. }
  827. return apiURL;
  828. };
  829. /**
  830. * Low level REST API client. Call REST endpoints with authorization headers.
  831. * @function AV.request
  832. * @since 3.0.0
  833. * @param {Object} options
  834. * @param {String} options.method HTTP method
  835. * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
  836. * @param {Object} [options.query] query string dict
  837. * @param {Object} [options.data] HTTP body
  838. * @param {AuthOptions} [options.authOptions]
  839. * @param {String} [options.service = 'api']
  840. * @param {String} [options.version = '1.1']
  841. */
  842. var request = function request(_ref2) {
  843. var service = _ref2.service,
  844. version = _ref2.version,
  845. method = _ref2.method,
  846. path = _ref2.path,
  847. query = _ref2.query,
  848. data = _ref2.data,
  849. authOptions = _ref2.authOptions,
  850. _ref2$signKey = _ref2.signKey,
  851. signKey = _ref2$signKey === void 0 ? true : _ref2$signKey;
  852. if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
  853. throw new Error('Not initialized');
  854. }
  855. if (AV._appRouter) {
  856. AV._appRouter.refresh();
  857. }
  858. var timeout = AV._config.requestTimeout;
  859. var url = createApiUrl({
  860. service: service,
  861. path: path,
  862. version: version
  863. });
  864. return setHeaders(authOptions, signKey).then(function (headers) {
  865. return ajax({
  866. method: method,
  867. url: url,
  868. query: query,
  869. data: data,
  870. headers: headers,
  871. timeout: timeout
  872. }).catch(function (error) {
  873. var errorJSON = {
  874. code: error.code || -1,
  875. error: error.message || error.responseText
  876. };
  877. if (error.response && error.response.code) {
  878. errorJSON = error.response;
  879. } else if (error.responseText) {
  880. try {
  881. errorJSON = JSON.parse(error.responseText);
  882. } catch (e) {// If we fail to parse the error text, that's okay.
  883. }
  884. }
  885. errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
  886. if (!AV._sharedConfig.keepErrorRawMessage) {
  887. var _context3, _context4;
  888. errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]");
  889. } // Transform the error into an instance of AVError by trying to parse
  890. // the error string as JSON.
  891. var err = new AVError(errorJSON.code, errorJSON.error);
  892. delete errorJSON.error;
  893. throw _.extend(err, errorJSON);
  894. });
  895. });
  896. }; // lagecy request
  897. var _request = function _request(route, className, objectId, method, data, authOptions, query) {
  898. var path = '';
  899. if (route) path += "/".concat(route);
  900. if (className) path += "/".concat(className);
  901. if (objectId) path += "/".concat(objectId); // for migeration
  902. if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
  903. if (data && data._where) throw new Error('_where should be in the query');
  904. if (method && method.toLowerCase() === 'get') {
  905. query = extend({}, query, data);
  906. data = null;
  907. }
  908. return request({
  909. method: method,
  910. path: path,
  911. query: query,
  912. data: data,
  913. authOptions: authOptions
  914. });
  915. };
  916. AV.request = request;
  917. module.exports = {
  918. _request: _request,
  919. request: request
  920. };
  921. /***/ }),
  922. /* 28 */
  923. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  924. "use strict";
  925. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  926. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  927. var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
  928. // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
  929. // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
  930. var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
  931. if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
  932. isFunction = function(obj) {
  933. return typeof obj == 'function' || false;
  934. };
  935. }
  936. /* harmony default export */ __webpack_exports__["a"] = (isFunction);
  937. /***/ }),
  938. /* 29 */
  939. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  940. "use strict";
  941. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
  942. // Internal helper to obtain the `length` property of an object.
  943. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
  944. /***/ }),
  945. /* 30 */
  946. /***/ (function(module, exports, __webpack_require__) {
  947. "use strict";
  948. var _interopRequireDefault = __webpack_require__(1);
  949. var _keys = _interopRequireDefault(__webpack_require__(59));
  950. var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
  951. var _promise = _interopRequireDefault(__webpack_require__(12));
  952. var _ = __webpack_require__(3); // Helper function to check null or undefined.
  953. var isNullOrUndefined = function isNullOrUndefined(x) {
  954. return _.isNull(x) || _.isUndefined(x);
  955. };
  956. var ensureArray = function ensureArray(target) {
  957. if (_.isArray(target)) {
  958. return target;
  959. }
  960. if (target === undefined || target === null) {
  961. return [];
  962. }
  963. return [target];
  964. };
  965. var transformFetchOptions = function transformFetchOptions() {
  966. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  967. keys = (0, _keys.default)(_ref),
  968. include = _ref.include,
  969. includeACL = _ref.includeACL;
  970. var fetchOptions = {};
  971. if (keys) {
  972. fetchOptions.keys = ensureArray(keys).join(',');
  973. }
  974. if (include) {
  975. fetchOptions.include = ensureArray(include).join(',');
  976. }
  977. if (includeACL) {
  978. fetchOptions.returnACL = includeACL;
  979. }
  980. return fetchOptions;
  981. };
  982. var getSessionToken = function getSessionToken(authOptions) {
  983. if (authOptions.sessionToken) {
  984. return authOptions.sessionToken;
  985. }
  986. if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
  987. return authOptions.user.getSessionToken();
  988. }
  989. };
  990. var tap = function tap(interceptor) {
  991. return function (value) {
  992. return interceptor(value), value;
  993. };
  994. }; // Shared empty constructor function to aid in prototype-chain creation.
  995. var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses.
  996. // Similar to `goog.inherits`, but uses a hash of prototype properties and
  997. // class properties to be extended.
  998. var inherits = function inherits(parent, protoProps, staticProps) {
  999. var child; // The constructor function for the new subclass is either defined by you
  1000. // (the "constructor" property in your `extend` definition), or defaulted
  1001. // by us to simply call the parent's constructor.
  1002. if (protoProps && protoProps.hasOwnProperty('constructor')) {
  1003. child = protoProps.constructor;
  1004. } else {
  1005. /** @ignore */
  1006. child = function child() {
  1007. parent.apply(this, arguments);
  1008. };
  1009. } // Inherit class (static) properties from parent.
  1010. _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling
  1011. // `parent`'s constructor function.
  1012. EmptyConstructor.prototype = parent.prototype;
  1013. child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass,
  1014. // if supplied.
  1015. if (protoProps) {
  1016. _.extend(child.prototype, protoProps);
  1017. } // Add static properties to the constructor function, if supplied.
  1018. if (staticProps) {
  1019. _.extend(child, staticProps);
  1020. } // Correctly set child's `prototype.constructor`.
  1021. child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is
  1022. // needed later.
  1023. child.__super__ = parent.prototype;
  1024. return child;
  1025. };
  1026. var parseDate = function parseDate(iso8601) {
  1027. return new Date(iso8601);
  1028. };
  1029. var setValue = function setValue(target, key, value) {
  1030. // '.' is not allowed in Class keys, escaping is not in concern now.
  1031. var segs = key.split('.');
  1032. var lastSeg = segs.pop();
  1033. var currentTarget = target;
  1034. segs.forEach(function (seg) {
  1035. if (currentTarget[seg] === undefined) currentTarget[seg] = {};
  1036. currentTarget = currentTarget[seg];
  1037. });
  1038. currentTarget[lastSeg] = value;
  1039. return target;
  1040. };
  1041. var findValue = function findValue(target, key) {
  1042. var segs = key.split('.');
  1043. var firstSeg = segs[0];
  1044. var lastSeg = segs.pop();
  1045. var currentTarget = target;
  1046. for (var i = 0; i < segs.length; i++) {
  1047. currentTarget = currentTarget[segs[i]];
  1048. if (currentTarget === undefined) {
  1049. return [undefined, undefined, lastSeg];
  1050. }
  1051. }
  1052. var value = currentTarget[lastSeg];
  1053. return [value, currentTarget, lastSeg, firstSeg];
  1054. };
  1055. var isPlainObject = function isPlainObject(obj) {
  1056. return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
  1057. };
  1058. var continueWhile = function continueWhile(predicate, asyncFunction) {
  1059. if (predicate()) {
  1060. return asyncFunction().then(function () {
  1061. return continueWhile(predicate, asyncFunction);
  1062. });
  1063. }
  1064. return _promise.default.resolve();
  1065. };
  1066. module.exports = {
  1067. isNullOrUndefined: isNullOrUndefined,
  1068. ensureArray: ensureArray,
  1069. transformFetchOptions: transformFetchOptions,
  1070. getSessionToken: getSessionToken,
  1071. tap: tap,
  1072. inherits: inherits,
  1073. parseDate: parseDate,
  1074. setValue: setValue,
  1075. findValue: findValue,
  1076. isPlainObject: isPlainObject,
  1077. continueWhile: continueWhile
  1078. };
  1079. /***/ }),
  1080. /* 31 */
  1081. /***/ (function(module, exports, __webpack_require__) {
  1082. var isCallable = __webpack_require__(8);
  1083. var tryToString = __webpack_require__(78);
  1084. var $TypeError = TypeError;
  1085. // `Assert: IsCallable(argument) is true`
  1086. module.exports = function (argument) {
  1087. if (isCallable(argument)) return argument;
  1088. throw $TypeError(tryToString(argument) + ' is not a function');
  1089. };
  1090. /***/ }),
  1091. /* 32 */
  1092. /***/ (function(module, exports, __webpack_require__) {
  1093. // toObject with fallback for non-array-like ES3 strings
  1094. var IndexedObject = __webpack_require__(95);
  1095. var requireObjectCoercible = __webpack_require__(121);
  1096. module.exports = function (it) {
  1097. return IndexedObject(requireObjectCoercible(it));
  1098. };
  1099. /***/ }),
  1100. /* 33 */
  1101. /***/ (function(module, exports) {
  1102. module.exports = true;
  1103. /***/ }),
  1104. /* 34 */
  1105. /***/ (function(module, exports, __webpack_require__) {
  1106. var requireObjectCoercible = __webpack_require__(121);
  1107. var $Object = Object;
  1108. // `ToObject` abstract operation
  1109. // https://tc39.es/ecma262/#sec-toobject
  1110. module.exports = function (argument) {
  1111. return $Object(requireObjectCoercible(argument));
  1112. };
  1113. /***/ }),
  1114. /* 35 */
  1115. /***/ (function(module, exports, __webpack_require__) {
  1116. module.exports = __webpack_require__(395);
  1117. /***/ }),
  1118. /* 36 */
  1119. /***/ (function(module, exports, __webpack_require__) {
  1120. module.exports = __webpack_require__(402);
  1121. /***/ }),
  1122. /* 37 */
  1123. /***/ (function(module, exports, __webpack_require__) {
  1124. var DESCRIPTORS = __webpack_require__(14);
  1125. var definePropertyModule = __webpack_require__(23);
  1126. var createPropertyDescriptor = __webpack_require__(47);
  1127. module.exports = DESCRIPTORS ? function (object, key, value) {
  1128. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  1129. } : function (object, key, value) {
  1130. object[key] = value;
  1131. return object;
  1132. };
  1133. /***/ }),
  1134. /* 38 */
  1135. /***/ (function(module, exports, __webpack_require__) {
  1136. "use strict";
  1137. var toIndexedObject = __webpack_require__(32);
  1138. var addToUnscopables = __webpack_require__(169);
  1139. var Iterators = __webpack_require__(50);
  1140. var InternalStateModule = __webpack_require__(43);
  1141. var defineProperty = __webpack_require__(23).f;
  1142. var defineIterator = __webpack_require__(131);
  1143. var IS_PURE = __webpack_require__(33);
  1144. var DESCRIPTORS = __webpack_require__(14);
  1145. var ARRAY_ITERATOR = 'Array Iterator';
  1146. var setInternalState = InternalStateModule.set;
  1147. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  1148. // `Array.prototype.entries` method
  1149. // https://tc39.es/ecma262/#sec-array.prototype.entries
  1150. // `Array.prototype.keys` method
  1151. // https://tc39.es/ecma262/#sec-array.prototype.keys
  1152. // `Array.prototype.values` method
  1153. // https://tc39.es/ecma262/#sec-array.prototype.values
  1154. // `Array.prototype[@@iterator]` method
  1155. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  1156. // `CreateArrayIterator` internal method
  1157. // https://tc39.es/ecma262/#sec-createarrayiterator
  1158. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  1159. setInternalState(this, {
  1160. type: ARRAY_ITERATOR,
  1161. target: toIndexedObject(iterated), // target
  1162. index: 0, // next index
  1163. kind: kind // kind
  1164. });
  1165. // `%ArrayIteratorPrototype%.next` method
  1166. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  1167. }, function () {
  1168. var state = getInternalState(this);
  1169. var target = state.target;
  1170. var kind = state.kind;
  1171. var index = state.index++;
  1172. if (!target || index >= target.length) {
  1173. state.target = undefined;
  1174. return { value: undefined, done: true };
  1175. }
  1176. if (kind == 'keys') return { value: index, done: false };
  1177. if (kind == 'values') return { value: target[index], done: false };
  1178. return { value: [index, target[index]], done: false };
  1179. }, 'values');
  1180. // argumentsList[@@iterator] is %ArrayProto_values%
  1181. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  1182. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  1183. var values = Iterators.Arguments = Iterators.Array;
  1184. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1185. addToUnscopables('keys');
  1186. addToUnscopables('values');
  1187. addToUnscopables('entries');
  1188. // V8 ~ Chrome 45- bug
  1189. if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
  1190. defineProperty(values, 'name', { value: 'values' });
  1191. } catch (error) { /* empty */ }
  1192. /***/ }),
  1193. /* 39 */
  1194. /***/ (function(module, exports, __webpack_require__) {
  1195. __webpack_require__(38);
  1196. var DOMIterables = __webpack_require__(317);
  1197. var global = __webpack_require__(7);
  1198. var classof = __webpack_require__(51);
  1199. var createNonEnumerableProperty = __webpack_require__(37);
  1200. var Iterators = __webpack_require__(50);
  1201. var wellKnownSymbol = __webpack_require__(9);
  1202. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1203. for (var COLLECTION_NAME in DOMIterables) {
  1204. var Collection = global[COLLECTION_NAME];
  1205. var CollectionPrototype = Collection && Collection.prototype;
  1206. if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
  1207. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  1208. }
  1209. Iterators[COLLECTION_NAME] = Iterators.Array;
  1210. }
  1211. /***/ }),
  1212. /* 40 */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. var path = __webpack_require__(5);
  1215. module.exports = function (CONSTRUCTOR) {
  1216. return path[CONSTRUCTOR + 'Prototype'];
  1217. };
  1218. /***/ }),
  1219. /* 41 */
  1220. /***/ (function(module, exports, __webpack_require__) {
  1221. var toLength = __webpack_require__(291);
  1222. // `LengthOfArrayLike` abstract operation
  1223. // https://tc39.es/ecma262/#sec-lengthofarraylike
  1224. module.exports = function (obj) {
  1225. return toLength(obj.length);
  1226. };
  1227. /***/ }),
  1228. /* 42 */
  1229. /***/ (function(module, exports, __webpack_require__) {
  1230. var bind = __webpack_require__(48);
  1231. var call = __webpack_require__(15);
  1232. var anObject = __webpack_require__(20);
  1233. var tryToString = __webpack_require__(78);
  1234. var isArrayIteratorMethod = __webpack_require__(166);
  1235. var lengthOfArrayLike = __webpack_require__(41);
  1236. var isPrototypeOf = __webpack_require__(19);
  1237. var getIterator = __webpack_require__(167);
  1238. var getIteratorMethod = __webpack_require__(106);
  1239. var iteratorClose = __webpack_require__(168);
  1240. var $TypeError = TypeError;
  1241. var Result = function (stopped, result) {
  1242. this.stopped = stopped;
  1243. this.result = result;
  1244. };
  1245. var ResultPrototype = Result.prototype;
  1246. module.exports = function (iterable, unboundFunction, options) {
  1247. var that = options && options.that;
  1248. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  1249. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  1250. var INTERRUPTED = !!(options && options.INTERRUPTED);
  1251. var fn = bind(unboundFunction, that);
  1252. var iterator, iterFn, index, length, result, next, step;
  1253. var stop = function (condition) {
  1254. if (iterator) iteratorClose(iterator, 'normal', condition);
  1255. return new Result(true, condition);
  1256. };
  1257. var callFn = function (value) {
  1258. if (AS_ENTRIES) {
  1259. anObject(value);
  1260. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  1261. } return INTERRUPTED ? fn(value, stop) : fn(value);
  1262. };
  1263. if (IS_ITERATOR) {
  1264. iterator = iterable;
  1265. } else {
  1266. iterFn = getIteratorMethod(iterable);
  1267. if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
  1268. // optimisation for array iterators
  1269. if (isArrayIteratorMethod(iterFn)) {
  1270. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  1271. result = callFn(iterable[index]);
  1272. if (result && isPrototypeOf(ResultPrototype, result)) return result;
  1273. } return new Result(false);
  1274. }
  1275. iterator = getIterator(iterable, iterFn);
  1276. }
  1277. next = iterator.next;
  1278. while (!(step = call(next, iterator)).done) {
  1279. try {
  1280. result = callFn(step.value);
  1281. } catch (error) {
  1282. iteratorClose(iterator, 'throw', error);
  1283. }
  1284. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
  1285. } return new Result(false);
  1286. };
  1287. /***/ }),
  1288. /* 43 */
  1289. /***/ (function(module, exports, __webpack_require__) {
  1290. var NATIVE_WEAK_MAP = __webpack_require__(170);
  1291. var global = __webpack_require__(7);
  1292. var uncurryThis = __webpack_require__(4);
  1293. var isObject = __webpack_require__(11);
  1294. var createNonEnumerableProperty = __webpack_require__(37);
  1295. var hasOwn = __webpack_require__(13);
  1296. var shared = __webpack_require__(123);
  1297. var sharedKey = __webpack_require__(101);
  1298. var hiddenKeys = __webpack_require__(80);
  1299. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  1300. var TypeError = global.TypeError;
  1301. var WeakMap = global.WeakMap;
  1302. var set, get, has;
  1303. var enforce = function (it) {
  1304. return has(it) ? get(it) : set(it, {});
  1305. };
  1306. var getterFor = function (TYPE) {
  1307. return function (it) {
  1308. var state;
  1309. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  1310. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  1311. } return state;
  1312. };
  1313. };
  1314. if (NATIVE_WEAK_MAP || shared.state) {
  1315. var store = shared.state || (shared.state = new WeakMap());
  1316. var wmget = uncurryThis(store.get);
  1317. var wmhas = uncurryThis(store.has);
  1318. var wmset = uncurryThis(store.set);
  1319. set = function (it, metadata) {
  1320. if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  1321. metadata.facade = it;
  1322. wmset(store, it, metadata);
  1323. return metadata;
  1324. };
  1325. get = function (it) {
  1326. return wmget(store, it) || {};
  1327. };
  1328. has = function (it) {
  1329. return wmhas(store, it);
  1330. };
  1331. } else {
  1332. var STATE = sharedKey('state');
  1333. hiddenKeys[STATE] = true;
  1334. set = function (it, metadata) {
  1335. if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  1336. metadata.facade = it;
  1337. createNonEnumerableProperty(it, STATE, metadata);
  1338. return metadata;
  1339. };
  1340. get = function (it) {
  1341. return hasOwn(it, STATE) ? it[STATE] : {};
  1342. };
  1343. has = function (it) {
  1344. return hasOwn(it, STATE);
  1345. };
  1346. }
  1347. module.exports = {
  1348. set: set,
  1349. get: get,
  1350. has: has,
  1351. enforce: enforce,
  1352. getterFor: getterFor
  1353. };
  1354. /***/ }),
  1355. /* 44 */
  1356. /***/ (function(module, exports, __webpack_require__) {
  1357. var createNonEnumerableProperty = __webpack_require__(37);
  1358. module.exports = function (target, key, value, options) {
  1359. if (options && options.enumerable) target[key] = value;
  1360. else createNonEnumerableProperty(target, key, value);
  1361. return target;
  1362. };
  1363. /***/ }),
  1364. /* 45 */
  1365. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1366. "use strict";
  1367. /* harmony export (immutable) */ __webpack_exports__["a"] = has;
  1368. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  1369. // Internal function to check whether `key` is an own property name of `obj`.
  1370. function has(obj, key) {
  1371. return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
  1372. }
  1373. /***/ }),
  1374. /* 46 */
  1375. /***/ (function(module, exports, __webpack_require__) {
  1376. "use strict";
  1377. var _interopRequireDefault = __webpack_require__(1);
  1378. var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238));
  1379. var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
  1380. var _ = __webpack_require__(3);
  1381. /**
  1382. * @class AV.Error
  1383. */
  1384. function AVError(code, message) {
  1385. if (this instanceof AVError ? this.constructor : void 0) {
  1386. var error = new Error(message);
  1387. (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
  1388. error.code = code;
  1389. return error;
  1390. }
  1391. return new AVError(code, message);
  1392. }
  1393. AVError.prototype = Object.create(Error.prototype, {
  1394. constructor: {
  1395. value: Error,
  1396. enumerable: false,
  1397. writable: true,
  1398. configurable: true
  1399. }
  1400. });
  1401. (0, _setPrototypeOf.default)(AVError, Error);
  1402. _.extend(AVError,
  1403. /** @lends AV.Error */
  1404. {
  1405. /**
  1406. * Error code indicating some error other than those enumerated here.
  1407. * @constant
  1408. */
  1409. OTHER_CAUSE: -1,
  1410. /**
  1411. * Error code indicating that something has gone wrong with the server.
  1412. * If you get this error code, it is AV's fault.
  1413. * @constant
  1414. */
  1415. INTERNAL_SERVER_ERROR: 1,
  1416. /**
  1417. * Error code indicating the connection to the AV servers failed.
  1418. * @constant
  1419. */
  1420. CONNECTION_FAILED: 100,
  1421. /**
  1422. * Error code indicating the specified object doesn't exist.
  1423. * @constant
  1424. */
  1425. OBJECT_NOT_FOUND: 101,
  1426. /**
  1427. * Error code indicating you tried to query with a datatype that doesn't
  1428. * support it, like exact matching an array or object.
  1429. * @constant
  1430. */
  1431. INVALID_QUERY: 102,
  1432. /**
  1433. * Error code indicating a missing or invalid classname. Classnames are
  1434. * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
  1435. * only valid characters.
  1436. * @constant
  1437. */
  1438. INVALID_CLASS_NAME: 103,
  1439. /**
  1440. * Error code indicating an unspecified object id.
  1441. * @constant
  1442. */
  1443. MISSING_OBJECT_ID: 104,
  1444. /**
  1445. * Error code indicating an invalid key name. Keys are case-sensitive. They
  1446. * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
  1447. * @constant
  1448. */
  1449. INVALID_KEY_NAME: 105,
  1450. /**
  1451. * Error code indicating a malformed pointer. You should not see this unless
  1452. * you have been mucking about changing internal AV code.
  1453. * @constant
  1454. */
  1455. INVALID_POINTER: 106,
  1456. /**
  1457. * Error code indicating that badly formed JSON was received upstream. This
  1458. * either indicates you have done something unusual with modifying how
  1459. * things encode to JSON, or the network is failing badly.
  1460. * @constant
  1461. */
  1462. INVALID_JSON: 107,
  1463. /**
  1464. * Error code indicating that the feature you tried to access is only
  1465. * available internally for testing purposes.
  1466. * @constant
  1467. */
  1468. COMMAND_UNAVAILABLE: 108,
  1469. /**
  1470. * You must call AV.initialize before using the AV library.
  1471. * @constant
  1472. */
  1473. NOT_INITIALIZED: 109,
  1474. /**
  1475. * Error code indicating that a field was set to an inconsistent type.
  1476. * @constant
  1477. */
  1478. INCORRECT_TYPE: 111,
  1479. /**
  1480. * Error code indicating an invalid channel name. A channel name is either
  1481. * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
  1482. * characters.
  1483. * @constant
  1484. */
  1485. INVALID_CHANNEL_NAME: 112,
  1486. /**
  1487. * Error code indicating that push is misconfigured.
  1488. * @constant
  1489. */
  1490. PUSH_MISCONFIGURED: 115,
  1491. /**
  1492. * Error code indicating that the object is too large.
  1493. * @constant
  1494. */
  1495. OBJECT_TOO_LARGE: 116,
  1496. /**
  1497. * Error code indicating that the operation isn't allowed for clients.
  1498. * @constant
  1499. */
  1500. OPERATION_FORBIDDEN: 119,
  1501. /**
  1502. * Error code indicating the result was not found in the cache.
  1503. * @constant
  1504. */
  1505. CACHE_MISS: 120,
  1506. /**
  1507. * Error code indicating that an invalid key was used in a nested
  1508. * JSONObject.
  1509. * @constant
  1510. */
  1511. INVALID_NESTED_KEY: 121,
  1512. /**
  1513. * Error code indicating that an invalid filename was used for AVFile.
  1514. * A valid file name contains only a-zA-Z0-9_. characters and is between 1
  1515. * and 128 characters.
  1516. * @constant
  1517. */
  1518. INVALID_FILE_NAME: 122,
  1519. /**
  1520. * Error code indicating an invalid ACL was provided.
  1521. * @constant
  1522. */
  1523. INVALID_ACL: 123,
  1524. /**
  1525. * Error code indicating that the request timed out on the server. Typically
  1526. * this indicates that the request is too expensive to run.
  1527. * @constant
  1528. */
  1529. TIMEOUT: 124,
  1530. /**
  1531. * Error code indicating that the email address was invalid.
  1532. * @constant
  1533. */
  1534. INVALID_EMAIL_ADDRESS: 125,
  1535. /**
  1536. * Error code indicating a missing content type.
  1537. * @constant
  1538. */
  1539. MISSING_CONTENT_TYPE: 126,
  1540. /**
  1541. * Error code indicating a missing content length.
  1542. * @constant
  1543. */
  1544. MISSING_CONTENT_LENGTH: 127,
  1545. /**
  1546. * Error code indicating an invalid content length.
  1547. * @constant
  1548. */
  1549. INVALID_CONTENT_LENGTH: 128,
  1550. /**
  1551. * Error code indicating a file that was too large.
  1552. * @constant
  1553. */
  1554. FILE_TOO_LARGE: 129,
  1555. /**
  1556. * Error code indicating an error saving a file.
  1557. * @constant
  1558. */
  1559. FILE_SAVE_ERROR: 130,
  1560. /**
  1561. * Error code indicating an error deleting a file.
  1562. * @constant
  1563. */
  1564. FILE_DELETE_ERROR: 153,
  1565. /**
  1566. * Error code indicating that a unique field was given a value that is
  1567. * already taken.
  1568. * @constant
  1569. */
  1570. DUPLICATE_VALUE: 137,
  1571. /**
  1572. * Error code indicating that a role's name is invalid.
  1573. * @constant
  1574. */
  1575. INVALID_ROLE_NAME: 139,
  1576. /**
  1577. * Error code indicating that an application quota was exceeded. Upgrade to
  1578. * resolve.
  1579. * @constant
  1580. */
  1581. EXCEEDED_QUOTA: 140,
  1582. /**
  1583. * Error code indicating that a Cloud Code script failed.
  1584. * @constant
  1585. */
  1586. SCRIPT_FAILED: 141,
  1587. /**
  1588. * Error code indicating that a Cloud Code validation failed.
  1589. * @constant
  1590. */
  1591. VALIDATION_ERROR: 142,
  1592. /**
  1593. * Error code indicating that invalid image data was provided.
  1594. * @constant
  1595. */
  1596. INVALID_IMAGE_DATA: 150,
  1597. /**
  1598. * Error code indicating an unsaved file.
  1599. * @constant
  1600. */
  1601. UNSAVED_FILE_ERROR: 151,
  1602. /**
  1603. * Error code indicating an invalid push time.
  1604. * @constant
  1605. */
  1606. INVALID_PUSH_TIME_ERROR: 152,
  1607. /**
  1608. * Error code indicating that the username is missing or empty.
  1609. * @constant
  1610. */
  1611. USERNAME_MISSING: 200,
  1612. /**
  1613. * Error code indicating that the password is missing or empty.
  1614. * @constant
  1615. */
  1616. PASSWORD_MISSING: 201,
  1617. /**
  1618. * Error code indicating that the username has already been taken.
  1619. * @constant
  1620. */
  1621. USERNAME_TAKEN: 202,
  1622. /**
  1623. * Error code indicating that the email has already been taken.
  1624. * @constant
  1625. */
  1626. EMAIL_TAKEN: 203,
  1627. /**
  1628. * Error code indicating that the email is missing, but must be specified.
  1629. * @constant
  1630. */
  1631. EMAIL_MISSING: 204,
  1632. /**
  1633. * Error code indicating that a user with the specified email was not found.
  1634. * @constant
  1635. */
  1636. EMAIL_NOT_FOUND: 205,
  1637. /**
  1638. * Error code indicating that a user object without a valid session could
  1639. * not be altered.
  1640. * @constant
  1641. */
  1642. SESSION_MISSING: 206,
  1643. /**
  1644. * Error code indicating that a user can only be created through signup.
  1645. * @constant
  1646. */
  1647. MUST_CREATE_USER_THROUGH_SIGNUP: 207,
  1648. /**
  1649. * Error code indicating that an an account being linked is already linked
  1650. * to another user.
  1651. * @constant
  1652. */
  1653. ACCOUNT_ALREADY_LINKED: 208,
  1654. /**
  1655. * Error code indicating that a user cannot be linked to an account because
  1656. * that account's id could not be found.
  1657. * @constant
  1658. */
  1659. LINKED_ID_MISSING: 250,
  1660. /**
  1661. * Error code indicating that a user with a linked (e.g. Facebook) account
  1662. * has an invalid session.
  1663. * @constant
  1664. */
  1665. INVALID_LINKED_SESSION: 251,
  1666. /**
  1667. * Error code indicating that a service being linked (e.g. Facebook or
  1668. * Twitter) is unsupported.
  1669. * @constant
  1670. */
  1671. UNSUPPORTED_SERVICE: 252,
  1672. /**
  1673. * Error code indicating a real error code is unavailable because
  1674. * we had to use an XDomainRequest object to allow CORS requests in
  1675. * Internet Explorer, which strips the body from HTTP responses that have
  1676. * a non-2XX status code.
  1677. * @constant
  1678. */
  1679. X_DOMAIN_REQUEST: 602
  1680. });
  1681. module.exports = AVError;
  1682. /***/ }),
  1683. /* 47 */
  1684. /***/ (function(module, exports) {
  1685. module.exports = function (bitmap, value) {
  1686. return {
  1687. enumerable: !(bitmap & 1),
  1688. configurable: !(bitmap & 2),
  1689. writable: !(bitmap & 4),
  1690. value: value
  1691. };
  1692. };
  1693. /***/ }),
  1694. /* 48 */
  1695. /***/ (function(module, exports, __webpack_require__) {
  1696. var uncurryThis = __webpack_require__(4);
  1697. var aCallable = __webpack_require__(31);
  1698. var NATIVE_BIND = __webpack_require__(76);
  1699. var bind = uncurryThis(uncurryThis.bind);
  1700. // optional / simple context binding
  1701. module.exports = function (fn, that) {
  1702. aCallable(fn);
  1703. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
  1704. return fn.apply(that, arguments);
  1705. };
  1706. };
  1707. /***/ }),
  1708. /* 49 */
  1709. /***/ (function(module, exports, __webpack_require__) {
  1710. /* global ActiveXObject -- old IE, WSH */
  1711. var anObject = __webpack_require__(20);
  1712. var definePropertiesModule = __webpack_require__(128);
  1713. var enumBugKeys = __webpack_require__(127);
  1714. var hiddenKeys = __webpack_require__(80);
  1715. var html = __webpack_require__(165);
  1716. var documentCreateElement = __webpack_require__(124);
  1717. var sharedKey = __webpack_require__(101);
  1718. var GT = '>';
  1719. var LT = '<';
  1720. var PROTOTYPE = 'prototype';
  1721. var SCRIPT = 'script';
  1722. var IE_PROTO = sharedKey('IE_PROTO');
  1723. var EmptyConstructor = function () { /* empty */ };
  1724. var scriptTag = function (content) {
  1725. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  1726. };
  1727. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  1728. var NullProtoObjectViaActiveX = function (activeXDocument) {
  1729. activeXDocument.write(scriptTag(''));
  1730. activeXDocument.close();
  1731. var temp = activeXDocument.parentWindow.Object;
  1732. activeXDocument = null; // avoid memory leak
  1733. return temp;
  1734. };
  1735. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  1736. var NullProtoObjectViaIFrame = function () {
  1737. // Thrash, waste and sodomy: IE GC bug
  1738. var iframe = documentCreateElement('iframe');
  1739. var JS = 'java' + SCRIPT + ':';
  1740. var iframeDocument;
  1741. iframe.style.display = 'none';
  1742. html.appendChild(iframe);
  1743. // https://github.com/zloirock/core-js/issues/475
  1744. iframe.src = String(JS);
  1745. iframeDocument = iframe.contentWindow.document;
  1746. iframeDocument.open();
  1747. iframeDocument.write(scriptTag('document.F=Object'));
  1748. iframeDocument.close();
  1749. return iframeDocument.F;
  1750. };
  1751. // Check for document.domain and active x support
  1752. // No need to use active x approach when document.domain is not set
  1753. // see https://github.com/es-shims/es5-shim/issues/150
  1754. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  1755. // avoid IE GC bug
  1756. var activeXDocument;
  1757. var NullProtoObject = function () {
  1758. try {
  1759. activeXDocument = new ActiveXObject('htmlfile');
  1760. } catch (error) { /* ignore */ }
  1761. NullProtoObject = typeof document != 'undefined'
  1762. ? document.domain && activeXDocument
  1763. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  1764. : NullProtoObjectViaIFrame()
  1765. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  1766. var length = enumBugKeys.length;
  1767. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  1768. return NullProtoObject();
  1769. };
  1770. hiddenKeys[IE_PROTO] = true;
  1771. // `Object.create` method
  1772. // https://tc39.es/ecma262/#sec-object.create
  1773. // eslint-disable-next-line es-x/no-object-create -- safe
  1774. module.exports = Object.create || function create(O, Properties) {
  1775. var result;
  1776. if (O !== null) {
  1777. EmptyConstructor[PROTOTYPE] = anObject(O);
  1778. result = new EmptyConstructor();
  1779. EmptyConstructor[PROTOTYPE] = null;
  1780. // add "__proto__" for Object.getPrototypeOf polyfill
  1781. result[IE_PROTO] = O;
  1782. } else result = NullProtoObject();
  1783. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  1784. };
  1785. /***/ }),
  1786. /* 50 */
  1787. /***/ (function(module, exports) {
  1788. module.exports = {};
  1789. /***/ }),
  1790. /* 51 */
  1791. /***/ (function(module, exports, __webpack_require__) {
  1792. var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
  1793. var isCallable = __webpack_require__(8);
  1794. var classofRaw = __webpack_require__(63);
  1795. var wellKnownSymbol = __webpack_require__(9);
  1796. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1797. var $Object = Object;
  1798. // ES3 wrong here
  1799. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1800. // fallback for IE11 Script Access Denied error
  1801. var tryGet = function (it, key) {
  1802. try {
  1803. return it[key];
  1804. } catch (error) { /* empty */ }
  1805. };
  1806. // getting tag from ES6+ `Object.prototype.toString`
  1807. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  1808. var O, tag, result;
  1809. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1810. // @@toStringTag case
  1811. : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
  1812. // builtinTag case
  1813. : CORRECT_ARGUMENTS ? classofRaw(O)
  1814. // ES3 arguments fallback
  1815. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  1816. };
  1817. /***/ }),
  1818. /* 52 */
  1819. /***/ (function(module, exports, __webpack_require__) {
  1820. var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
  1821. var defineProperty = __webpack_require__(23).f;
  1822. var createNonEnumerableProperty = __webpack_require__(37);
  1823. var hasOwn = __webpack_require__(13);
  1824. var toString = __webpack_require__(298);
  1825. var wellKnownSymbol = __webpack_require__(9);
  1826. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1827. module.exports = function (it, TAG, STATIC, SET_METHOD) {
  1828. if (it) {
  1829. var target = STATIC ? it : it.prototype;
  1830. if (!hasOwn(target, TO_STRING_TAG)) {
  1831. defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
  1832. }
  1833. if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
  1834. createNonEnumerableProperty(target, 'toString', toString);
  1835. }
  1836. }
  1837. };
  1838. /***/ }),
  1839. /* 53 */
  1840. /***/ (function(module, exports) {
  1841. // empty
  1842. /***/ }),
  1843. /* 54 */
  1844. /***/ (function(module, exports, __webpack_require__) {
  1845. "use strict";
  1846. var aCallable = __webpack_require__(31);
  1847. var PromiseCapability = function (C) {
  1848. var resolve, reject;
  1849. this.promise = new C(function ($$resolve, $$reject) {
  1850. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  1851. resolve = $$resolve;
  1852. reject = $$reject;
  1853. });
  1854. this.resolve = aCallable(resolve);
  1855. this.reject = aCallable(reject);
  1856. };
  1857. // `NewPromiseCapability` abstract operation
  1858. // https://tc39.es/ecma262/#sec-newpromisecapability
  1859. module.exports.f = function (C) {
  1860. return new PromiseCapability(C);
  1861. };
  1862. /***/ }),
  1863. /* 55 */
  1864. /***/ (function(module, exports, __webpack_require__) {
  1865. "use strict";
  1866. var charAt = __webpack_require__(316).charAt;
  1867. var toString = __webpack_require__(81);
  1868. var InternalStateModule = __webpack_require__(43);
  1869. var defineIterator = __webpack_require__(131);
  1870. var STRING_ITERATOR = 'String Iterator';
  1871. var setInternalState = InternalStateModule.set;
  1872. var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
  1873. // `String.prototype[@@iterator]` method
  1874. // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
  1875. defineIterator(String, 'String', function (iterated) {
  1876. setInternalState(this, {
  1877. type: STRING_ITERATOR,
  1878. string: toString(iterated),
  1879. index: 0
  1880. });
  1881. // `%StringIteratorPrototype%.next` method
  1882. // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
  1883. }, function next() {
  1884. var state = getInternalState(this);
  1885. var string = state.string;
  1886. var index = state.index;
  1887. var point;
  1888. if (index >= string.length) return { value: undefined, done: true };
  1889. point = charAt(string, index);
  1890. state.index += point.length;
  1891. return { value: point, done: false };
  1892. });
  1893. /***/ }),
  1894. /* 56 */
  1895. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1896. "use strict";
  1897. /* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
  1898. // Is a given variable an object?
  1899. function isObject(obj) {
  1900. var type = typeof obj;
  1901. return type === 'function' || type === 'object' && !!obj;
  1902. }
  1903. /***/ }),
  1904. /* 57 */
  1905. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1906. "use strict";
  1907. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  1908. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(17);
  1909. // Is a given value an array?
  1910. // Delegates to ECMA5's native `Array.isArray`.
  1911. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
  1912. /***/ }),
  1913. /* 58 */
  1914. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1915. "use strict";
  1916. /* harmony export (immutable) */ __webpack_exports__["a"] = each;
  1917. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
  1918. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
  1919. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
  1920. // The cornerstone for collection functions, an `each`
  1921. // implementation, aka `forEach`.
  1922. // Handles raw objects in addition to array-likes. Treats all
  1923. // sparse array-likes as if they were dense.
  1924. function each(obj, iteratee, context) {
  1925. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
  1926. var i, length;
  1927. if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
  1928. for (i = 0, length = obj.length; i < length; i++) {
  1929. iteratee(obj[i], i, obj);
  1930. }
  1931. } else {
  1932. var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
  1933. for (i = 0, length = _keys.length; i < length; i++) {
  1934. iteratee(obj[_keys[i]], _keys[i], obj);
  1935. }
  1936. }
  1937. return obj;
  1938. }
  1939. /***/ }),
  1940. /* 59 */
  1941. /***/ (function(module, exports, __webpack_require__) {
  1942. module.exports = __webpack_require__(408);
  1943. /***/ }),
  1944. /* 60 */
  1945. /***/ (function(module, exports, __webpack_require__) {
  1946. "use strict";
  1947. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1948. /* eslint-env browser */
  1949. /**
  1950. * This is the web browser implementation of `debug()`.
  1951. */
  1952. exports.log = log;
  1953. exports.formatArgs = formatArgs;
  1954. exports.save = save;
  1955. exports.load = load;
  1956. exports.useColors = useColors;
  1957. exports.storage = localstorage();
  1958. /**
  1959. * Colors.
  1960. */
  1961. exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
  1962. /**
  1963. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  1964. * and the Firebug extension (any Firefox version) are known
  1965. * to support "%c" CSS customizations.
  1966. *
  1967. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  1968. */
  1969. // eslint-disable-next-line complexity
  1970. function useColors() {
  1971. // NB: In an Electron preload script, document will be defined but not fully
  1972. // initialized. Since we know we're in Chrome, we'll just detect this case
  1973. // explicitly
  1974. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  1975. return true;
  1976. } // Internet Explorer and Edge do not support colors.
  1977. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  1978. return false;
  1979. } // Is webkit? http://stackoverflow.com/a/16459606/376773
  1980. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  1981. return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
  1982. typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
  1983. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  1984. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
  1985. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
  1986. }
  1987. /**
  1988. * Colorize log arguments if enabled.
  1989. *
  1990. * @api public
  1991. */
  1992. function formatArgs(args) {
  1993. args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
  1994. if (!this.useColors) {
  1995. return;
  1996. }
  1997. var c = 'color: ' + this.color;
  1998. args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
  1999. // arguments passed either before or after the %c, so we need to
  2000. // figure out the correct index to insert the CSS into
  2001. var index = 0;
  2002. var lastC = 0;
  2003. args[0].replace(/%[a-zA-Z%]/g, function (match) {
  2004. if (match === '%%') {
  2005. return;
  2006. }
  2007. index++;
  2008. if (match === '%c') {
  2009. // We only are interested in the *last* %c
  2010. // (the user may have provided their own)
  2011. lastC = index;
  2012. }
  2013. });
  2014. args.splice(lastC, 0, c);
  2015. }
  2016. /**
  2017. * Invokes `console.log()` when available.
  2018. * No-op when `console.log` is not a "function".
  2019. *
  2020. * @api public
  2021. */
  2022. function log() {
  2023. var _console;
  2024. // This hackery is required for IE8/9, where
  2025. // the `console.log` function doesn't have 'apply'
  2026. return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
  2027. }
  2028. /**
  2029. * Save `namespaces`.
  2030. *
  2031. * @param {String} namespaces
  2032. * @api private
  2033. */
  2034. function save(namespaces) {
  2035. try {
  2036. if (namespaces) {
  2037. exports.storage.setItem('debug', namespaces);
  2038. } else {
  2039. exports.storage.removeItem('debug');
  2040. }
  2041. } catch (error) {// Swallow
  2042. // XXX (@Qix-) should we be logging these?
  2043. }
  2044. }
  2045. /**
  2046. * Load `namespaces`.
  2047. *
  2048. * @return {String} returns the previously persisted debug modes
  2049. * @api private
  2050. */
  2051. function load() {
  2052. var r;
  2053. try {
  2054. r = exports.storage.getItem('debug');
  2055. } catch (error) {} // Swallow
  2056. // XXX (@Qix-) should we be logging these?
  2057. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  2058. if (!r && typeof process !== 'undefined' && 'env' in process) {
  2059. r = process.env.DEBUG;
  2060. }
  2061. return r;
  2062. }
  2063. /**
  2064. * Localstorage attempts to return the localstorage.
  2065. *
  2066. * This is necessary because safari throws
  2067. * when a user disables cookies/localstorage
  2068. * and you attempt to access it.
  2069. *
  2070. * @return {LocalStorage}
  2071. * @api private
  2072. */
  2073. function localstorage() {
  2074. try {
  2075. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  2076. // The Browser also has localStorage in the global context.
  2077. return localStorage;
  2078. } catch (error) {// Swallow
  2079. // XXX (@Qix-) should we be logging these?
  2080. }
  2081. }
  2082. module.exports = __webpack_require__(413)(exports);
  2083. var formatters = module.exports.formatters;
  2084. /**
  2085. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  2086. */
  2087. formatters.j = function (v) {
  2088. try {
  2089. return JSON.stringify(v);
  2090. } catch (error) {
  2091. return '[UnexpectedJSONParseError]: ' + error.message;
  2092. }
  2093. };
  2094. /***/ }),
  2095. /* 61 */
  2096. /***/ (function(module, exports, __webpack_require__) {
  2097. module.exports = __webpack_require__(240);
  2098. /***/ }),
  2099. /* 62 */
  2100. /***/ (function(module, exports, __webpack_require__) {
  2101. var DESCRIPTORS = __webpack_require__(14);
  2102. var call = __webpack_require__(15);
  2103. var propertyIsEnumerableModule = __webpack_require__(120);
  2104. var createPropertyDescriptor = __webpack_require__(47);
  2105. var toIndexedObject = __webpack_require__(32);
  2106. var toPropertyKey = __webpack_require__(96);
  2107. var hasOwn = __webpack_require__(13);
  2108. var IE8_DOM_DEFINE = __webpack_require__(158);
  2109. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  2110. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2111. // `Object.getOwnPropertyDescriptor` method
  2112. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  2113. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  2114. O = toIndexedObject(O);
  2115. P = toPropertyKey(P);
  2116. if (IE8_DOM_DEFINE) try {
  2117. return $getOwnPropertyDescriptor(O, P);
  2118. } catch (error) { /* empty */ }
  2119. if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  2120. };
  2121. /***/ }),
  2122. /* 63 */
  2123. /***/ (function(module, exports, __webpack_require__) {
  2124. var uncurryThis = __webpack_require__(4);
  2125. var toString = uncurryThis({}.toString);
  2126. var stringSlice = uncurryThis(''.slice);
  2127. module.exports = function (it) {
  2128. return stringSlice(toString(it), 8, -1);
  2129. };
  2130. /***/ }),
  2131. /* 64 */
  2132. /***/ (function(module, exports, __webpack_require__) {
  2133. /* eslint-disable es-x/no-symbol -- required for testing */
  2134. var V8_VERSION = __webpack_require__(77);
  2135. var fails = __webpack_require__(2);
  2136. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
  2137. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  2138. var symbol = Symbol();
  2139. // Chrome 38 Symbol has incorrect toString conversion
  2140. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  2141. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  2142. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  2143. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  2144. });
  2145. /***/ }),
  2146. /* 65 */
  2147. /***/ (function(module, exports, __webpack_require__) {
  2148. var global = __webpack_require__(7);
  2149. module.exports = global.Promise;
  2150. /***/ }),
  2151. /* 66 */
  2152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2153. "use strict";
  2154. /* harmony export (immutable) */ __webpack_exports__["a"] = values;
  2155. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
  2156. // Retrieve the values of an object's properties.
  2157. function values(obj) {
  2158. var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
  2159. var length = _keys.length;
  2160. var values = Array(length);
  2161. for (var i = 0; i < length; i++) {
  2162. values[i] = obj[_keys[i]];
  2163. }
  2164. return values;
  2165. }
  2166. /***/ }),
  2167. /* 67 */
  2168. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2169. "use strict";
  2170. /* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
  2171. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
  2172. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
  2173. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(57);
  2174. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135);
  2175. // Internal implementation of a recursive `flatten` function.
  2176. function flatten(input, depth, strict, output) {
  2177. output = output || [];
  2178. if (!depth && depth !== 0) {
  2179. depth = Infinity;
  2180. } else if (depth <= 0) {
  2181. return output.concat(input);
  2182. }
  2183. var idx = output.length;
  2184. for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
  2185. var value = input[i];
  2186. if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(value) && (Object(__WEBPACK_IMPORTED_MODULE_2__isArray_js__["a" /* default */])(value) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(value))) {
  2187. // Flatten current level of array or arguments object.
  2188. if (depth > 1) {
  2189. flatten(value, depth - 1, strict, output);
  2190. idx = output.length;
  2191. } else {
  2192. var j = 0, len = value.length;
  2193. while (j < len) output[idx++] = value[j++];
  2194. }
  2195. } else if (!strict) {
  2196. output[idx++] = value;
  2197. }
  2198. }
  2199. return output;
  2200. }
  2201. /***/ }),
  2202. /* 68 */
  2203. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2204. "use strict";
  2205. /* harmony export (immutable) */ __webpack_exports__["a"] = map;
  2206. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  2207. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
  2208. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
  2209. // Return the results of applying the iteratee to each element.
  2210. function map(obj, iteratee, context) {
  2211. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
  2212. var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
  2213. length = (_keys || obj).length,
  2214. results = Array(length);
  2215. for (var index = 0; index < length; index++) {
  2216. var currentKey = _keys ? _keys[index] : index;
  2217. results[index] = iteratee(obj[currentKey], currentKey, obj);
  2218. }
  2219. return results;
  2220. }
  2221. /***/ }),
  2222. /* 69 */
  2223. /***/ (function(module, exports, __webpack_require__) {
  2224. "use strict";
  2225. /* WEBPACK VAR INJECTION */(function(global) {
  2226. var _interopRequireDefault = __webpack_require__(1);
  2227. var _promise = _interopRequireDefault(__webpack_require__(12));
  2228. var _concat = _interopRequireDefault(__webpack_require__(22));
  2229. var _map = _interopRequireDefault(__webpack_require__(35));
  2230. var _keys = _interopRequireDefault(__webpack_require__(115));
  2231. var _stringify = _interopRequireDefault(__webpack_require__(36));
  2232. var _indexOf = _interopRequireDefault(__webpack_require__(71));
  2233. var _keys2 = _interopRequireDefault(__webpack_require__(59));
  2234. var _ = __webpack_require__(3);
  2235. var uuid = __webpack_require__(232);
  2236. var debug = __webpack_require__(60);
  2237. var _require = __webpack_require__(30),
  2238. inherits = _require.inherits,
  2239. parseDate = _require.parseDate;
  2240. var version = __webpack_require__(234);
  2241. var _require2 = __webpack_require__(72),
  2242. setAdapters = _require2.setAdapters,
  2243. adapterManager = _require2.adapterManager;
  2244. var AV = global.AV || {}; // All internal configuration items
  2245. AV._config = {
  2246. serverURLs: {},
  2247. useMasterKey: false,
  2248. production: null,
  2249. realtime: null,
  2250. requestTimeout: null
  2251. };
  2252. var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
  2253. AV._sharedConfig = {
  2254. userAgent: initialUserAgent,
  2255. liveQueryRealtime: null
  2256. };
  2257. adapterManager.on('platformInfo', function (platformInfo) {
  2258. var ua = initialUserAgent;
  2259. if (platformInfo) {
  2260. if (platformInfo.userAgent) {
  2261. ua = platformInfo.userAgent;
  2262. } else {
  2263. var comments = platformInfo.name;
  2264. if (platformInfo.version) {
  2265. comments += "/".concat(platformInfo.version);
  2266. }
  2267. if (platformInfo.extra) {
  2268. comments += "; ".concat(platformInfo.extra);
  2269. }
  2270. ua += " (".concat(comments, ")");
  2271. }
  2272. }
  2273. AV._sharedConfig.userAgent = ua;
  2274. });
  2275. /**
  2276. * Contains all AV API classes and functions.
  2277. * @namespace AV
  2278. */
  2279. /**
  2280. * Returns prefix for localStorage keys used by this instance of AV.
  2281. * @param {String} path The relative suffix to append to it.
  2282. * null or undefined is treated as the empty string.
  2283. * @return {String} The full key name.
  2284. * @private
  2285. */
  2286. AV._getAVPath = function (path) {
  2287. if (!AV.applicationId) {
  2288. throw new Error('You need to call AV.initialize before using AV.');
  2289. }
  2290. if (!path) {
  2291. path = '';
  2292. }
  2293. if (!_.isString(path)) {
  2294. throw new Error("Tried to get a localStorage path that wasn't a String.");
  2295. }
  2296. if (path[0] === '/') {
  2297. path = path.substring(1);
  2298. }
  2299. return 'AV/' + AV.applicationId + '/' + path;
  2300. };
  2301. /**
  2302. * Returns the unique string for this app on this machine.
  2303. * Gets reset when localStorage is cleared.
  2304. * @private
  2305. */
  2306. AV._installationId = null;
  2307. AV._getInstallationId = function () {
  2308. // See if it's cached in RAM.
  2309. if (AV._installationId) {
  2310. return _promise.default.resolve(AV._installationId);
  2311. } // Try to get it from localStorage.
  2312. var path = AV._getAVPath('installationId');
  2313. return AV.localStorage.getItemAsync(path).then(function (_installationId) {
  2314. AV._installationId = _installationId;
  2315. if (!AV._installationId) {
  2316. // It wasn't in localStorage, so create a new one.
  2317. AV._installationId = _installationId = uuid();
  2318. return AV.localStorage.setItemAsync(path, _installationId).then(function () {
  2319. return _installationId;
  2320. });
  2321. }
  2322. return _installationId;
  2323. });
  2324. };
  2325. AV._subscriptionId = null;
  2326. AV._refreshSubscriptionId = function () {
  2327. var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
  2328. var subscriptionId = AV._subscriptionId = uuid();
  2329. return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
  2330. return subscriptionId;
  2331. });
  2332. };
  2333. AV._getSubscriptionId = function () {
  2334. // See if it's cached in RAM.
  2335. if (AV._subscriptionId) {
  2336. return _promise.default.resolve(AV._subscriptionId);
  2337. } // Try to get it from localStorage.
  2338. var path = AV._getAVPath('subscriptionId');
  2339. return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
  2340. AV._subscriptionId = _subscriptionId;
  2341. if (!AV._subscriptionId) {
  2342. // It wasn't in localStorage, so create a new one.
  2343. _subscriptionId = AV._refreshSubscriptionId(path);
  2344. }
  2345. return _subscriptionId;
  2346. });
  2347. };
  2348. AV._parseDate = parseDate; // A self-propagating extend function.
  2349. AV._extend = function (protoProps, classProps) {
  2350. var child = inherits(this, protoProps, classProps);
  2351. child.extend = this.extend;
  2352. return child;
  2353. };
  2354. /**
  2355. * Converts a value in a AV Object into the appropriate representation.
  2356. * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
  2357. * if seenObjects is falsey. Otherwise any AV.Objects not in
  2358. * seenObjects will be fully embedded rather than encoded
  2359. * as a pointer. This array will be used to prevent going into an infinite
  2360. * loop because we have circular references. If <seenObjects>
  2361. * is set, then none of the AV Objects that are serialized can be dirty.
  2362. * @private
  2363. */
  2364. AV._encode = function (value, seenObjects, disallowObjects) {
  2365. var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  2366. if (value instanceof AV.Object) {
  2367. if (disallowObjects) {
  2368. throw new Error('AV.Objects not allowed here');
  2369. }
  2370. if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
  2371. return value._toPointer();
  2372. }
  2373. return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
  2374. }
  2375. if (value instanceof AV.ACL) {
  2376. return value.toJSON();
  2377. }
  2378. if (_.isDate(value)) {
  2379. return full ? {
  2380. __type: 'Date',
  2381. iso: value.toJSON()
  2382. } : value.toJSON();
  2383. }
  2384. if (value instanceof AV.GeoPoint) {
  2385. return value.toJSON();
  2386. }
  2387. if (_.isArray(value)) {
  2388. return (0, _map.default)(_).call(_, value, function (x) {
  2389. return AV._encode(x, seenObjects, disallowObjects, full);
  2390. });
  2391. }
  2392. if (_.isRegExp(value)) {
  2393. return value.source;
  2394. }
  2395. if (value instanceof AV.Relation) {
  2396. return value.toJSON();
  2397. }
  2398. if (value instanceof AV.Op) {
  2399. return value.toJSON();
  2400. }
  2401. if (value instanceof AV.File) {
  2402. if (!value.url() && !value.id) {
  2403. throw new Error('Tried to save an object containing an unsaved file.');
  2404. }
  2405. return value._toFullJSON(seenObjects, full);
  2406. }
  2407. if (_.isObject(value)) {
  2408. return _.mapObject(value, function (v, k) {
  2409. return AV._encode(v, seenObjects, disallowObjects, full);
  2410. });
  2411. }
  2412. return value;
  2413. };
  2414. /**
  2415. * The inverse function of AV._encode.
  2416. * @private
  2417. */
  2418. AV._decode = function (value, key) {
  2419. if (!_.isObject(value) || _.isDate(value)) {
  2420. return value;
  2421. }
  2422. if (_.isArray(value)) {
  2423. return (0, _map.default)(_).call(_, value, function (v) {
  2424. return AV._decode(v);
  2425. });
  2426. }
  2427. if (value instanceof AV.Object) {
  2428. return value;
  2429. }
  2430. if (value instanceof AV.File) {
  2431. return value;
  2432. }
  2433. if (value instanceof AV.Op) {
  2434. return value;
  2435. }
  2436. if (value instanceof AV.GeoPoint) {
  2437. return value;
  2438. }
  2439. if (value instanceof AV.ACL) {
  2440. return value;
  2441. }
  2442. if (key === 'ACL') {
  2443. return new AV.ACL(value);
  2444. }
  2445. if (value.__op) {
  2446. return AV.Op._decode(value);
  2447. }
  2448. var className;
  2449. if (value.__type === 'Pointer') {
  2450. className = value.className;
  2451. var pointer = AV.Object._create(className);
  2452. if ((0, _keys.default)(value).length > 3) {
  2453. var v = _.clone(value);
  2454. delete v.__type;
  2455. delete v.className;
  2456. pointer._finishFetch(v, true);
  2457. } else {
  2458. pointer._finishFetch({
  2459. objectId: value.objectId
  2460. }, false);
  2461. }
  2462. return pointer;
  2463. }
  2464. if (value.__type === 'Object') {
  2465. // It's an Object included in a query result.
  2466. className = value.className;
  2467. var _v = _.clone(value);
  2468. delete _v.__type;
  2469. delete _v.className;
  2470. var object = AV.Object._create(className);
  2471. object._finishFetch(_v, true);
  2472. return object;
  2473. }
  2474. if (value.__type === 'Date') {
  2475. return AV._parseDate(value.iso);
  2476. }
  2477. if (value.__type === 'GeoPoint') {
  2478. return new AV.GeoPoint({
  2479. latitude: value.latitude,
  2480. longitude: value.longitude
  2481. });
  2482. }
  2483. if (value.__type === 'Relation') {
  2484. if (!key) throw new Error('key missing decoding a Relation');
  2485. var relation = new AV.Relation(null, key);
  2486. relation.targetClassName = value.className;
  2487. return relation;
  2488. }
  2489. if (value.__type === 'File') {
  2490. var file = new AV.File(value.name);
  2491. var _v2 = _.clone(value);
  2492. delete _v2.__type;
  2493. file._finishFetch(_v2);
  2494. return file;
  2495. }
  2496. return _.mapObject(value, AV._decode);
  2497. };
  2498. /**
  2499. * The inverse function of {@link AV.Object#toFullJSON}.
  2500. * @since 3.0.0
  2501. * @method
  2502. * @param {Object}
  2503. * return {AV.Object|AV.File|any}
  2504. */
  2505. AV.parseJSON = AV._decode;
  2506. /**
  2507. * Similar to JSON.parse, except that AV internal types will be used if possible.
  2508. * Inverse to {@link AV.stringify}
  2509. * @since 3.14.0
  2510. * @param {string} text the string to parse.
  2511. * @return {AV.Object|AV.File|any}
  2512. */
  2513. AV.parse = function (text) {
  2514. return AV.parseJSON(JSON.parse(text));
  2515. };
  2516. /**
  2517. * Serialize a target containing AV.Object, similar to JSON.stringify.
  2518. * Inverse to {@link AV.parse}
  2519. * @since 3.14.0
  2520. * @return {string}
  2521. */
  2522. AV.stringify = function (target) {
  2523. return (0, _stringify.default)(AV._encode(target, [], false, true));
  2524. };
  2525. AV._encodeObjectOrArray = function (value) {
  2526. var encodeAVObject = function encodeAVObject(object) {
  2527. if (object && object._toFullJSON) {
  2528. object = object._toFullJSON([]);
  2529. }
  2530. return _.mapObject(object, function (value) {
  2531. return AV._encode(value, []);
  2532. });
  2533. };
  2534. if (_.isArray(value)) {
  2535. return (0, _map.default)(value).call(value, function (object) {
  2536. return encodeAVObject(object);
  2537. });
  2538. } else {
  2539. return encodeAVObject(value);
  2540. }
  2541. };
  2542. AV._arrayEach = _.each;
  2543. /**
  2544. * Does a deep traversal of every item in object, calling func on every one.
  2545. * @param {Object} object The object or array to traverse deeply.
  2546. * @param {Function} func The function to call for every item. It will
  2547. * be passed the item as an argument. If it returns a truthy value, that
  2548. * value will replace the item in its parent container.
  2549. * @returns {} the result of calling func on the top-level object itself.
  2550. * @private
  2551. */
  2552. AV._traverse = function (object, func, seen) {
  2553. if (object instanceof AV.Object) {
  2554. seen = seen || [];
  2555. if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
  2556. // We've already visited this object in this call.
  2557. return;
  2558. }
  2559. seen.push(object);
  2560. AV._traverse(object.attributes, func, seen);
  2561. return func(object);
  2562. }
  2563. if (object instanceof AV.Relation || object instanceof AV.File) {
  2564. // Nothing needs to be done, but we don't want to recurse into the
  2565. // object's parent infinitely, so we catch this case.
  2566. return func(object);
  2567. }
  2568. if (_.isArray(object)) {
  2569. _.each(object, function (child, index) {
  2570. var newChild = AV._traverse(child, func, seen);
  2571. if (newChild) {
  2572. object[index] = newChild;
  2573. }
  2574. });
  2575. return func(object);
  2576. }
  2577. if (_.isObject(object)) {
  2578. AV._each(object, function (child, key) {
  2579. var newChild = AV._traverse(child, func, seen);
  2580. if (newChild) {
  2581. object[key] = newChild;
  2582. }
  2583. });
  2584. return func(object);
  2585. }
  2586. return func(object);
  2587. };
  2588. /**
  2589. * This is like _.each, except:
  2590. * * it doesn't work for so-called array-like objects,
  2591. * * it does work for dictionaries with a "length" attribute.
  2592. * @private
  2593. */
  2594. AV._objectEach = AV._each = function (obj, callback) {
  2595. if (_.isObject(obj)) {
  2596. _.each((0, _keys2.default)(_).call(_, obj), function (key) {
  2597. callback(obj[key], key);
  2598. });
  2599. } else {
  2600. _.each(obj, callback);
  2601. }
  2602. };
  2603. /**
  2604. * @namespace
  2605. * @since 3.14.0
  2606. */
  2607. AV.debug = {
  2608. /**
  2609. * Enable debug
  2610. */
  2611. enable: function enable() {
  2612. var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
  2613. return debug.enable(namespaces);
  2614. },
  2615. /**
  2616. * Disable debug
  2617. */
  2618. disable: debug.disable
  2619. };
  2620. /**
  2621. * Specify Adapters
  2622. * @since 4.4.0
  2623. * @function
  2624. * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
  2625. */
  2626. AV.setAdapters = setAdapters;
  2627. module.exports = AV;
  2628. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  2629. /***/ }),
  2630. /* 70 */
  2631. /***/ (function(module, exports, __webpack_require__) {
  2632. var bind = __webpack_require__(48);
  2633. var uncurryThis = __webpack_require__(4);
  2634. var IndexedObject = __webpack_require__(95);
  2635. var toObject = __webpack_require__(34);
  2636. var lengthOfArrayLike = __webpack_require__(41);
  2637. var arraySpeciesCreate = __webpack_require__(229);
  2638. var push = uncurryThis([].push);
  2639. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
  2640. var createMethod = function (TYPE) {
  2641. var IS_MAP = TYPE == 1;
  2642. var IS_FILTER = TYPE == 2;
  2643. var IS_SOME = TYPE == 3;
  2644. var IS_EVERY = TYPE == 4;
  2645. var IS_FIND_INDEX = TYPE == 6;
  2646. var IS_FILTER_REJECT = TYPE == 7;
  2647. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  2648. return function ($this, callbackfn, that, specificCreate) {
  2649. var O = toObject($this);
  2650. var self = IndexedObject(O);
  2651. var boundFunction = bind(callbackfn, that);
  2652. var length = lengthOfArrayLike(self);
  2653. var index = 0;
  2654. var create = specificCreate || arraySpeciesCreate;
  2655. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
  2656. var value, result;
  2657. for (;length > index; index++) if (NO_HOLES || index in self) {
  2658. value = self[index];
  2659. result = boundFunction(value, index, O);
  2660. if (TYPE) {
  2661. if (IS_MAP) target[index] = result; // map
  2662. else if (result) switch (TYPE) {
  2663. case 3: return true; // some
  2664. case 5: return value; // find
  2665. case 6: return index; // findIndex
  2666. case 2: push(target, value); // filter
  2667. } else switch (TYPE) {
  2668. case 4: return false; // every
  2669. case 7: push(target, value); // filterReject
  2670. }
  2671. }
  2672. }
  2673. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  2674. };
  2675. };
  2676. module.exports = {
  2677. // `Array.prototype.forEach` method
  2678. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  2679. forEach: createMethod(0),
  2680. // `Array.prototype.map` method
  2681. // https://tc39.es/ecma262/#sec-array.prototype.map
  2682. map: createMethod(1),
  2683. // `Array.prototype.filter` method
  2684. // https://tc39.es/ecma262/#sec-array.prototype.filter
  2685. filter: createMethod(2),
  2686. // `Array.prototype.some` method
  2687. // https://tc39.es/ecma262/#sec-array.prototype.some
  2688. some: createMethod(3),
  2689. // `Array.prototype.every` method
  2690. // https://tc39.es/ecma262/#sec-array.prototype.every
  2691. every: createMethod(4),
  2692. // `Array.prototype.find` method
  2693. // https://tc39.es/ecma262/#sec-array.prototype.find
  2694. find: createMethod(5),
  2695. // `Array.prototype.findIndex` method
  2696. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  2697. findIndex: createMethod(6),
  2698. // `Array.prototype.filterReject` method
  2699. // https://github.com/tc39/proposal-array-filtering
  2700. filterReject: createMethod(7)
  2701. };
  2702. /***/ }),
  2703. /* 71 */
  2704. /***/ (function(module, exports, __webpack_require__) {
  2705. module.exports = __webpack_require__(404);
  2706. /***/ }),
  2707. /* 72 */
  2708. /***/ (function(module, exports, __webpack_require__) {
  2709. "use strict";
  2710. var _interopRequireDefault = __webpack_require__(1);
  2711. var _keys = _interopRequireDefault(__webpack_require__(59));
  2712. var _ = __webpack_require__(3);
  2713. var EventEmitter = __webpack_require__(235);
  2714. var _require = __webpack_require__(30),
  2715. inherits = _require.inherits;
  2716. var AdapterManager = inherits(EventEmitter, {
  2717. constructor: function constructor() {
  2718. EventEmitter.apply(this);
  2719. this._adapters = {};
  2720. },
  2721. getAdapter: function getAdapter(name) {
  2722. var adapter = this._adapters[name];
  2723. if (adapter === undefined) {
  2724. throw new Error("".concat(name, " adapter is not configured"));
  2725. }
  2726. return adapter;
  2727. },
  2728. setAdapters: function setAdapters(newAdapters) {
  2729. var _this = this;
  2730. _.extend(this._adapters, newAdapters);
  2731. (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
  2732. return _this.emit(name, newAdapters[name]);
  2733. });
  2734. }
  2735. });
  2736. var adapterManager = new AdapterManager();
  2737. module.exports = {
  2738. getAdapter: adapterManager.getAdapter.bind(adapterManager),
  2739. setAdapters: adapterManager.setAdapters.bind(adapterManager),
  2740. adapterManager: adapterManager
  2741. };
  2742. /***/ }),
  2743. /* 73 */
  2744. /***/ (function(module, exports, __webpack_require__) {
  2745. var _Symbol = __webpack_require__(242);
  2746. var _Symbol$iterator = __webpack_require__(459);
  2747. function _typeof(obj) {
  2748. "@babel/helpers - typeof";
  2749. return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
  2750. return typeof obj;
  2751. } : function (obj) {
  2752. return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
  2753. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  2754. }
  2755. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2756. /***/ }),
  2757. /* 74 */
  2758. /***/ (function(module, exports) {
  2759. var g;
  2760. // This works in non-strict mode
  2761. g = (function() {
  2762. return this;
  2763. })();
  2764. try {
  2765. // This works if eval is allowed (see CSP)
  2766. g = g || Function("return this")() || (1,eval)("this");
  2767. } catch(e) {
  2768. // This works if the window reference is available
  2769. if(typeof window === "object")
  2770. g = window;
  2771. }
  2772. // g can still be undefined, but nothing to do about it...
  2773. // We return undefined, instead of nothing here, so it's
  2774. // easier to handle this case. if(!global) { ...}
  2775. module.exports = g;
  2776. /***/ }),
  2777. /* 75 */
  2778. /***/ (function(module, exports, __webpack_require__) {
  2779. var NATIVE_BIND = __webpack_require__(76);
  2780. var FunctionPrototype = Function.prototype;
  2781. var apply = FunctionPrototype.apply;
  2782. var call = FunctionPrototype.call;
  2783. // eslint-disable-next-line es-x/no-reflect -- safe
  2784. module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
  2785. return call.apply(apply, arguments);
  2786. });
  2787. /***/ }),
  2788. /* 76 */
  2789. /***/ (function(module, exports, __webpack_require__) {
  2790. var fails = __webpack_require__(2);
  2791. module.exports = !fails(function () {
  2792. // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
  2793. var test = (function () { /* empty */ }).bind();
  2794. // eslint-disable-next-line no-prototype-builtins -- safe
  2795. return typeof test != 'function' || test.hasOwnProperty('prototype');
  2796. });
  2797. /***/ }),
  2798. /* 77 */
  2799. /***/ (function(module, exports, __webpack_require__) {
  2800. var global = __webpack_require__(7);
  2801. var userAgent = __webpack_require__(98);
  2802. var process = global.process;
  2803. var Deno = global.Deno;
  2804. var versions = process && process.versions || Deno && Deno.version;
  2805. var v8 = versions && versions.v8;
  2806. var match, version;
  2807. if (v8) {
  2808. match = v8.split('.');
  2809. // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  2810. // but their correct versions are not interesting for us
  2811. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  2812. }
  2813. // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
  2814. // so check `userAgent` even if `.v8` exists, but 0
  2815. if (!version && userAgent) {
  2816. match = userAgent.match(/Edge\/(\d+)/);
  2817. if (!match || match[1] >= 74) {
  2818. match = userAgent.match(/Chrome\/(\d+)/);
  2819. if (match) version = +match[1];
  2820. }
  2821. }
  2822. module.exports = version;
  2823. /***/ }),
  2824. /* 78 */
  2825. /***/ (function(module, exports) {
  2826. var $String = String;
  2827. module.exports = function (argument) {
  2828. try {
  2829. return $String(argument);
  2830. } catch (error) {
  2831. return 'Object';
  2832. }
  2833. };
  2834. /***/ }),
  2835. /* 79 */
  2836. /***/ (function(module, exports, __webpack_require__) {
  2837. var IS_PURE = __webpack_require__(33);
  2838. var store = __webpack_require__(123);
  2839. (module.exports = function (key, value) {
  2840. return store[key] || (store[key] = value !== undefined ? value : {});
  2841. })('versions', []).push({
  2842. version: '3.23.3',
  2843. mode: IS_PURE ? 'pure' : 'global',
  2844. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  2845. license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
  2846. source: 'https://github.com/zloirock/core-js'
  2847. });
  2848. /***/ }),
  2849. /* 80 */
  2850. /***/ (function(module, exports) {
  2851. module.exports = {};
  2852. /***/ }),
  2853. /* 81 */
  2854. /***/ (function(module, exports, __webpack_require__) {
  2855. var classof = __webpack_require__(51);
  2856. var $String = String;
  2857. module.exports = function (argument) {
  2858. if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  2859. return $String(argument);
  2860. };
  2861. /***/ }),
  2862. /* 82 */
  2863. /***/ (function(module, exports) {
  2864. module.exports = function (exec) {
  2865. try {
  2866. return { error: false, value: exec() };
  2867. } catch (error) {
  2868. return { error: true, value: error };
  2869. }
  2870. };
  2871. /***/ }),
  2872. /* 83 */
  2873. /***/ (function(module, exports, __webpack_require__) {
  2874. var global = __webpack_require__(7);
  2875. var NativePromiseConstructor = __webpack_require__(65);
  2876. var isCallable = __webpack_require__(8);
  2877. var isForced = __webpack_require__(159);
  2878. var inspectSource = __webpack_require__(130);
  2879. var wellKnownSymbol = __webpack_require__(9);
  2880. var IS_BROWSER = __webpack_require__(307);
  2881. var IS_PURE = __webpack_require__(33);
  2882. var V8_VERSION = __webpack_require__(77);
  2883. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  2884. var SPECIES = wellKnownSymbol('species');
  2885. var SUBCLASSING = false;
  2886. var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
  2887. var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
  2888. var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
  2889. var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
  2890. // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  2891. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  2892. // We can't detect it synchronously, so just check versions
  2893. if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
  2894. // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
  2895. if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
  2896. // We can't use @@species feature detection in V8 since it causes
  2897. // deoptimization and performance degradation
  2898. // https://github.com/zloirock/core-js/issues/679
  2899. if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
  2900. // Detect correctness of subclassing with @@species support
  2901. var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
  2902. var FakePromise = function (exec) {
  2903. exec(function () { /* empty */ }, function () { /* empty */ });
  2904. };
  2905. var constructor = promise.constructor = {};
  2906. constructor[SPECIES] = FakePromise;
  2907. SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
  2908. if (!SUBCLASSING) return true;
  2909. // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  2910. return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
  2911. });
  2912. module.exports = {
  2913. CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
  2914. REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
  2915. SUBCLASSING: SUBCLASSING
  2916. };
  2917. /***/ }),
  2918. /* 84 */
  2919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2920. "use strict";
  2921. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
  2922. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
  2923. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  2924. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(324);
  2925. // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
  2926. // In IE 11, the most common among them, this problem also applies to
  2927. // `Map`, `WeakMap` and `Set`.
  2928. var hasStringTagBug = (
  2929. __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
  2930. ),
  2931. isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
  2932. /***/ }),
  2933. /* 85 */
  2934. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2935. "use strict";
  2936. /* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
  2937. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
  2938. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  2939. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(190);
  2940. // Retrieve all the enumerable property names of an object.
  2941. function allKeys(obj) {
  2942. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
  2943. var keys = [];
  2944. for (var key in obj) keys.push(key);
  2945. // Ahem, IE < 9.
  2946. if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
  2947. return keys;
  2948. }
  2949. /***/ }),
  2950. /* 86 */
  2951. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2952. "use strict";
  2953. /* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
  2954. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  2955. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(199);
  2956. // Internal wrapper for `_.toPath` to enable minification.
  2957. // Similar to `cb` for `_.iteratee`.
  2958. function toPath(path) {
  2959. return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
  2960. }
  2961. /***/ }),
  2962. /* 87 */
  2963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2964. "use strict";
  2965. /* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
  2966. // Internal function that returns an efficient (for current engines) version
  2967. // of the passed-in callback, to be repeatedly applied in other Underscore
  2968. // functions.
  2969. function optimizeCb(func, context, argCount) {
  2970. if (context === void 0) return func;
  2971. switch (argCount == null ? 3 : argCount) {
  2972. case 1: return function(value) {
  2973. return func.call(context, value);
  2974. };
  2975. // The 2-argument case is omitted because we’re not using it.
  2976. case 3: return function(value, index, collection) {
  2977. return func.call(context, value, index, collection);
  2978. };
  2979. case 4: return function(accumulator, value, index, collection) {
  2980. return func.call(context, accumulator, value, index, collection);
  2981. };
  2982. }
  2983. return function() {
  2984. return func.apply(context, arguments);
  2985. };
  2986. }
  2987. /***/ }),
  2988. /* 88 */
  2989. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2990. "use strict";
  2991. /* harmony export (immutable) */ __webpack_exports__["a"] = filter;
  2992. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  2993. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
  2994. // Return all the elements that pass a truth test.
  2995. function filter(obj, predicate, context) {
  2996. var results = [];
  2997. predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
  2998. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
  2999. if (predicate(value, index, list)) results.push(value);
  3000. });
  3001. return results;
  3002. }
  3003. /***/ }),
  3004. /* 89 */
  3005. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3006. "use strict";
  3007. /* harmony export (immutable) */ __webpack_exports__["a"] = contains;
  3008. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  3009. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
  3010. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(215);
  3011. // Determine if the array or object contains a given item (using `===`).
  3012. function contains(obj, item, fromIndex, guard) {
  3013. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
  3014. if (typeof fromIndex != 'number' || guard) fromIndex = 0;
  3015. return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
  3016. }
  3017. /***/ }),
  3018. /* 90 */
  3019. /***/ (function(module, exports, __webpack_require__) {
  3020. var classof = __webpack_require__(63);
  3021. // `IsArray` abstract operation
  3022. // https://tc39.es/ecma262/#sec-isarray
  3023. // eslint-disable-next-line es-x/no-array-isarray -- safe
  3024. module.exports = Array.isArray || function isArray(argument) {
  3025. return classof(argument) == 'Array';
  3026. };
  3027. /***/ }),
  3028. /* 91 */
  3029. /***/ (function(module, exports, __webpack_require__) {
  3030. "use strict";
  3031. var toPropertyKey = __webpack_require__(96);
  3032. var definePropertyModule = __webpack_require__(23);
  3033. var createPropertyDescriptor = __webpack_require__(47);
  3034. module.exports = function (object, key, value) {
  3035. var propertyKey = toPropertyKey(key);
  3036. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3037. else object[propertyKey] = value;
  3038. };
  3039. /***/ }),
  3040. /* 92 */
  3041. /***/ (function(module, exports, __webpack_require__) {
  3042. module.exports = __webpack_require__(241);
  3043. /***/ }),
  3044. /* 93 */
  3045. /***/ (function(module, exports, __webpack_require__) {
  3046. module.exports = __webpack_require__(472);
  3047. /***/ }),
  3048. /* 94 */
  3049. /***/ (function(module, exports, __webpack_require__) {
  3050. var $ = __webpack_require__(0);
  3051. var uncurryThis = __webpack_require__(4);
  3052. var hiddenKeys = __webpack_require__(80);
  3053. var isObject = __webpack_require__(11);
  3054. var hasOwn = __webpack_require__(13);
  3055. var defineProperty = __webpack_require__(23).f;
  3056. var getOwnPropertyNamesModule = __webpack_require__(103);
  3057. var getOwnPropertyNamesExternalModule = __webpack_require__(245);
  3058. var isExtensible = __webpack_require__(261);
  3059. var uid = __webpack_require__(99);
  3060. var FREEZING = __webpack_require__(262);
  3061. var REQUIRED = false;
  3062. var METADATA = uid('meta');
  3063. var id = 0;
  3064. var setMetadata = function (it) {
  3065. defineProperty(it, METADATA, { value: {
  3066. objectID: 'O' + id++, // object ID
  3067. weakData: {} // weak collections IDs
  3068. } });
  3069. };
  3070. var fastKey = function (it, create) {
  3071. // return a primitive with prefix
  3072. if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  3073. if (!hasOwn(it, METADATA)) {
  3074. // can't set metadata to uncaught frozen object
  3075. if (!isExtensible(it)) return 'F';
  3076. // not necessary to add metadata
  3077. if (!create) return 'E';
  3078. // add missing metadata
  3079. setMetadata(it);
  3080. // return object ID
  3081. } return it[METADATA].objectID;
  3082. };
  3083. var getWeakData = function (it, create) {
  3084. if (!hasOwn(it, METADATA)) {
  3085. // can't set metadata to uncaught frozen object
  3086. if (!isExtensible(it)) return true;
  3087. // not necessary to add metadata
  3088. if (!create) return false;
  3089. // add missing metadata
  3090. setMetadata(it);
  3091. // return the store of weak collections IDs
  3092. } return it[METADATA].weakData;
  3093. };
  3094. // add metadata on freeze-family methods calling
  3095. var onFreeze = function (it) {
  3096. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
  3097. return it;
  3098. };
  3099. var enable = function () {
  3100. meta.enable = function () { /* empty */ };
  3101. REQUIRED = true;
  3102. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  3103. var splice = uncurryThis([].splice);
  3104. var test = {};
  3105. test[METADATA] = 1;
  3106. // prevent exposing of metadata key
  3107. if (getOwnPropertyNames(test).length) {
  3108. getOwnPropertyNamesModule.f = function (it) {
  3109. var result = getOwnPropertyNames(it);
  3110. for (var i = 0, length = result.length; i < length; i++) {
  3111. if (result[i] === METADATA) {
  3112. splice(result, i, 1);
  3113. break;
  3114. }
  3115. } return result;
  3116. };
  3117. $({ target: 'Object', stat: true, forced: true }, {
  3118. getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
  3119. });
  3120. }
  3121. };
  3122. var meta = module.exports = {
  3123. enable: enable,
  3124. fastKey: fastKey,
  3125. getWeakData: getWeakData,
  3126. onFreeze: onFreeze
  3127. };
  3128. hiddenKeys[METADATA] = true;
  3129. /***/ }),
  3130. /* 95 */
  3131. /***/ (function(module, exports, __webpack_require__) {
  3132. var uncurryThis = __webpack_require__(4);
  3133. var fails = __webpack_require__(2);
  3134. var classof = __webpack_require__(63);
  3135. var $Object = Object;
  3136. var split = uncurryThis(''.split);
  3137. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  3138. module.exports = fails(function () {
  3139. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  3140. // eslint-disable-next-line no-prototype-builtins -- safe
  3141. return !$Object('z').propertyIsEnumerable(0);
  3142. }) ? function (it) {
  3143. return classof(it) == 'String' ? split(it, '') : $Object(it);
  3144. } : $Object;
  3145. /***/ }),
  3146. /* 96 */
  3147. /***/ (function(module, exports, __webpack_require__) {
  3148. var toPrimitive = __webpack_require__(285);
  3149. var isSymbol = __webpack_require__(97);
  3150. // `ToPropertyKey` abstract operation
  3151. // https://tc39.es/ecma262/#sec-topropertykey
  3152. module.exports = function (argument) {
  3153. var key = toPrimitive(argument, 'string');
  3154. return isSymbol(key) ? key : key + '';
  3155. };
  3156. /***/ }),
  3157. /* 97 */
  3158. /***/ (function(module, exports, __webpack_require__) {
  3159. var getBuiltIn = __webpack_require__(18);
  3160. var isCallable = __webpack_require__(8);
  3161. var isPrototypeOf = __webpack_require__(19);
  3162. var USE_SYMBOL_AS_UID = __webpack_require__(157);
  3163. var $Object = Object;
  3164. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  3165. return typeof it == 'symbol';
  3166. } : function (it) {
  3167. var $Symbol = getBuiltIn('Symbol');
  3168. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  3169. };
  3170. /***/ }),
  3171. /* 98 */
  3172. /***/ (function(module, exports, __webpack_require__) {
  3173. var getBuiltIn = __webpack_require__(18);
  3174. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  3175. /***/ }),
  3176. /* 99 */
  3177. /***/ (function(module, exports, __webpack_require__) {
  3178. var uncurryThis = __webpack_require__(4);
  3179. var id = 0;
  3180. var postfix = Math.random();
  3181. var toString = uncurryThis(1.0.toString);
  3182. module.exports = function (key) {
  3183. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  3184. };
  3185. /***/ }),
  3186. /* 100 */
  3187. /***/ (function(module, exports, __webpack_require__) {
  3188. var hasOwn = __webpack_require__(13);
  3189. var isCallable = __webpack_require__(8);
  3190. var toObject = __webpack_require__(34);
  3191. var sharedKey = __webpack_require__(101);
  3192. var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
  3193. var IE_PROTO = sharedKey('IE_PROTO');
  3194. var $Object = Object;
  3195. var ObjectPrototype = $Object.prototype;
  3196. // `Object.getPrototypeOf` method
  3197. // https://tc39.es/ecma262/#sec-object.getprototypeof
  3198. // eslint-disable-next-line es-x/no-object-getprototypeof -- safe
  3199. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  3200. var object = toObject(O);
  3201. if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
  3202. var constructor = object.constructor;
  3203. if (isCallable(constructor) && object instanceof constructor) {
  3204. return constructor.prototype;
  3205. } return object instanceof $Object ? ObjectPrototype : null;
  3206. };
  3207. /***/ }),
  3208. /* 101 */
  3209. /***/ (function(module, exports, __webpack_require__) {
  3210. var shared = __webpack_require__(79);
  3211. var uid = __webpack_require__(99);
  3212. var keys = shared('keys');
  3213. module.exports = function (key) {
  3214. return keys[key] || (keys[key] = uid(key));
  3215. };
  3216. /***/ }),
  3217. /* 102 */
  3218. /***/ (function(module, exports, __webpack_require__) {
  3219. /* eslint-disable no-proto -- safe */
  3220. var uncurryThis = __webpack_require__(4);
  3221. var anObject = __webpack_require__(20);
  3222. var aPossiblePrototype = __webpack_require__(288);
  3223. // `Object.setPrototypeOf` method
  3224. // https://tc39.es/ecma262/#sec-object.setprototypeof
  3225. // Works with __proto__ only. Old v8 can't work with null proto objects.
  3226. // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
  3227. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  3228. var CORRECT_SETTER = false;
  3229. var test = {};
  3230. var setter;
  3231. try {
  3232. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  3233. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  3234. setter(test, []);
  3235. CORRECT_SETTER = test instanceof Array;
  3236. } catch (error) { /* empty */ }
  3237. return function setPrototypeOf(O, proto) {
  3238. anObject(O);
  3239. aPossiblePrototype(proto);
  3240. if (CORRECT_SETTER) setter(O, proto);
  3241. else O.__proto__ = proto;
  3242. return O;
  3243. };
  3244. }() : undefined);
  3245. /***/ }),
  3246. /* 103 */
  3247. /***/ (function(module, exports, __webpack_require__) {
  3248. var internalObjectKeys = __webpack_require__(163);
  3249. var enumBugKeys = __webpack_require__(127);
  3250. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  3251. // `Object.getOwnPropertyNames` method
  3252. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  3253. // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
  3254. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  3255. return internalObjectKeys(O, hiddenKeys);
  3256. };
  3257. /***/ }),
  3258. /* 104 */
  3259. /***/ (function(module, exports) {
  3260. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
  3261. exports.f = Object.getOwnPropertySymbols;
  3262. /***/ }),
  3263. /* 105 */
  3264. /***/ (function(module, exports, __webpack_require__) {
  3265. var internalObjectKeys = __webpack_require__(163);
  3266. var enumBugKeys = __webpack_require__(127);
  3267. // `Object.keys` method
  3268. // https://tc39.es/ecma262/#sec-object.keys
  3269. // eslint-disable-next-line es-x/no-object-keys -- safe
  3270. module.exports = Object.keys || function keys(O) {
  3271. return internalObjectKeys(O, enumBugKeys);
  3272. };
  3273. /***/ }),
  3274. /* 106 */
  3275. /***/ (function(module, exports, __webpack_require__) {
  3276. var classof = __webpack_require__(51);
  3277. var getMethod = __webpack_require__(122);
  3278. var Iterators = __webpack_require__(50);
  3279. var wellKnownSymbol = __webpack_require__(9);
  3280. var ITERATOR = wellKnownSymbol('iterator');
  3281. module.exports = function (it) {
  3282. if (it != undefined) return getMethod(it, ITERATOR)
  3283. || getMethod(it, '@@iterator')
  3284. || Iterators[classof(it)];
  3285. };
  3286. /***/ }),
  3287. /* 107 */
  3288. /***/ (function(module, exports, __webpack_require__) {
  3289. var classof = __webpack_require__(63);
  3290. var global = __webpack_require__(7);
  3291. module.exports = classof(global.process) == 'process';
  3292. /***/ }),
  3293. /* 108 */
  3294. /***/ (function(module, exports, __webpack_require__) {
  3295. var isPrototypeOf = __webpack_require__(19);
  3296. var $TypeError = TypeError;
  3297. module.exports = function (it, Prototype) {
  3298. if (isPrototypeOf(Prototype, it)) return it;
  3299. throw $TypeError('Incorrect invocation');
  3300. };
  3301. /***/ }),
  3302. /* 109 */
  3303. /***/ (function(module, exports, __webpack_require__) {
  3304. var uncurryThis = __webpack_require__(4);
  3305. var fails = __webpack_require__(2);
  3306. var isCallable = __webpack_require__(8);
  3307. var classof = __webpack_require__(51);
  3308. var getBuiltIn = __webpack_require__(18);
  3309. var inspectSource = __webpack_require__(130);
  3310. var noop = function () { /* empty */ };
  3311. var empty = [];
  3312. var construct = getBuiltIn('Reflect', 'construct');
  3313. var constructorRegExp = /^\s*(?:class|function)\b/;
  3314. var exec = uncurryThis(constructorRegExp.exec);
  3315. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  3316. var isConstructorModern = function isConstructor(argument) {
  3317. if (!isCallable(argument)) return false;
  3318. try {
  3319. construct(noop, empty, argument);
  3320. return true;
  3321. } catch (error) {
  3322. return false;
  3323. }
  3324. };
  3325. var isConstructorLegacy = function isConstructor(argument) {
  3326. if (!isCallable(argument)) return false;
  3327. switch (classof(argument)) {
  3328. case 'AsyncFunction':
  3329. case 'GeneratorFunction':
  3330. case 'AsyncGeneratorFunction': return false;
  3331. }
  3332. try {
  3333. // we can't check .prototype since constructors produced by .bind haven't it
  3334. // `Function#toString` throws on some built-it function in some legacy engines
  3335. // (for example, `DOMQuad` and similar in FF41-)
  3336. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  3337. } catch (error) {
  3338. return true;
  3339. }
  3340. };
  3341. isConstructorLegacy.sham = true;
  3342. // `IsConstructor` abstract operation
  3343. // https://tc39.es/ecma262/#sec-isconstructor
  3344. module.exports = !construct || fails(function () {
  3345. var called;
  3346. return isConstructorModern(isConstructorModern.call)
  3347. || !isConstructorModern(Object)
  3348. || !isConstructorModern(function () { called = true; })
  3349. || called;
  3350. }) ? isConstructorLegacy : isConstructorModern;
  3351. /***/ }),
  3352. /* 110 */
  3353. /***/ (function(module, exports, __webpack_require__) {
  3354. var uncurryThis = __webpack_require__(4);
  3355. module.exports = uncurryThis([].slice);
  3356. /***/ }),
  3357. /* 111 */
  3358. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3359. "use strict";
  3360. /* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
  3361. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(139);
  3362. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(191);
  3363. // Returns a predicate for checking whether an object has a given set of
  3364. // `key:value` pairs.
  3365. function matcher(attrs) {
  3366. attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
  3367. return function(obj) {
  3368. return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
  3369. };
  3370. }
  3371. /***/ }),
  3372. /* 112 */
  3373. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3374. "use strict";
  3375. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  3376. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(207);
  3377. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
  3378. // Partially apply a function by creating a version that has had some of its
  3379. // arguments pre-filled, without changing its dynamic `this` context. `_` acts
  3380. // as a placeholder by default, allowing any combination of arguments to be
  3381. // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
  3382. var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
  3383. var placeholder = partial.placeholder;
  3384. var bound = function() {
  3385. var position = 0, length = boundArgs.length;
  3386. var args = Array(length);
  3387. for (var i = 0; i < length; i++) {
  3388. args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
  3389. }
  3390. while (position < arguments.length) args.push(arguments[position++]);
  3391. return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
  3392. };
  3393. return bound;
  3394. });
  3395. partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
  3396. /* harmony default export */ __webpack_exports__["a"] = (partial);
  3397. /***/ }),
  3398. /* 113 */
  3399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3400. "use strict";
  3401. /* harmony export (immutable) */ __webpack_exports__["a"] = group;
  3402. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  3403. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
  3404. // An internal function used for aggregate "group by" operations.
  3405. function group(behavior, partition) {
  3406. return function(obj, iteratee, context) {
  3407. var result = partition ? [[], []] : {};
  3408. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
  3409. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
  3410. var key = iteratee(value, index, obj);
  3411. behavior(result, value, key);
  3412. });
  3413. return result;
  3414. };
  3415. }
  3416. /***/ }),
  3417. /* 114 */
  3418. /***/ (function(module, exports, __webpack_require__) {
  3419. var fails = __webpack_require__(2);
  3420. var wellKnownSymbol = __webpack_require__(9);
  3421. var V8_VERSION = __webpack_require__(77);
  3422. var SPECIES = wellKnownSymbol('species');
  3423. module.exports = function (METHOD_NAME) {
  3424. // We can't use this feature detection in V8 since it causes
  3425. // deoptimization and serious performance degradation
  3426. // https://github.com/zloirock/core-js/issues/677
  3427. return V8_VERSION >= 51 || !fails(function () {
  3428. var array = [];
  3429. var constructor = array.constructor = {};
  3430. constructor[SPECIES] = function () {
  3431. return { foo: 1 };
  3432. };
  3433. return array[METHOD_NAME](Boolean).foo !== 1;
  3434. });
  3435. };
  3436. /***/ }),
  3437. /* 115 */
  3438. /***/ (function(module, exports, __webpack_require__) {
  3439. module.exports = __webpack_require__(399);
  3440. /***/ }),
  3441. /* 116 */
  3442. /***/ (function(module, exports, __webpack_require__) {
  3443. "use strict";
  3444. var _interopRequireDefault = __webpack_require__(1);
  3445. var _typeof2 = _interopRequireDefault(__webpack_require__(73));
  3446. var _filter = _interopRequireDefault(__webpack_require__(250));
  3447. var _map = _interopRequireDefault(__webpack_require__(35));
  3448. var _keys = _interopRequireDefault(__webpack_require__(115));
  3449. var _stringify = _interopRequireDefault(__webpack_require__(36));
  3450. var _concat = _interopRequireDefault(__webpack_require__(22));
  3451. var _ = __webpack_require__(3);
  3452. var _require = __webpack_require__(251),
  3453. timeout = _require.timeout;
  3454. var debug = __webpack_require__(60);
  3455. var debugRequest = debug('leancloud:request');
  3456. var debugRequestError = debug('leancloud:request:error');
  3457. var _require2 = __webpack_require__(72),
  3458. getAdapter = _require2.getAdapter;
  3459. var requestsCount = 0;
  3460. var ajax = function ajax(_ref) {
  3461. var method = _ref.method,
  3462. url = _ref.url,
  3463. query = _ref.query,
  3464. data = _ref.data,
  3465. _ref$headers = _ref.headers,
  3466. headers = _ref$headers === void 0 ? {} : _ref$headers,
  3467. time = _ref.timeout,
  3468. onprogress = _ref.onprogress;
  3469. if (query) {
  3470. var _context, _context2, _context4;
  3471. var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
  3472. var _context3;
  3473. var value = query[key];
  3474. if (value === undefined) return undefined;
  3475. var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
  3476. return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
  3477. })).call(_context, function (qs) {
  3478. return qs;
  3479. }).join('&');
  3480. url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
  3481. }
  3482. var count = requestsCount++;
  3483. debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
  3484. var request = getAdapter('request');
  3485. var promise = request(url, {
  3486. method: method,
  3487. headers: headers,
  3488. data: data,
  3489. onprogress: onprogress
  3490. }).then(function (response) {
  3491. debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
  3492. if (response.ok === false) {
  3493. var error = new Error();
  3494. error.response = response;
  3495. throw error;
  3496. }
  3497. return response.data;
  3498. }).catch(function (error) {
  3499. if (error.response) {
  3500. if (!debug.enabled('leancloud:request')) {
  3501. debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
  3502. }
  3503. debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
  3504. error.statusCode = error.response.status;
  3505. error.responseText = error.response.text;
  3506. error.response = error.response.data;
  3507. }
  3508. throw error;
  3509. });
  3510. return time ? timeout(promise, time) : promise;
  3511. };
  3512. module.exports = ajax;
  3513. /***/ }),
  3514. /* 117 */
  3515. /***/ (function(module, exports) {
  3516. /* (ignored) */
  3517. /***/ }),
  3518. /* 118 */
  3519. /***/ (function(module, exports, __webpack_require__) {
  3520. var Symbol = __webpack_require__(270),
  3521. getRawTag = __webpack_require__(640),
  3522. objectToString = __webpack_require__(641);
  3523. /** `Object#toString` result references. */
  3524. var nullTag = '[object Null]',
  3525. undefinedTag = '[object Undefined]';
  3526. /** Built-in value references. */
  3527. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3528. /**
  3529. * The base implementation of `getTag` without fallbacks for buggy environments.
  3530. *
  3531. * @private
  3532. * @param {*} value The value to query.
  3533. * @returns {string} Returns the `toStringTag`.
  3534. */
  3535. function baseGetTag(value) {
  3536. if (value == null) {
  3537. return value === undefined ? undefinedTag : nullTag;
  3538. }
  3539. return (symToStringTag && symToStringTag in Object(value))
  3540. ? getRawTag(value)
  3541. : objectToString(value);
  3542. }
  3543. module.exports = baseGetTag;
  3544. /***/ }),
  3545. /* 119 */
  3546. /***/ (function(module, exports) {
  3547. /**
  3548. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3549. * and has a `typeof` result of "object".
  3550. *
  3551. * @static
  3552. * @memberOf _
  3553. * @since 4.0.0
  3554. * @category Lang
  3555. * @param {*} value The value to check.
  3556. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3557. * @example
  3558. *
  3559. * _.isObjectLike({});
  3560. * // => true
  3561. *
  3562. * _.isObjectLike([1, 2, 3]);
  3563. * // => true
  3564. *
  3565. * _.isObjectLike(_.noop);
  3566. * // => false
  3567. *
  3568. * _.isObjectLike(null);
  3569. * // => false
  3570. */
  3571. function isObjectLike(value) {
  3572. return value != null && typeof value == 'object';
  3573. }
  3574. module.exports = isObjectLike;
  3575. /***/ }),
  3576. /* 120 */
  3577. /***/ (function(module, exports, __webpack_require__) {
  3578. "use strict";
  3579. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  3580. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  3581. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  3582. // Nashorn ~ JDK8 bug
  3583. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  3584. // `Object.prototype.propertyIsEnumerable` method implementation
  3585. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  3586. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  3587. var descriptor = getOwnPropertyDescriptor(this, V);
  3588. return !!descriptor && descriptor.enumerable;
  3589. } : $propertyIsEnumerable;
  3590. /***/ }),
  3591. /* 121 */
  3592. /***/ (function(module, exports) {
  3593. var $TypeError = TypeError;
  3594. // `RequireObjectCoercible` abstract operation
  3595. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  3596. module.exports = function (it) {
  3597. if (it == undefined) throw $TypeError("Can't call method on " + it);
  3598. return it;
  3599. };
  3600. /***/ }),
  3601. /* 122 */
  3602. /***/ (function(module, exports, __webpack_require__) {
  3603. var aCallable = __webpack_require__(31);
  3604. // `GetMethod` abstract operation
  3605. // https://tc39.es/ecma262/#sec-getmethod
  3606. module.exports = function (V, P) {
  3607. var func = V[P];
  3608. return func == null ? undefined : aCallable(func);
  3609. };
  3610. /***/ }),
  3611. /* 123 */
  3612. /***/ (function(module, exports, __webpack_require__) {
  3613. var global = __webpack_require__(7);
  3614. var defineGlobalProperty = __webpack_require__(287);
  3615. var SHARED = '__core-js_shared__';
  3616. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  3617. module.exports = store;
  3618. /***/ }),
  3619. /* 124 */
  3620. /***/ (function(module, exports, __webpack_require__) {
  3621. var global = __webpack_require__(7);
  3622. var isObject = __webpack_require__(11);
  3623. var document = global.document;
  3624. // typeof document.createElement is 'object' in old IE
  3625. var EXISTS = isObject(document) && isObject(document.createElement);
  3626. module.exports = function (it) {
  3627. return EXISTS ? document.createElement(it) : {};
  3628. };
  3629. /***/ }),
  3630. /* 125 */
  3631. /***/ (function(module, exports, __webpack_require__) {
  3632. var toIntegerOrInfinity = __webpack_require__(126);
  3633. var max = Math.max;
  3634. var min = Math.min;
  3635. // Helper for a popular repeating case of the spec:
  3636. // Let integer be ? ToInteger(index).
  3637. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  3638. module.exports = function (index, length) {
  3639. var integer = toIntegerOrInfinity(index);
  3640. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  3641. };
  3642. /***/ }),
  3643. /* 126 */
  3644. /***/ (function(module, exports, __webpack_require__) {
  3645. var trunc = __webpack_require__(290);
  3646. // `ToIntegerOrInfinity` abstract operation
  3647. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  3648. module.exports = function (argument) {
  3649. var number = +argument;
  3650. // eslint-disable-next-line no-self-compare -- NaN check
  3651. return number !== number || number === 0 ? 0 : trunc(number);
  3652. };
  3653. /***/ }),
  3654. /* 127 */
  3655. /***/ (function(module, exports) {
  3656. // IE8- don't enum bug keys
  3657. module.exports = [
  3658. 'constructor',
  3659. 'hasOwnProperty',
  3660. 'isPrototypeOf',
  3661. 'propertyIsEnumerable',
  3662. 'toLocaleString',
  3663. 'toString',
  3664. 'valueOf'
  3665. ];
  3666. /***/ }),
  3667. /* 128 */
  3668. /***/ (function(module, exports, __webpack_require__) {
  3669. var DESCRIPTORS = __webpack_require__(14);
  3670. var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
  3671. var definePropertyModule = __webpack_require__(23);
  3672. var anObject = __webpack_require__(20);
  3673. var toIndexedObject = __webpack_require__(32);
  3674. var objectKeys = __webpack_require__(105);
  3675. // `Object.defineProperties` method
  3676. // https://tc39.es/ecma262/#sec-object.defineproperties
  3677. // eslint-disable-next-line es-x/no-object-defineproperties -- safe
  3678. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  3679. anObject(O);
  3680. var props = toIndexedObject(Properties);
  3681. var keys = objectKeys(Properties);
  3682. var length = keys.length;
  3683. var index = 0;
  3684. var key;
  3685. while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
  3686. return O;
  3687. };
  3688. /***/ }),
  3689. /* 129 */
  3690. /***/ (function(module, exports, __webpack_require__) {
  3691. var wellKnownSymbol = __webpack_require__(9);
  3692. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3693. var test = {};
  3694. test[TO_STRING_TAG] = 'z';
  3695. module.exports = String(test) === '[object z]';
  3696. /***/ }),
  3697. /* 130 */
  3698. /***/ (function(module, exports, __webpack_require__) {
  3699. var uncurryThis = __webpack_require__(4);
  3700. var isCallable = __webpack_require__(8);
  3701. var store = __webpack_require__(123);
  3702. var functionToString = uncurryThis(Function.toString);
  3703. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  3704. if (!isCallable(store.inspectSource)) {
  3705. store.inspectSource = function (it) {
  3706. return functionToString(it);
  3707. };
  3708. }
  3709. module.exports = store.inspectSource;
  3710. /***/ }),
  3711. /* 131 */
  3712. /***/ (function(module, exports, __webpack_require__) {
  3713. "use strict";
  3714. var $ = __webpack_require__(0);
  3715. var call = __webpack_require__(15);
  3716. var IS_PURE = __webpack_require__(33);
  3717. var FunctionName = __webpack_require__(296);
  3718. var isCallable = __webpack_require__(8);
  3719. var createIteratorConstructor = __webpack_require__(297);
  3720. var getPrototypeOf = __webpack_require__(100);
  3721. var setPrototypeOf = __webpack_require__(102);
  3722. var setToStringTag = __webpack_require__(52);
  3723. var createNonEnumerableProperty = __webpack_require__(37);
  3724. var defineBuiltIn = __webpack_require__(44);
  3725. var wellKnownSymbol = __webpack_require__(9);
  3726. var Iterators = __webpack_require__(50);
  3727. var IteratorsCore = __webpack_require__(171);
  3728. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  3729. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  3730. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3731. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3732. var ITERATOR = wellKnownSymbol('iterator');
  3733. var KEYS = 'keys';
  3734. var VALUES = 'values';
  3735. var ENTRIES = 'entries';
  3736. var returnThis = function () { return this; };
  3737. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3738. createIteratorConstructor(IteratorConstructor, NAME, next);
  3739. var getIterationMethod = function (KIND) {
  3740. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  3741. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  3742. switch (KIND) {
  3743. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  3744. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  3745. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  3746. } return function () { return new IteratorConstructor(this); };
  3747. };
  3748. var TO_STRING_TAG = NAME + ' Iterator';
  3749. var INCORRECT_VALUES_NAME = false;
  3750. var IterablePrototype = Iterable.prototype;
  3751. var nativeIterator = IterablePrototype[ITERATOR]
  3752. || IterablePrototype['@@iterator']
  3753. || DEFAULT && IterablePrototype[DEFAULT];
  3754. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3755. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3756. var CurrentIteratorPrototype, methods, KEY;
  3757. // fix native
  3758. if (anyNativeIterator) {
  3759. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3760. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3761. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3762. if (setPrototypeOf) {
  3763. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3764. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  3765. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  3766. }
  3767. }
  3768. // Set @@toStringTag to native iterators
  3769. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3770. if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
  3771. }
  3772. }
  3773. // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  3774. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3775. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  3776. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  3777. } else {
  3778. INCORRECT_VALUES_NAME = true;
  3779. defaultIterator = function values() { return call(nativeIterator, this); };
  3780. }
  3781. }
  3782. // export additional methods
  3783. if (DEFAULT) {
  3784. methods = {
  3785. values: getIterationMethod(VALUES),
  3786. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3787. entries: getIterationMethod(ENTRIES)
  3788. };
  3789. if (FORCED) for (KEY in methods) {
  3790. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3791. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  3792. }
  3793. } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  3794. }
  3795. // define iterator
  3796. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3797. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  3798. }
  3799. Iterators[NAME] = defaultIterator;
  3800. return methods;
  3801. };
  3802. /***/ }),
  3803. /* 132 */
  3804. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3805. "use strict";
  3806. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  3807. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  3808. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
  3809. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
  3810. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
  3811. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
  3812. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
  3813. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(319);
  3814. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
  3815. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(180);
  3816. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
  3817. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(181);
  3818. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
  3819. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(320);
  3820. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
  3821. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(133);
  3822. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
  3823. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(182);
  3824. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
  3825. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(321);
  3826. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
  3827. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(322);
  3828. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
  3829. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(323);
  3830. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
  3831. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(183);
  3832. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
  3833. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(184);
  3834. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
  3835. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(134);
  3836. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
  3837. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(57);
  3838. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
  3839. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(28);
  3840. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
  3841. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(135);
  3842. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
  3843. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(325);
  3844. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
  3845. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(185);
  3846. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
  3847. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(186);
  3848. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
  3849. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(327);
  3850. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
  3851. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(191);
  3852. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
  3853. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(328);
  3854. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
  3855. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(330);
  3856. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
  3857. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(331);
  3858. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
  3859. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(332);
  3860. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
  3861. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(333);
  3862. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
  3863. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(16);
  3864. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
  3865. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(85);
  3866. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
  3867. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(66);
  3868. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
  3869. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(334);
  3870. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
  3871. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(192);
  3872. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
  3873. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(193);
  3874. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
  3875. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
  3876. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(194);
  3877. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
  3878. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(139);
  3879. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
  3880. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
  3881. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(195);
  3882. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
  3883. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(335);
  3884. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
  3885. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(197);
  3886. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
  3887. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(336);
  3888. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
  3889. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(198);
  3890. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
  3891. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(337);
  3892. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
  3893. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(338);
  3894. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
  3895. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(141);
  3896. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
  3897. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(187);
  3898. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
  3899. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(202);
  3900. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
  3901. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(199);
  3902. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
  3903. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(142);
  3904. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
  3905. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(339);
  3906. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
  3907. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(111);
  3908. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
  3909. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
  3910. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(340);
  3911. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
  3912. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(203);
  3913. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
  3914. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(143);
  3915. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
  3916. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(341);
  3917. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
  3918. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(342);
  3919. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
  3920. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(206);
  3921. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
  3922. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(344);
  3923. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
  3924. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(345);
  3925. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
  3926. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(346);
  3927. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
  3928. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(347);
  3929. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
  3930. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(201);
  3931. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
  3932. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(112);
  3933. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
  3934. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(208);
  3935. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
  3936. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(348);
  3937. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
  3938. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(349);
  3939. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
  3940. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(209);
  3941. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
  3942. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(350);
  3943. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
  3944. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(351);
  3945. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
  3946. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(352);
  3947. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
  3948. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(353);
  3949. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
  3950. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(144);
  3951. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
  3952. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(354);
  3953. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
  3954. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(355);
  3955. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
  3956. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(210);
  3957. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
  3958. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(356);
  3959. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
  3960. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(211);
  3961. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
  3962. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(145);
  3963. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
  3964. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(213);
  3965. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
  3966. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(214);
  3967. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
  3968. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(215);
  3969. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
  3970. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(357);
  3971. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
  3972. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(217);
  3973. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
  3974. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
  3975. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(358);
  3976. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
  3977. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(58);
  3978. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
  3979. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
  3980. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(68);
  3981. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
  3982. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
  3983. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(359);
  3984. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
  3985. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
  3986. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
  3987. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(360);
  3988. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
  3989. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
  3990. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(88);
  3991. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
  3992. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
  3993. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(361);
  3994. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
  3995. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(362);
  3996. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
  3997. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
  3998. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(363);
  3999. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
  4000. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
  4001. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(89);
  4002. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
  4003. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
  4004. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
  4005. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(364);
  4006. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
  4007. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(146);
  4008. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
  4009. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(365);
  4010. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
  4011. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(219);
  4012. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
  4013. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(366);
  4014. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
  4015. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(367);
  4016. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
  4017. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(220);
  4018. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
  4019. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(368);
  4020. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
  4021. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(369);
  4022. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
  4023. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(370);
  4024. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
  4025. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(371);
  4026. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
  4027. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(372);
  4028. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
  4029. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(373);
  4030. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
  4031. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(374);
  4032. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
  4033. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(221);
  4034. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
  4035. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(376);
  4036. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
  4037. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(377);
  4038. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
  4039. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
  4040. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
  4041. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(222);
  4042. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
  4043. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(378);
  4044. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
  4045. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(223);
  4046. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
  4047. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
  4048. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
  4049. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(379);
  4050. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
  4051. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(380);
  4052. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
  4053. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(381);
  4054. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
  4055. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(225);
  4056. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
  4057. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
  4058. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(382);
  4059. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
  4060. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(383);
  4061. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
  4062. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(224);
  4063. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
  4064. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(226);
  4065. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
  4066. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
  4067. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(384);
  4068. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
  4069. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(385);
  4070. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
  4071. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(386);
  4072. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
  4073. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(387);
  4074. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
  4075. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(388);
  4076. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
  4077. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(389);
  4078. /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
  4079. // Named Exports
  4080. // =============
  4081. // Underscore.js 1.12.1
  4082. // https://underscorejs.org
  4083. // (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  4084. // Underscore may be freely distributed under the MIT license.
  4085. // Baseline setup.
  4086. // Object Functions
  4087. // ----------------
  4088. // Our most fundamental functions operate on any JavaScript object.
  4089. // Most functions in Underscore depend on at least one function in this section.
  4090. // A group of functions that check the types of core JavaScript values.
  4091. // These are often informally referred to as the "isType" functions.
  4092. // Functions that treat an object as a dictionary of key-value pairs.
  4093. // Utility Functions
  4094. // -----------------
  4095. // A bit of a grab bag: Predicate-generating functions for use with filters and
  4096. // loops, string escaping and templating, create random numbers and unique ids,
  4097. // and functions that facilitate Underscore's chaining and iteration conventions.
  4098. // Function (ahem) Functions
  4099. // -------------------------
  4100. // These functions take a function as an argument and return a new function
  4101. // as the result. Also known as higher-order functions.
  4102. // Finders
  4103. // -------
  4104. // Functions that extract (the position of) a single element from an object
  4105. // or array based on some criterion.
  4106. // Collection Functions
  4107. // --------------------
  4108. // Functions that work on any collection of elements: either an array, or
  4109. // an object of key-value pairs.
  4110. // `_.pick` and `_.omit` are actually object functions, but we put
  4111. // them here in order to create a more natural reading order in the
  4112. // monolithic build as they depend on `_.contains`.
  4113. // Array Functions
  4114. // ---------------
  4115. // Functions that operate on arrays (and array-likes) only, because they’re
  4116. // expressed in terms of operations on an ordered list of values.
  4117. // OOP
  4118. // ---
  4119. // These modules support the "object-oriented" calling style. See also
  4120. // `underscore.js` and `index-default.js`.
  4121. /***/ }),
  4122. /* 133 */
  4123. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4124. "use strict";
  4125. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  4126. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
  4127. /***/ }),
  4128. /* 134 */
  4129. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4130. "use strict";
  4131. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  4132. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  4133. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(184);
  4134. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(84);
  4135. var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
  4136. // In IE 10 - Edge 13, we need a different heuristic
  4137. // to determine whether an object is a `DataView`.
  4138. function ie10IsDataView(obj) {
  4139. return obj != null && Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj.getInt8) && Object(__WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__["a" /* default */])(obj.buffer);
  4140. }
  4141. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
  4142. /***/ }),
  4143. /* 135 */
  4144. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4145. "use strict";
  4146. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  4147. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
  4148. var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
  4149. // Define a fallback version of the method in browsers (ahem, IE < 9), where
  4150. // there isn't any inspectable "Arguments" type.
  4151. (function() {
  4152. if (!isArguments(arguments)) {
  4153. isArguments = function(obj) {
  4154. return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
  4155. };
  4156. }
  4157. }());
  4158. /* harmony default export */ __webpack_exports__["a"] = (isArguments);
  4159. /***/ }),
  4160. /* 136 */
  4161. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4162. "use strict";
  4163. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
  4164. // Internal helper to obtain the `byteLength` property of an object.
  4165. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
  4166. /***/ }),
  4167. /* 137 */
  4168. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4169. "use strict";
  4170. /* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
  4171. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
  4172. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
  4173. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
  4174. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
  4175. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  4176. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(85);
  4177. // Since the regular `Object.prototype.toString` type tests don't work for
  4178. // some types in IE 11, we use a fingerprinting heuristic instead, based
  4179. // on the methods. It's not great, but it's the best we got.
  4180. // The fingerprint method lists are defined below.
  4181. function ie11fingerprint(methods) {
  4182. var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
  4183. return function(obj) {
  4184. if (obj == null) return false;
  4185. // `Map`, `WeakMap` and `Set` have no enumerable keys.
  4186. var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
  4187. if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
  4188. for (var i = 0; i < length; i++) {
  4189. if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
  4190. }
  4191. // If we are testing against `WeakMap`, we need to ensure that
  4192. // `obj` doesn't have a `forEach` method in order to distinguish
  4193. // it from a regular `Map`.
  4194. return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
  4195. };
  4196. }
  4197. // In the interest of compact minification, we write
  4198. // each string in the fingerprints only once.
  4199. var forEachName = 'forEach',
  4200. hasName = 'has',
  4201. commonInit = ['clear', 'delete'],
  4202. mapTail = ['get', hasName, 'set'];
  4203. // `Map`, `WeakMap` and `Set` each have slightly different
  4204. // combinations of the above sublists.
  4205. var mapMethods = commonInit.concat(forEachName, mapTail),
  4206. weakMapMethods = commonInit.concat(mapTail),
  4207. setMethods = ['add'].concat(commonInit, forEachName, hasName);
  4208. /***/ }),
  4209. /* 138 */
  4210. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4211. "use strict";
  4212. /* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
  4213. // An internal function for creating assigner functions.
  4214. function createAssigner(keysFunc, defaults) {
  4215. return function(obj) {
  4216. var length = arguments.length;
  4217. if (defaults) obj = Object(obj);
  4218. if (length < 2 || obj == null) return obj;
  4219. for (var index = 1; index < length; index++) {
  4220. var source = arguments[index],
  4221. keys = keysFunc(source),
  4222. l = keys.length;
  4223. for (var i = 0; i < l; i++) {
  4224. var key = keys[i];
  4225. if (!defaults || obj[key] === void 0) obj[key] = source[key];
  4226. }
  4227. }
  4228. return obj;
  4229. };
  4230. }
  4231. /***/ }),
  4232. /* 139 */
  4233. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4234. "use strict";
  4235. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
  4236. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
  4237. // Assigns a given object with all the own properties in the passed-in
  4238. // object(s).
  4239. // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
  4240. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
  4241. /***/ }),
  4242. /* 140 */
  4243. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4244. "use strict";
  4245. /* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
  4246. // Internal function to obtain a nested property in `obj` along `path`.
  4247. function deepGet(obj, path) {
  4248. var length = path.length;
  4249. for (var i = 0; i < length; i++) {
  4250. if (obj == null) return void 0;
  4251. obj = obj[path[i]];
  4252. }
  4253. return length ? obj : void 0;
  4254. }
  4255. /***/ }),
  4256. /* 141 */
  4257. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4258. "use strict";
  4259. /* harmony export (immutable) */ __webpack_exports__["a"] = identity;
  4260. // Keep the identity function around for default iteratees.
  4261. function identity(value) {
  4262. return value;
  4263. }
  4264. /***/ }),
  4265. /* 142 */
  4266. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4267. "use strict";
  4268. /* harmony export (immutable) */ __webpack_exports__["a"] = property;
  4269. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(140);
  4270. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
  4271. // Creates a function that, when passed an object, will traverse that object’s
  4272. // properties down the given `path`, specified as an array of keys or indices.
  4273. function property(path) {
  4274. path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
  4275. return function(obj) {
  4276. return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
  4277. };
  4278. }
  4279. /***/ }),
  4280. /* 143 */
  4281. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4282. "use strict";
  4283. // A (possibly faster) way to get the current timestamp as an integer.
  4284. /* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
  4285. return new Date().getTime();
  4286. });
  4287. /***/ }),
  4288. /* 144 */
  4289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4290. "use strict";
  4291. /* harmony export (immutable) */ __webpack_exports__["a"] = negate;
  4292. // Returns a negated version of the passed-in predicate.
  4293. function negate(predicate) {
  4294. return function() {
  4295. return !predicate.apply(this, arguments);
  4296. };
  4297. }
  4298. /***/ }),
  4299. /* 145 */
  4300. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4301. "use strict";
  4302. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
  4303. // Returns the first index on an array-like that passes a truth test.
  4304. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
  4305. /***/ }),
  4306. /* 146 */
  4307. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4308. "use strict";
  4309. /* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
  4310. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(68);
  4311. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(142);
  4312. // Convenience version of a common use case of `_.map`: fetching a property.
  4313. function pluck(obj, key) {
  4314. return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
  4315. }
  4316. /***/ }),
  4317. /* 147 */
  4318. /***/ (function(module, exports, __webpack_require__) {
  4319. module.exports = __webpack_require__(233);
  4320. /***/ }),
  4321. /* 148 */
  4322. /***/ (function(module, exports, __webpack_require__) {
  4323. var wellKnownSymbol = __webpack_require__(9);
  4324. exports.f = wellKnownSymbol;
  4325. /***/ }),
  4326. /* 149 */
  4327. /***/ (function(module, exports, __webpack_require__) {
  4328. module.exports = __webpack_require__(243);
  4329. /***/ }),
  4330. /* 150 */
  4331. /***/ (function(module, exports, __webpack_require__) {
  4332. module.exports = __webpack_require__(501);
  4333. /***/ }),
  4334. /* 151 */
  4335. /***/ (function(module, exports, __webpack_require__) {
  4336. module.exports = __webpack_require__(552);
  4337. /***/ }),
  4338. /* 152 */
  4339. /***/ (function(module, exports, __webpack_require__) {
  4340. module.exports = __webpack_require__(570);
  4341. /***/ }),
  4342. /* 153 */
  4343. /***/ (function(module, exports, __webpack_require__) {
  4344. module.exports = __webpack_require__(574);
  4345. /***/ }),
  4346. /* 154 */
  4347. /***/ (function(module, exports, __webpack_require__) {
  4348. var defineBuiltIn = __webpack_require__(44);
  4349. module.exports = function (target, src, options) {
  4350. for (var key in src) {
  4351. if (options && options.unsafe && target[key]) target[key] = src[key];
  4352. else defineBuiltIn(target, key, src[key], options);
  4353. } return target;
  4354. };
  4355. /***/ }),
  4356. /* 155 */
  4357. /***/ (function(module, exports, __webpack_require__) {
  4358. "use strict";
  4359. var $ = __webpack_require__(0);
  4360. var global = __webpack_require__(7);
  4361. var InternalMetadataModule = __webpack_require__(94);
  4362. var fails = __webpack_require__(2);
  4363. var createNonEnumerableProperty = __webpack_require__(37);
  4364. var iterate = __webpack_require__(42);
  4365. var anInstance = __webpack_require__(108);
  4366. var isCallable = __webpack_require__(8);
  4367. var isObject = __webpack_require__(11);
  4368. var setToStringTag = __webpack_require__(52);
  4369. var defineProperty = __webpack_require__(23).f;
  4370. var forEach = __webpack_require__(70).forEach;
  4371. var DESCRIPTORS = __webpack_require__(14);
  4372. var InternalStateModule = __webpack_require__(43);
  4373. var setInternalState = InternalStateModule.set;
  4374. var internalStateGetterFor = InternalStateModule.getterFor;
  4375. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  4376. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  4377. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  4378. var ADDER = IS_MAP ? 'set' : 'add';
  4379. var NativeConstructor = global[CONSTRUCTOR_NAME];
  4380. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  4381. var exported = {};
  4382. var Constructor;
  4383. if (!DESCRIPTORS || !isCallable(NativeConstructor)
  4384. || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
  4385. ) {
  4386. // create collection constructor
  4387. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  4388. InternalMetadataModule.enable();
  4389. } else {
  4390. Constructor = wrapper(function (target, iterable) {
  4391. setInternalState(anInstance(target, Prototype), {
  4392. type: CONSTRUCTOR_NAME,
  4393. collection: new NativeConstructor()
  4394. });
  4395. if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
  4396. });
  4397. var Prototype = Constructor.prototype;
  4398. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  4399. forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
  4400. var IS_ADDER = KEY == 'add' || KEY == 'set';
  4401. if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
  4402. createNonEnumerableProperty(Prototype, KEY, function (a, b) {
  4403. var collection = getInternalState(this).collection;
  4404. if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
  4405. var result = collection[KEY](a === 0 ? 0 : a, b);
  4406. return IS_ADDER ? this : result;
  4407. });
  4408. }
  4409. });
  4410. IS_WEAK || defineProperty(Prototype, 'size', {
  4411. configurable: true,
  4412. get: function () {
  4413. return getInternalState(this).collection.size;
  4414. }
  4415. });
  4416. }
  4417. setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
  4418. exported[CONSTRUCTOR_NAME] = Constructor;
  4419. $({ global: true, forced: true }, exported);
  4420. if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  4421. return Constructor;
  4422. };
  4423. /***/ }),
  4424. /* 156 */
  4425. /***/ (function(module, exports, __webpack_require__) {
  4426. "use strict";
  4427. module.exports = __webpack_require__(589);
  4428. /***/ }),
  4429. /* 157 */
  4430. /***/ (function(module, exports, __webpack_require__) {
  4431. /* eslint-disable es-x/no-symbol -- required for testing */
  4432. var NATIVE_SYMBOL = __webpack_require__(64);
  4433. module.exports = NATIVE_SYMBOL
  4434. && !Symbol.sham
  4435. && typeof Symbol.iterator == 'symbol';
  4436. /***/ }),
  4437. /* 158 */
  4438. /***/ (function(module, exports, __webpack_require__) {
  4439. var DESCRIPTORS = __webpack_require__(14);
  4440. var fails = __webpack_require__(2);
  4441. var createElement = __webpack_require__(124);
  4442. // Thanks to IE8 for its funny defineProperty
  4443. module.exports = !DESCRIPTORS && !fails(function () {
  4444. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  4445. return Object.defineProperty(createElement('div'), 'a', {
  4446. get: function () { return 7; }
  4447. }).a != 7;
  4448. });
  4449. /***/ }),
  4450. /* 159 */
  4451. /***/ (function(module, exports, __webpack_require__) {
  4452. var fails = __webpack_require__(2);
  4453. var isCallable = __webpack_require__(8);
  4454. var replacement = /#|\.prototype\./;
  4455. var isForced = function (feature, detection) {
  4456. var value = data[normalize(feature)];
  4457. return value == POLYFILL ? true
  4458. : value == NATIVE ? false
  4459. : isCallable(detection) ? fails(detection)
  4460. : !!detection;
  4461. };
  4462. var normalize = isForced.normalize = function (string) {
  4463. return String(string).replace(replacement, '.').toLowerCase();
  4464. };
  4465. var data = isForced.data = {};
  4466. var NATIVE = isForced.NATIVE = 'N';
  4467. var POLYFILL = isForced.POLYFILL = 'P';
  4468. module.exports = isForced;
  4469. /***/ }),
  4470. /* 160 */
  4471. /***/ (function(module, exports, __webpack_require__) {
  4472. var DESCRIPTORS = __webpack_require__(14);
  4473. var fails = __webpack_require__(2);
  4474. // V8 ~ Chrome 36-
  4475. // https://bugs.chromium.org/p/v8/issues/detail?id=3334
  4476. module.exports = DESCRIPTORS && fails(function () {
  4477. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  4478. return Object.defineProperty(function () { /* empty */ }, 'prototype', {
  4479. value: 42,
  4480. writable: false
  4481. }).prototype != 42;
  4482. });
  4483. /***/ }),
  4484. /* 161 */
  4485. /***/ (function(module, exports, __webpack_require__) {
  4486. var fails = __webpack_require__(2);
  4487. module.exports = !fails(function () {
  4488. function F() { /* empty */ }
  4489. F.prototype.constructor = null;
  4490. // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
  4491. return Object.getPrototypeOf(new F()) !== F.prototype;
  4492. });
  4493. /***/ }),
  4494. /* 162 */
  4495. /***/ (function(module, exports, __webpack_require__) {
  4496. var getBuiltIn = __webpack_require__(18);
  4497. var uncurryThis = __webpack_require__(4);
  4498. var getOwnPropertyNamesModule = __webpack_require__(103);
  4499. var getOwnPropertySymbolsModule = __webpack_require__(104);
  4500. var anObject = __webpack_require__(20);
  4501. var concat = uncurryThis([].concat);
  4502. // all object keys, includes non-enumerable and symbols
  4503. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  4504. var keys = getOwnPropertyNamesModule.f(anObject(it));
  4505. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  4506. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  4507. };
  4508. /***/ }),
  4509. /* 163 */
  4510. /***/ (function(module, exports, __webpack_require__) {
  4511. var uncurryThis = __webpack_require__(4);
  4512. var hasOwn = __webpack_require__(13);
  4513. var toIndexedObject = __webpack_require__(32);
  4514. var indexOf = __webpack_require__(164).indexOf;
  4515. var hiddenKeys = __webpack_require__(80);
  4516. var push = uncurryThis([].push);
  4517. module.exports = function (object, names) {
  4518. var O = toIndexedObject(object);
  4519. var i = 0;
  4520. var result = [];
  4521. var key;
  4522. for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  4523. // Don't enum bug & hidden keys
  4524. while (names.length > i) if (hasOwn(O, key = names[i++])) {
  4525. ~indexOf(result, key) || push(result, key);
  4526. }
  4527. return result;
  4528. };
  4529. /***/ }),
  4530. /* 164 */
  4531. /***/ (function(module, exports, __webpack_require__) {
  4532. var toIndexedObject = __webpack_require__(32);
  4533. var toAbsoluteIndex = __webpack_require__(125);
  4534. var lengthOfArrayLike = __webpack_require__(41);
  4535. // `Array.prototype.{ indexOf, includes }` methods implementation
  4536. var createMethod = function (IS_INCLUDES) {
  4537. return function ($this, el, fromIndex) {
  4538. var O = toIndexedObject($this);
  4539. var length = lengthOfArrayLike(O);
  4540. var index = toAbsoluteIndex(fromIndex, length);
  4541. var value;
  4542. // Array#includes uses SameValueZero equality algorithm
  4543. // eslint-disable-next-line no-self-compare -- NaN check
  4544. if (IS_INCLUDES && el != el) while (length > index) {
  4545. value = O[index++];
  4546. // eslint-disable-next-line no-self-compare -- NaN check
  4547. if (value != value) return true;
  4548. // Array#indexOf ignores holes, Array#includes - not
  4549. } else for (;length > index; index++) {
  4550. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  4551. } return !IS_INCLUDES && -1;
  4552. };
  4553. };
  4554. module.exports = {
  4555. // `Array.prototype.includes` method
  4556. // https://tc39.es/ecma262/#sec-array.prototype.includes
  4557. includes: createMethod(true),
  4558. // `Array.prototype.indexOf` method
  4559. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  4560. indexOf: createMethod(false)
  4561. };
  4562. /***/ }),
  4563. /* 165 */
  4564. /***/ (function(module, exports, __webpack_require__) {
  4565. var getBuiltIn = __webpack_require__(18);
  4566. module.exports = getBuiltIn('document', 'documentElement');
  4567. /***/ }),
  4568. /* 166 */
  4569. /***/ (function(module, exports, __webpack_require__) {
  4570. var wellKnownSymbol = __webpack_require__(9);
  4571. var Iterators = __webpack_require__(50);
  4572. var ITERATOR = wellKnownSymbol('iterator');
  4573. var ArrayPrototype = Array.prototype;
  4574. // check on default Array iterator
  4575. module.exports = function (it) {
  4576. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  4577. };
  4578. /***/ }),
  4579. /* 167 */
  4580. /***/ (function(module, exports, __webpack_require__) {
  4581. var call = __webpack_require__(15);
  4582. var aCallable = __webpack_require__(31);
  4583. var anObject = __webpack_require__(20);
  4584. var tryToString = __webpack_require__(78);
  4585. var getIteratorMethod = __webpack_require__(106);
  4586. var $TypeError = TypeError;
  4587. module.exports = function (argument, usingIterator) {
  4588. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  4589. if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
  4590. throw $TypeError(tryToString(argument) + ' is not iterable');
  4591. };
  4592. /***/ }),
  4593. /* 168 */
  4594. /***/ (function(module, exports, __webpack_require__) {
  4595. var call = __webpack_require__(15);
  4596. var anObject = __webpack_require__(20);
  4597. var getMethod = __webpack_require__(122);
  4598. module.exports = function (iterator, kind, value) {
  4599. var innerResult, innerError;
  4600. anObject(iterator);
  4601. try {
  4602. innerResult = getMethod(iterator, 'return');
  4603. if (!innerResult) {
  4604. if (kind === 'throw') throw value;
  4605. return value;
  4606. }
  4607. innerResult = call(innerResult, iterator);
  4608. } catch (error) {
  4609. innerError = true;
  4610. innerResult = error;
  4611. }
  4612. if (kind === 'throw') throw value;
  4613. if (innerError) throw innerResult;
  4614. anObject(innerResult);
  4615. return value;
  4616. };
  4617. /***/ }),
  4618. /* 169 */
  4619. /***/ (function(module, exports) {
  4620. module.exports = function () { /* empty */ };
  4621. /***/ }),
  4622. /* 170 */
  4623. /***/ (function(module, exports, __webpack_require__) {
  4624. var global = __webpack_require__(7);
  4625. var isCallable = __webpack_require__(8);
  4626. var inspectSource = __webpack_require__(130);
  4627. var WeakMap = global.WeakMap;
  4628. module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
  4629. /***/ }),
  4630. /* 171 */
  4631. /***/ (function(module, exports, __webpack_require__) {
  4632. "use strict";
  4633. var fails = __webpack_require__(2);
  4634. var isCallable = __webpack_require__(8);
  4635. var create = __webpack_require__(49);
  4636. var getPrototypeOf = __webpack_require__(100);
  4637. var defineBuiltIn = __webpack_require__(44);
  4638. var wellKnownSymbol = __webpack_require__(9);
  4639. var IS_PURE = __webpack_require__(33);
  4640. var ITERATOR = wellKnownSymbol('iterator');
  4641. var BUGGY_SAFARI_ITERATORS = false;
  4642. // `%IteratorPrototype%` object
  4643. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  4644. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  4645. /* eslint-disable es-x/no-array-prototype-keys -- safe */
  4646. if ([].keys) {
  4647. arrayIterator = [].keys();
  4648. // Safari 8 has buggy iterators w/o `next`
  4649. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  4650. else {
  4651. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  4652. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  4653. }
  4654. }
  4655. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
  4656. var test = {};
  4657. // FF44- legacy iterators case
  4658. return IteratorPrototype[ITERATOR].call(test) !== test;
  4659. });
  4660. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
  4661. else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
  4662. // `%IteratorPrototype%[@@iterator]()` method
  4663. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  4664. if (!isCallable(IteratorPrototype[ITERATOR])) {
  4665. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  4666. return this;
  4667. });
  4668. }
  4669. module.exports = {
  4670. IteratorPrototype: IteratorPrototype,
  4671. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  4672. };
  4673. /***/ }),
  4674. /* 172 */
  4675. /***/ (function(module, exports, __webpack_require__) {
  4676. "use strict";
  4677. var getBuiltIn = __webpack_require__(18);
  4678. var definePropertyModule = __webpack_require__(23);
  4679. var wellKnownSymbol = __webpack_require__(9);
  4680. var DESCRIPTORS = __webpack_require__(14);
  4681. var SPECIES = wellKnownSymbol('species');
  4682. module.exports = function (CONSTRUCTOR_NAME) {
  4683. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  4684. var defineProperty = definePropertyModule.f;
  4685. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  4686. defineProperty(Constructor, SPECIES, {
  4687. configurable: true,
  4688. get: function () { return this; }
  4689. });
  4690. }
  4691. };
  4692. /***/ }),
  4693. /* 173 */
  4694. /***/ (function(module, exports, __webpack_require__) {
  4695. var anObject = __webpack_require__(20);
  4696. var aConstructor = __webpack_require__(174);
  4697. var wellKnownSymbol = __webpack_require__(9);
  4698. var SPECIES = wellKnownSymbol('species');
  4699. // `SpeciesConstructor` abstract operation
  4700. // https://tc39.es/ecma262/#sec-speciesconstructor
  4701. module.exports = function (O, defaultConstructor) {
  4702. var C = anObject(O).constructor;
  4703. var S;
  4704. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
  4705. };
  4706. /***/ }),
  4707. /* 174 */
  4708. /***/ (function(module, exports, __webpack_require__) {
  4709. var isConstructor = __webpack_require__(109);
  4710. var tryToString = __webpack_require__(78);
  4711. var $TypeError = TypeError;
  4712. // `Assert: IsConstructor(argument) is true`
  4713. module.exports = function (argument) {
  4714. if (isConstructor(argument)) return argument;
  4715. throw $TypeError(tryToString(argument) + ' is not a constructor');
  4716. };
  4717. /***/ }),
  4718. /* 175 */
  4719. /***/ (function(module, exports, __webpack_require__) {
  4720. var global = __webpack_require__(7);
  4721. var apply = __webpack_require__(75);
  4722. var bind = __webpack_require__(48);
  4723. var isCallable = __webpack_require__(8);
  4724. var hasOwn = __webpack_require__(13);
  4725. var fails = __webpack_require__(2);
  4726. var html = __webpack_require__(165);
  4727. var arraySlice = __webpack_require__(110);
  4728. var createElement = __webpack_require__(124);
  4729. var validateArgumentsLength = __webpack_require__(301);
  4730. var IS_IOS = __webpack_require__(176);
  4731. var IS_NODE = __webpack_require__(107);
  4732. var set = global.setImmediate;
  4733. var clear = global.clearImmediate;
  4734. var process = global.process;
  4735. var Dispatch = global.Dispatch;
  4736. var Function = global.Function;
  4737. var MessageChannel = global.MessageChannel;
  4738. var String = global.String;
  4739. var counter = 0;
  4740. var queue = {};
  4741. var ONREADYSTATECHANGE = 'onreadystatechange';
  4742. var location, defer, channel, port;
  4743. try {
  4744. // Deno throws a ReferenceError on `location` access without `--location` flag
  4745. location = global.location;
  4746. } catch (error) { /* empty */ }
  4747. var run = function (id) {
  4748. if (hasOwn(queue, id)) {
  4749. var fn = queue[id];
  4750. delete queue[id];
  4751. fn();
  4752. }
  4753. };
  4754. var runner = function (id) {
  4755. return function () {
  4756. run(id);
  4757. };
  4758. };
  4759. var listener = function (event) {
  4760. run(event.data);
  4761. };
  4762. var post = function (id) {
  4763. // old engines have not location.origin
  4764. global.postMessage(String(id), location.protocol + '//' + location.host);
  4765. };
  4766. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  4767. if (!set || !clear) {
  4768. set = function setImmediate(handler) {
  4769. validateArgumentsLength(arguments.length, 1);
  4770. var fn = isCallable(handler) ? handler : Function(handler);
  4771. var args = arraySlice(arguments, 1);
  4772. queue[++counter] = function () {
  4773. apply(fn, undefined, args);
  4774. };
  4775. defer(counter);
  4776. return counter;
  4777. };
  4778. clear = function clearImmediate(id) {
  4779. delete queue[id];
  4780. };
  4781. // Node.js 0.8-
  4782. if (IS_NODE) {
  4783. defer = function (id) {
  4784. process.nextTick(runner(id));
  4785. };
  4786. // Sphere (JS game engine) Dispatch API
  4787. } else if (Dispatch && Dispatch.now) {
  4788. defer = function (id) {
  4789. Dispatch.now(runner(id));
  4790. };
  4791. // Browsers with MessageChannel, includes WebWorkers
  4792. // except iOS - https://github.com/zloirock/core-js/issues/624
  4793. } else if (MessageChannel && !IS_IOS) {
  4794. channel = new MessageChannel();
  4795. port = channel.port2;
  4796. channel.port1.onmessage = listener;
  4797. defer = bind(port.postMessage, port);
  4798. // Browsers with postMessage, skip WebWorkers
  4799. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  4800. } else if (
  4801. global.addEventListener &&
  4802. isCallable(global.postMessage) &&
  4803. !global.importScripts &&
  4804. location && location.protocol !== 'file:' &&
  4805. !fails(post)
  4806. ) {
  4807. defer = post;
  4808. global.addEventListener('message', listener, false);
  4809. // IE8-
  4810. } else if (ONREADYSTATECHANGE in createElement('script')) {
  4811. defer = function (id) {
  4812. html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
  4813. html.removeChild(this);
  4814. run(id);
  4815. };
  4816. };
  4817. // Rest old browsers
  4818. } else {
  4819. defer = function (id) {
  4820. setTimeout(runner(id), 0);
  4821. };
  4822. }
  4823. }
  4824. module.exports = {
  4825. set: set,
  4826. clear: clear
  4827. };
  4828. /***/ }),
  4829. /* 176 */
  4830. /***/ (function(module, exports, __webpack_require__) {
  4831. var userAgent = __webpack_require__(98);
  4832. module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
  4833. /***/ }),
  4834. /* 177 */
  4835. /***/ (function(module, exports, __webpack_require__) {
  4836. var NativePromiseConstructor = __webpack_require__(65);
  4837. var checkCorrectnessOfIteration = __webpack_require__(178);
  4838. var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
  4839. module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
  4840. NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
  4841. });
  4842. /***/ }),
  4843. /* 178 */
  4844. /***/ (function(module, exports, __webpack_require__) {
  4845. var wellKnownSymbol = __webpack_require__(9);
  4846. var ITERATOR = wellKnownSymbol('iterator');
  4847. var SAFE_CLOSING = false;
  4848. try {
  4849. var called = 0;
  4850. var iteratorWithReturn = {
  4851. next: function () {
  4852. return { done: !!called++ };
  4853. },
  4854. 'return': function () {
  4855. SAFE_CLOSING = true;
  4856. }
  4857. };
  4858. iteratorWithReturn[ITERATOR] = function () {
  4859. return this;
  4860. };
  4861. // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
  4862. Array.from(iteratorWithReturn, function () { throw 2; });
  4863. } catch (error) { /* empty */ }
  4864. module.exports = function (exec, SKIP_CLOSING) {
  4865. if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  4866. var ITERATION_SUPPORT = false;
  4867. try {
  4868. var object = {};
  4869. object[ITERATOR] = function () {
  4870. return {
  4871. next: function () {
  4872. return { done: ITERATION_SUPPORT = true };
  4873. }
  4874. };
  4875. };
  4876. exec(object);
  4877. } catch (error) { /* empty */ }
  4878. return ITERATION_SUPPORT;
  4879. };
  4880. /***/ }),
  4881. /* 179 */
  4882. /***/ (function(module, exports, __webpack_require__) {
  4883. var anObject = __webpack_require__(20);
  4884. var isObject = __webpack_require__(11);
  4885. var newPromiseCapability = __webpack_require__(54);
  4886. module.exports = function (C, x) {
  4887. anObject(C);
  4888. if (isObject(x) && x.constructor === C) return x;
  4889. var promiseCapability = newPromiseCapability.f(C);
  4890. var resolve = promiseCapability.resolve;
  4891. resolve(x);
  4892. return promiseCapability.promise;
  4893. };
  4894. /***/ }),
  4895. /* 180 */
  4896. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4897. "use strict";
  4898. /* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
  4899. // Is a given variable undefined?
  4900. function isUndefined(obj) {
  4901. return obj === void 0;
  4902. }
  4903. /***/ }),
  4904. /* 181 */
  4905. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4906. "use strict";
  4907. /* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
  4908. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  4909. // Is a given value a boolean?
  4910. function isBoolean(obj) {
  4911. return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
  4912. }
  4913. /***/ }),
  4914. /* 182 */
  4915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4916. "use strict";
  4917. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  4918. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
  4919. /***/ }),
  4920. /* 183 */
  4921. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4922. "use strict";
  4923. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  4924. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
  4925. /***/ }),
  4926. /* 184 */
  4927. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4928. "use strict";
  4929. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  4930. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
  4931. /***/ }),
  4932. /* 185 */
  4933. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4934. "use strict";
  4935. /* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
  4936. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  4937. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(182);
  4938. // Is the given value `NaN`?
  4939. function isNaN(obj) {
  4940. return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
  4941. }
  4942. /***/ }),
  4943. /* 186 */
  4944. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4945. "use strict";
  4946. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  4947. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(134);
  4948. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(187);
  4949. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(326);
  4950. // Is a given value a typed array?
  4951. var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
  4952. function isTypedArray(obj) {
  4953. // `ArrayBuffer.isView` is the most future-proof, so use it when available.
  4954. // Otherwise, fall back on the above regular expression.
  4955. return __WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */] ? (Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */])(obj) && !Object(__WEBPACK_IMPORTED_MODULE_1__isDataView_js__["a" /* default */])(obj)) :
  4956. Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
  4957. }
  4958. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["r" /* supportsArrayBuffer */] ? isTypedArray : Object(__WEBPACK_IMPORTED_MODULE_2__constant_js__["a" /* default */])(false));
  4959. /***/ }),
  4960. /* 187 */
  4961. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4962. "use strict";
  4963. /* harmony export (immutable) */ __webpack_exports__["a"] = constant;
  4964. // Predicate-generating function. Often useful outside of Underscore.
  4965. function constant(value) {
  4966. return function() {
  4967. return value;
  4968. };
  4969. }
  4970. /***/ }),
  4971. /* 188 */
  4972. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4973. "use strict";
  4974. /* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
  4975. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  4976. // Common internal logic for `isArrayLike` and `isBufferLike`.
  4977. function createSizePropertyCheck(getSizeProperty) {
  4978. return function(collection) {
  4979. var sizeProperty = getSizeProperty(collection);
  4980. return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
  4981. }
  4982. }
  4983. /***/ }),
  4984. /* 189 */
  4985. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4986. "use strict";
  4987. /* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
  4988. // Internal helper to generate a function to obtain property `key` from `obj`.
  4989. function shallowProperty(key) {
  4990. return function(obj) {
  4991. return obj == null ? void 0 : obj[key];
  4992. };
  4993. }
  4994. /***/ }),
  4995. /* 190 */
  4996. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4997. "use strict";
  4998. /* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
  4999. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  5000. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  5001. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
  5002. // Internal helper to create a simple lookup structure.
  5003. // `collectNonEnumProps` used to depend on `_.contains`, but this led to
  5004. // circular imports. `emulatedSet` is a one-off solution that only works for
  5005. // arrays of strings.
  5006. function emulatedSet(keys) {
  5007. var hash = {};
  5008. for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
  5009. return {
  5010. contains: function(key) { return hash[key]; },
  5011. push: function(key) {
  5012. hash[key] = true;
  5013. return keys.push(key);
  5014. }
  5015. };
  5016. }
  5017. // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
  5018. // be iterated by `for key in ...` and thus missed. Extends `keys` in place if
  5019. // needed.
  5020. function collectNonEnumProps(obj, keys) {
  5021. keys = emulatedSet(keys);
  5022. var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
  5023. var constructor = obj.constructor;
  5024. var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
  5025. // Constructor is a special case.
  5026. var prop = 'constructor';
  5027. if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
  5028. while (nonEnumIdx--) {
  5029. prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
  5030. if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
  5031. keys.push(prop);
  5032. }
  5033. }
  5034. }
  5035. /***/ }),
  5036. /* 191 */
  5037. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5038. "use strict";
  5039. /* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
  5040. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
  5041. // Returns whether an object has a given set of `key:value` pairs.
  5042. function isMatch(object, attrs) {
  5043. var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
  5044. if (object == null) return !length;
  5045. var obj = Object(object);
  5046. for (var i = 0; i < length; i++) {
  5047. var key = _keys[i];
  5048. if (attrs[key] !== obj[key] || !(key in obj)) return false;
  5049. }
  5050. return true;
  5051. }
  5052. /***/ }),
  5053. /* 192 */
  5054. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5055. "use strict";
  5056. /* harmony export (immutable) */ __webpack_exports__["a"] = invert;
  5057. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
  5058. // Invert the keys and values of an object. The values must be serializable.
  5059. function invert(obj) {
  5060. var result = {};
  5061. var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
  5062. for (var i = 0, length = _keys.length; i < length; i++) {
  5063. result[obj[_keys[i]]] = _keys[i];
  5064. }
  5065. return result;
  5066. }
  5067. /***/ }),
  5068. /* 193 */
  5069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5070. "use strict";
  5071. /* harmony export (immutable) */ __webpack_exports__["a"] = functions;
  5072. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
  5073. // Return a sorted list of the function names available on the object.
  5074. function functions(obj) {
  5075. var names = [];
  5076. for (var key in obj) {
  5077. if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
  5078. }
  5079. return names.sort();
  5080. }
  5081. /***/ }),
  5082. /* 194 */
  5083. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5084. "use strict";
  5085. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
  5086. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
  5087. // Extend a given object with all the properties in passed-in object(s).
  5088. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
  5089. /***/ }),
  5090. /* 195 */
  5091. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5092. "use strict";
  5093. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
  5094. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
  5095. // Fill in a given object with default properties.
  5096. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
  5097. /***/ }),
  5098. /* 196 */
  5099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5100. "use strict";
  5101. /* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
  5102. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
  5103. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  5104. // Create a naked function reference for surrogate-prototype-swapping.
  5105. function ctor() {
  5106. return function(){};
  5107. }
  5108. // An internal function for creating a new object that inherits from another.
  5109. function baseCreate(prototype) {
  5110. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
  5111. if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
  5112. var Ctor = ctor();
  5113. Ctor.prototype = prototype;
  5114. var result = new Ctor;
  5115. Ctor.prototype = null;
  5116. return result;
  5117. }
  5118. /***/ }),
  5119. /* 197 */
  5120. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5121. "use strict";
  5122. /* harmony export (immutable) */ __webpack_exports__["a"] = clone;
  5123. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
  5124. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
  5125. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(194);
  5126. // Create a (shallow-cloned) duplicate of an object.
  5127. function clone(obj) {
  5128. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
  5129. return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
  5130. }
  5131. /***/ }),
  5132. /* 198 */
  5133. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5134. "use strict";
  5135. /* harmony export (immutable) */ __webpack_exports__["a"] = get;
  5136. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(86);
  5137. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(140);
  5138. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(180);
  5139. // Get the value of the (deep) property on `path` from `object`.
  5140. // If any property in `path` does not exist or if the value is
  5141. // `undefined`, return `defaultValue` instead.
  5142. // The `path` is normalized through `_.toPath`.
  5143. function get(object, path, defaultValue) {
  5144. var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
  5145. return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
  5146. }
  5147. /***/ }),
  5148. /* 199 */
  5149. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5150. "use strict";
  5151. /* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
  5152. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  5153. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
  5154. // Normalize a (deep) property `path` to array.
  5155. // Like `_.iteratee`, this function can be customized.
  5156. function toPath(path) {
  5157. return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
  5158. }
  5159. __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
  5160. /***/ }),
  5161. /* 200 */
  5162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5163. "use strict";
  5164. /* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
  5165. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(141);
  5166. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  5167. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
  5168. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(57);
  5169. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(111);
  5170. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(142);
  5171. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(87);
  5172. // An internal function to generate callbacks that can be applied to each
  5173. // element in a collection, returning the desired result — either `_.identity`,
  5174. // an arbitrary callback, a property matcher, or a property accessor.
  5175. function baseIteratee(value, context, argCount) {
  5176. if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
  5177. if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
  5178. if (Object(__WEBPACK_IMPORTED_MODULE_2__isObject_js__["a" /* default */])(value) && !Object(__WEBPACK_IMPORTED_MODULE_3__isArray_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_4__matcher_js__["a" /* default */])(value);
  5179. return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
  5180. }
  5181. /***/ }),
  5182. /* 201 */
  5183. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5184. "use strict";
  5185. /* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
  5186. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  5187. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
  5188. // External wrapper for our callback generator. Users may customize
  5189. // `_.iteratee` if they want additional predicate/iteratee shorthand styles.
  5190. // This abstraction hides the internal-only `argCount` argument.
  5191. function iteratee(value, context) {
  5192. return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
  5193. }
  5194. __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
  5195. /***/ }),
  5196. /* 202 */
  5197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5198. "use strict";
  5199. /* harmony export (immutable) */ __webpack_exports__["a"] = noop;
  5200. // Predicate-generating function. Often useful outside of Underscore.
  5201. function noop(){}
  5202. /***/ }),
  5203. /* 203 */
  5204. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5205. "use strict";
  5206. /* harmony export (immutable) */ __webpack_exports__["a"] = random;
  5207. // Return a random integer between `min` and `max` (inclusive).
  5208. function random(min, max) {
  5209. if (max == null) {
  5210. max = min;
  5211. min = 0;
  5212. }
  5213. return min + Math.floor(Math.random() * (max - min + 1));
  5214. }
  5215. /***/ }),
  5216. /* 204 */
  5217. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5218. "use strict";
  5219. /* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
  5220. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
  5221. // Internal helper to generate functions for escaping and unescaping strings
  5222. // to/from HTML interpolation.
  5223. function createEscaper(map) {
  5224. var escaper = function(match) {
  5225. return map[match];
  5226. };
  5227. // Regexes for identifying a key that needs to be escaped.
  5228. var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
  5229. var testRegexp = RegExp(source);
  5230. var replaceRegexp = RegExp(source, 'g');
  5231. return function(string) {
  5232. string = string == null ? '' : '' + string;
  5233. return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
  5234. };
  5235. }
  5236. /***/ }),
  5237. /* 205 */
  5238. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5239. "use strict";
  5240. // Internal list of HTML entities for escaping.
  5241. /* harmony default export */ __webpack_exports__["a"] = ({
  5242. '&': '&amp;',
  5243. '<': '&lt;',
  5244. '>': '&gt;',
  5245. '"': '&quot;',
  5246. "'": '&#x27;',
  5247. '`': '&#x60;'
  5248. });
  5249. /***/ }),
  5250. /* 206 */
  5251. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5252. "use strict";
  5253. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  5254. // By default, Underscore uses ERB-style template delimiters. Change the
  5255. // following template settings to use alternative delimiters.
  5256. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
  5257. evaluate: /<%([\s\S]+?)%>/g,
  5258. interpolate: /<%=([\s\S]+?)%>/g,
  5259. escape: /<%-([\s\S]+?)%>/g
  5260. });
  5261. /***/ }),
  5262. /* 207 */
  5263. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5264. "use strict";
  5265. /* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
  5266. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
  5267. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(56);
  5268. // Internal function to execute `sourceFunc` bound to `context` with optional
  5269. // `args`. Determines whether to execute a function as a constructor or as a
  5270. // normal function.
  5271. function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
  5272. if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
  5273. var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
  5274. var result = sourceFunc.apply(self, args);
  5275. if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
  5276. return self;
  5277. }
  5278. /***/ }),
  5279. /* 208 */
  5280. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5281. "use strict";
  5282. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  5283. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  5284. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(207);
  5285. // Create a function bound to a given object (assigning `this`, and arguments,
  5286. // optionally).
  5287. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
  5288. if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
  5289. var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
  5290. return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
  5291. });
  5292. return bound;
  5293. }));
  5294. /***/ }),
  5295. /* 209 */
  5296. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5297. "use strict";
  5298. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  5299. // Delays a function for the given number of milliseconds, and then calls
  5300. // it with the arguments supplied.
  5301. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
  5302. return setTimeout(function() {
  5303. return func.apply(null, args);
  5304. }, wait);
  5305. }));
  5306. /***/ }),
  5307. /* 210 */
  5308. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5309. "use strict";
  5310. /* harmony export (immutable) */ __webpack_exports__["a"] = before;
  5311. // Returns a function that will only be executed up to (but not including) the
  5312. // Nth call.
  5313. function before(times, func) {
  5314. var memo;
  5315. return function() {
  5316. if (--times > 0) {
  5317. memo = func.apply(this, arguments);
  5318. }
  5319. if (times <= 1) func = null;
  5320. return memo;
  5321. };
  5322. }
  5323. /***/ }),
  5324. /* 211 */
  5325. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5326. "use strict";
  5327. /* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
  5328. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  5329. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
  5330. // Returns the first key on an object that passes a truth test.
  5331. function findKey(obj, predicate, context) {
  5332. predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
  5333. var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
  5334. for (var i = 0, length = _keys.length; i < length; i++) {
  5335. key = _keys[i];
  5336. if (predicate(obj[key], key, obj)) return key;
  5337. }
  5338. }
  5339. /***/ }),
  5340. /* 212 */
  5341. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5342. "use strict";
  5343. /* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
  5344. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  5345. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
  5346. // Internal function to generate `_.findIndex` and `_.findLastIndex`.
  5347. function createPredicateIndexFinder(dir) {
  5348. return function(array, predicate, context) {
  5349. predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
  5350. var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
  5351. var index = dir > 0 ? 0 : length - 1;
  5352. for (; index >= 0 && index < length; index += dir) {
  5353. if (predicate(array[index], index, array)) return index;
  5354. }
  5355. return -1;
  5356. };
  5357. }
  5358. /***/ }),
  5359. /* 213 */
  5360. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5361. "use strict";
  5362. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
  5363. // Returns the last index on an array-like that passes a truth test.
  5364. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
  5365. /***/ }),
  5366. /* 214 */
  5367. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5368. "use strict";
  5369. /* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
  5370. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  5371. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
  5372. // Use a comparator function to figure out the smallest index at which
  5373. // an object should be inserted so as to maintain order. Uses binary search.
  5374. function sortedIndex(array, obj, iteratee, context) {
  5375. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
  5376. var value = iteratee(obj);
  5377. var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
  5378. while (low < high) {
  5379. var mid = Math.floor((low + high) / 2);
  5380. if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
  5381. }
  5382. return low;
  5383. }
  5384. /***/ }),
  5385. /* 215 */
  5386. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5387. "use strict";
  5388. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(214);
  5389. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145);
  5390. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(216);
  5391. // Return the position of the first occurrence of an item in an array,
  5392. // or -1 if the item is not included in the array.
  5393. // If the array is large and already in sort order, pass `true`
  5394. // for **isSorted** to use binary search.
  5395. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__["a" /* default */])(1, __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__["a" /* default */]));
  5396. /***/ }),
  5397. /* 216 */
  5398. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5399. "use strict";
  5400. /* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
  5401. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
  5402. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  5403. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(185);
  5404. // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
  5405. function createIndexFinder(dir, predicateFind, sortedIndex) {
  5406. return function(array, item, idx) {
  5407. var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
  5408. if (typeof idx == 'number') {
  5409. if (dir > 0) {
  5410. i = idx >= 0 ? idx : Math.max(idx + length, i);
  5411. } else {
  5412. length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
  5413. }
  5414. } else if (sortedIndex && idx && length) {
  5415. idx = sortedIndex(array, item);
  5416. return array[idx] === item ? idx : -1;
  5417. }
  5418. if (item !== item) {
  5419. idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
  5420. return idx >= 0 ? idx + i : -1;
  5421. }
  5422. for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
  5423. if (array[idx] === item) return idx;
  5424. }
  5425. return -1;
  5426. };
  5427. }
  5428. /***/ }),
  5429. /* 217 */
  5430. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5431. "use strict";
  5432. /* harmony export (immutable) */ __webpack_exports__["a"] = find;
  5433. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  5434. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145);
  5435. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(211);
  5436. // Return the first value which passes a truth test.
  5437. function find(obj, predicate, context) {
  5438. var keyFinder = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_2__findKey_js__["a" /* default */];
  5439. var key = keyFinder(obj, predicate, context);
  5440. if (key !== void 0 && key !== -1) return obj[key];
  5441. }
  5442. /***/ }),
  5443. /* 218 */
  5444. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5445. "use strict";
  5446. /* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
  5447. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  5448. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
  5449. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
  5450. // Internal helper to create a reducing function, iterating left or right.
  5451. function createReduce(dir) {
  5452. // Wrap code that reassigns argument variables in a separate function than
  5453. // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
  5454. var reducer = function(obj, iteratee, memo, initial) {
  5455. var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
  5456. length = (_keys || obj).length,
  5457. index = dir > 0 ? 0 : length - 1;
  5458. if (!initial) {
  5459. memo = obj[_keys ? _keys[index] : index];
  5460. index += dir;
  5461. }
  5462. for (; index >= 0 && index < length; index += dir) {
  5463. var currentKey = _keys ? _keys[index] : index;
  5464. memo = iteratee(memo, obj[currentKey], currentKey, obj);
  5465. }
  5466. return memo;
  5467. };
  5468. return function(obj, iteratee, memo, context) {
  5469. var initial = arguments.length >= 3;
  5470. return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
  5471. };
  5472. }
  5473. /***/ }),
  5474. /* 219 */
  5475. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5476. "use strict";
  5477. /* harmony export (immutable) */ __webpack_exports__["a"] = max;
  5478. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  5479. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
  5480. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
  5481. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
  5482. // Return the maximum element (or element-based computation).
  5483. function max(obj, iteratee, context) {
  5484. var result = -Infinity, lastComputed = -Infinity,
  5485. value, computed;
  5486. if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
  5487. obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
  5488. for (var i = 0, length = obj.length; i < length; i++) {
  5489. value = obj[i];
  5490. if (value != null && value > result) {
  5491. result = value;
  5492. }
  5493. }
  5494. } else {
  5495. iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
  5496. Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
  5497. computed = iteratee(v, index, list);
  5498. if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
  5499. result = v;
  5500. lastComputed = computed;
  5501. }
  5502. });
  5503. }
  5504. return result;
  5505. }
  5506. /***/ }),
  5507. /* 220 */
  5508. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5509. "use strict";
  5510. /* harmony export (immutable) */ __webpack_exports__["a"] = sample;
  5511. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  5512. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(197);
  5513. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(66);
  5514. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(29);
  5515. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(203);
  5516. // Sample **n** random values from a collection using the modern version of the
  5517. // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
  5518. // If **n** is not specified, returns a single random element.
  5519. // The internal `guard` argument allows it to work with `_.map`.
  5520. function sample(obj, n, guard) {
  5521. if (n == null || guard) {
  5522. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
  5523. return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
  5524. }
  5525. var sample = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? Object(__WEBPACK_IMPORTED_MODULE_1__clone_js__["a" /* default */])(obj) : Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
  5526. var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
  5527. n = Math.max(Math.min(n, length), 0);
  5528. var last = length - 1;
  5529. for (var index = 0; index < n; index++) {
  5530. var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
  5531. var temp = sample[index];
  5532. sample[index] = sample[rand];
  5533. sample[rand] = temp;
  5534. }
  5535. return sample.slice(0, n);
  5536. }
  5537. /***/ }),
  5538. /* 221 */
  5539. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5540. "use strict";
  5541. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  5542. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  5543. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
  5544. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(85);
  5545. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(375);
  5546. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(67);
  5547. // Return a copy of the object only containing the allowed properties.
  5548. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
  5549. var result = {}, iteratee = keys[0];
  5550. if (obj == null) return result;
  5551. if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
  5552. if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
  5553. keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
  5554. } else {
  5555. iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
  5556. keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
  5557. obj = Object(obj);
  5558. }
  5559. for (var i = 0, length = keys.length; i < length; i++) {
  5560. var key = keys[i];
  5561. var value = obj[key];
  5562. if (iteratee(value, key, obj)) result[key] = value;
  5563. }
  5564. return result;
  5565. }));
  5566. /***/ }),
  5567. /* 222 */
  5568. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5569. "use strict";
  5570. /* harmony export (immutable) */ __webpack_exports__["a"] = initial;
  5571. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  5572. // Returns everything but the last entry of the array. Especially useful on
  5573. // the arguments object. Passing **n** will return all the values in
  5574. // the array, excluding the last N.
  5575. function initial(array, n, guard) {
  5576. return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
  5577. }
  5578. /***/ }),
  5579. /* 223 */
  5580. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5581. "use strict";
  5582. /* harmony export (immutable) */ __webpack_exports__["a"] = rest;
  5583. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  5584. // Returns everything but the first entry of the `array`. Especially useful on
  5585. // the `arguments` object. Passing an **n** will return the rest N values in the
  5586. // `array`.
  5587. function rest(array, n, guard) {
  5588. return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
  5589. }
  5590. /***/ }),
  5591. /* 224 */
  5592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5593. "use strict";
  5594. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  5595. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
  5596. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(88);
  5597. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
  5598. // Take the difference between one array and a number of other arrays.
  5599. // Only the elements present in just the first array will remain.
  5600. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
  5601. rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
  5602. return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
  5603. return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
  5604. });
  5605. }));
  5606. /***/ }),
  5607. /* 225 */
  5608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5609. "use strict";
  5610. /* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
  5611. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(181);
  5612. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(21);
  5613. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(29);
  5614. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
  5615. // Produce a duplicate-free version of the array. If the array has already
  5616. // been sorted, you have the option of using a faster algorithm.
  5617. // The faster algorithm will not work with an iteratee if the iteratee
  5618. // is not a one-to-one function, so providing an iteratee will disable
  5619. // the faster algorithm.
  5620. function uniq(array, isSorted, iteratee, context) {
  5621. if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
  5622. context = iteratee;
  5623. iteratee = isSorted;
  5624. isSorted = false;
  5625. }
  5626. if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
  5627. var result = [];
  5628. var seen = [];
  5629. for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
  5630. var value = array[i],
  5631. computed = iteratee ? iteratee(value, i, array) : value;
  5632. if (isSorted && !iteratee) {
  5633. if (!i || seen !== computed) result.push(value);
  5634. seen = computed;
  5635. } else if (iteratee) {
  5636. if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
  5637. seen.push(computed);
  5638. result.push(value);
  5639. }
  5640. } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
  5641. result.push(value);
  5642. }
  5643. }
  5644. return result;
  5645. }
  5646. /***/ }),
  5647. /* 226 */
  5648. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5649. "use strict";
  5650. /* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
  5651. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(219);
  5652. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
  5653. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(146);
  5654. // Complement of zip. Unzip accepts an array of arrays and groups
  5655. // each array's elements on shared indices.
  5656. function unzip(array) {
  5657. var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
  5658. var result = Array(length);
  5659. for (var index = 0; index < length; index++) {
  5660. result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
  5661. }
  5662. return result;
  5663. }
  5664. /***/ }),
  5665. /* 227 */
  5666. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5667. "use strict";
  5668. /* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
  5669. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  5670. // Helper function to continue chaining intermediate results.
  5671. function chainResult(instance, obj) {
  5672. return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
  5673. }
  5674. /***/ }),
  5675. /* 228 */
  5676. /***/ (function(module, exports, __webpack_require__) {
  5677. "use strict";
  5678. var $ = __webpack_require__(0);
  5679. var fails = __webpack_require__(2);
  5680. var isArray = __webpack_require__(90);
  5681. var isObject = __webpack_require__(11);
  5682. var toObject = __webpack_require__(34);
  5683. var lengthOfArrayLike = __webpack_require__(41);
  5684. var doesNotExceedSafeInteger = __webpack_require__(393);
  5685. var createProperty = __webpack_require__(91);
  5686. var arraySpeciesCreate = __webpack_require__(229);
  5687. var arrayMethodHasSpeciesSupport = __webpack_require__(114);
  5688. var wellKnownSymbol = __webpack_require__(9);
  5689. var V8_VERSION = __webpack_require__(77);
  5690. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  5691. // We can't use this feature detection in V8 since it causes
  5692. // deoptimization and serious performance degradation
  5693. // https://github.com/zloirock/core-js/issues/679
  5694. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  5695. var array = [];
  5696. array[IS_CONCAT_SPREADABLE] = false;
  5697. return array.concat()[0] !== array;
  5698. });
  5699. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  5700. var isConcatSpreadable = function (O) {
  5701. if (!isObject(O)) return false;
  5702. var spreadable = O[IS_CONCAT_SPREADABLE];
  5703. return spreadable !== undefined ? !!spreadable : isArray(O);
  5704. };
  5705. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  5706. // `Array.prototype.concat` method
  5707. // https://tc39.es/ecma262/#sec-array.prototype.concat
  5708. // with adding support of @@isConcatSpreadable and @@species
  5709. $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
  5710. // eslint-disable-next-line no-unused-vars -- required for `.length`
  5711. concat: function concat(arg) {
  5712. var O = toObject(this);
  5713. var A = arraySpeciesCreate(O, 0);
  5714. var n = 0;
  5715. var i, k, length, len, E;
  5716. for (i = -1, length = arguments.length; i < length; i++) {
  5717. E = i === -1 ? O : arguments[i];
  5718. if (isConcatSpreadable(E)) {
  5719. len = lengthOfArrayLike(E);
  5720. doesNotExceedSafeInteger(n + len);
  5721. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  5722. } else {
  5723. doesNotExceedSafeInteger(n + 1);
  5724. createProperty(A, n++, E);
  5725. }
  5726. }
  5727. A.length = n;
  5728. return A;
  5729. }
  5730. });
  5731. /***/ }),
  5732. /* 229 */
  5733. /***/ (function(module, exports, __webpack_require__) {
  5734. var arraySpeciesConstructor = __webpack_require__(394);
  5735. // `ArraySpeciesCreate` abstract operation
  5736. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  5737. module.exports = function (originalArray, length) {
  5738. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  5739. };
  5740. /***/ }),
  5741. /* 230 */
  5742. /***/ (function(module, exports, __webpack_require__) {
  5743. var $ = __webpack_require__(0);
  5744. var getBuiltIn = __webpack_require__(18);
  5745. var apply = __webpack_require__(75);
  5746. var call = __webpack_require__(15);
  5747. var uncurryThis = __webpack_require__(4);
  5748. var fails = __webpack_require__(2);
  5749. var isArray = __webpack_require__(90);
  5750. var isCallable = __webpack_require__(8);
  5751. var isObject = __webpack_require__(11);
  5752. var isSymbol = __webpack_require__(97);
  5753. var arraySlice = __webpack_require__(110);
  5754. var NATIVE_SYMBOL = __webpack_require__(64);
  5755. var $stringify = getBuiltIn('JSON', 'stringify');
  5756. var exec = uncurryThis(/./.exec);
  5757. var charAt = uncurryThis(''.charAt);
  5758. var charCodeAt = uncurryThis(''.charCodeAt);
  5759. var replace = uncurryThis(''.replace);
  5760. var numberToString = uncurryThis(1.0.toString);
  5761. var tester = /[\uD800-\uDFFF]/g;
  5762. var low = /^[\uD800-\uDBFF]$/;
  5763. var hi = /^[\uDC00-\uDFFF]$/;
  5764. var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
  5765. var symbol = getBuiltIn('Symbol')();
  5766. // MS Edge converts symbol values to JSON as {}
  5767. return $stringify([symbol]) != '[null]'
  5768. // WebKit converts symbol values to JSON as null
  5769. || $stringify({ a: symbol }) != '{}'
  5770. // V8 throws on boxed symbols
  5771. || $stringify(Object(symbol)) != '{}';
  5772. });
  5773. // https://github.com/tc39/proposal-well-formed-stringify
  5774. var ILL_FORMED_UNICODE = fails(function () {
  5775. return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
  5776. || $stringify('\uDEAD') !== '"\\udead"';
  5777. });
  5778. var stringifyWithSymbolsFix = function (it, replacer) {
  5779. var args = arraySlice(arguments);
  5780. var $replacer = replacer;
  5781. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  5782. if (!isArray(replacer)) replacer = function (key, value) {
  5783. if (isCallable($replacer)) value = call($replacer, this, key, value);
  5784. if (!isSymbol(value)) return value;
  5785. };
  5786. args[1] = replacer;
  5787. return apply($stringify, null, args);
  5788. };
  5789. var fixIllFormed = function (match, offset, string) {
  5790. var prev = charAt(string, offset - 1);
  5791. var next = charAt(string, offset + 1);
  5792. if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
  5793. return '\\u' + numberToString(charCodeAt(match, 0), 16);
  5794. } return match;
  5795. };
  5796. if ($stringify) {
  5797. // `JSON.stringify` method
  5798. // https://tc39.es/ecma262/#sec-json.stringify
  5799. $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
  5800. // eslint-disable-next-line no-unused-vars -- required for `.length`
  5801. stringify: function stringify(it, replacer, space) {
  5802. var args = arraySlice(arguments);
  5803. var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
  5804. return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
  5805. }
  5806. });
  5807. }
  5808. /***/ }),
  5809. /* 231 */
  5810. /***/ (function(module, exports, __webpack_require__) {
  5811. "use strict";
  5812. var fails = __webpack_require__(2);
  5813. module.exports = function (METHOD_NAME, argument) {
  5814. var method = [][METHOD_NAME];
  5815. return !!method && fails(function () {
  5816. // eslint-disable-next-line no-useless-call -- required for testing
  5817. method.call(null, argument || function () { return 1; }, 1);
  5818. });
  5819. };
  5820. /***/ }),
  5821. /* 232 */
  5822. /***/ (function(module, exports, __webpack_require__) {
  5823. var rng = __webpack_require__(411);
  5824. var bytesToUuid = __webpack_require__(412);
  5825. function v4(options, buf, offset) {
  5826. var i = buf && offset || 0;
  5827. if (typeof(options) == 'string') {
  5828. buf = options === 'binary' ? new Array(16) : null;
  5829. options = null;
  5830. }
  5831. options = options || {};
  5832. var rnds = options.random || (options.rng || rng)();
  5833. // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  5834. rnds[6] = (rnds[6] & 0x0f) | 0x40;
  5835. rnds[8] = (rnds[8] & 0x3f) | 0x80;
  5836. // Copy bytes to buffer, if provided
  5837. if (buf) {
  5838. for (var ii = 0; ii < 16; ++ii) {
  5839. buf[i + ii] = rnds[ii];
  5840. }
  5841. }
  5842. return buf || bytesToUuid(rnds);
  5843. }
  5844. module.exports = v4;
  5845. /***/ }),
  5846. /* 233 */
  5847. /***/ (function(module, exports, __webpack_require__) {
  5848. var parent = __webpack_require__(415);
  5849. module.exports = parent;
  5850. /***/ }),
  5851. /* 234 */
  5852. /***/ (function(module, exports, __webpack_require__) {
  5853. "use strict";
  5854. module.exports = '4.13.4';
  5855. /***/ }),
  5856. /* 235 */
  5857. /***/ (function(module, exports, __webpack_require__) {
  5858. "use strict";
  5859. var has = Object.prototype.hasOwnProperty
  5860. , prefix = '~';
  5861. /**
  5862. * Constructor to create a storage for our `EE` objects.
  5863. * An `Events` instance is a plain object whose properties are event names.
  5864. *
  5865. * @constructor
  5866. * @api private
  5867. */
  5868. function Events() {}
  5869. //
  5870. // We try to not inherit from `Object.prototype`. In some engines creating an
  5871. // instance in this way is faster than calling `Object.create(null)` directly.
  5872. // If `Object.create(null)` is not supported we prefix the event names with a
  5873. // character to make sure that the built-in object properties are not
  5874. // overridden or used as an attack vector.
  5875. //
  5876. if (Object.create) {
  5877. Events.prototype = Object.create(null);
  5878. //
  5879. // This hack is needed because the `__proto__` property is still inherited in
  5880. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  5881. //
  5882. if (!new Events().__proto__) prefix = false;
  5883. }
  5884. /**
  5885. * Representation of a single event listener.
  5886. *
  5887. * @param {Function} fn The listener function.
  5888. * @param {Mixed} context The context to invoke the listener with.
  5889. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  5890. * @constructor
  5891. * @api private
  5892. */
  5893. function EE(fn, context, once) {
  5894. this.fn = fn;
  5895. this.context = context;
  5896. this.once = once || false;
  5897. }
  5898. /**
  5899. * Minimal `EventEmitter` interface that is molded against the Node.js
  5900. * `EventEmitter` interface.
  5901. *
  5902. * @constructor
  5903. * @api public
  5904. */
  5905. function EventEmitter() {
  5906. this._events = new Events();
  5907. this._eventsCount = 0;
  5908. }
  5909. /**
  5910. * Return an array listing the events for which the emitter has registered
  5911. * listeners.
  5912. *
  5913. * @returns {Array}
  5914. * @api public
  5915. */
  5916. EventEmitter.prototype.eventNames = function eventNames() {
  5917. var names = []
  5918. , events
  5919. , name;
  5920. if (this._eventsCount === 0) return names;
  5921. for (name in (events = this._events)) {
  5922. if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  5923. }
  5924. if (Object.getOwnPropertySymbols) {
  5925. return names.concat(Object.getOwnPropertySymbols(events));
  5926. }
  5927. return names;
  5928. };
  5929. /**
  5930. * Return the listeners registered for a given event.
  5931. *
  5932. * @param {String|Symbol} event The event name.
  5933. * @param {Boolean} exists Only check if there are listeners.
  5934. * @returns {Array|Boolean}
  5935. * @api public
  5936. */
  5937. EventEmitter.prototype.listeners = function listeners(event, exists) {
  5938. var evt = prefix ? prefix + event : event
  5939. , available = this._events[evt];
  5940. if (exists) return !!available;
  5941. if (!available) return [];
  5942. if (available.fn) return [available.fn];
  5943. for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
  5944. ee[i] = available[i].fn;
  5945. }
  5946. return ee;
  5947. };
  5948. /**
  5949. * Calls each of the listeners registered for a given event.
  5950. *
  5951. * @param {String|Symbol} event The event name.
  5952. * @returns {Boolean} `true` if the event had listeners, else `false`.
  5953. * @api public
  5954. */
  5955. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  5956. var evt = prefix ? prefix + event : event;
  5957. if (!this._events[evt]) return false;
  5958. var listeners = this._events[evt]
  5959. , len = arguments.length
  5960. , args
  5961. , i;
  5962. if (listeners.fn) {
  5963. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  5964. switch (len) {
  5965. case 1: return listeners.fn.call(listeners.context), true;
  5966. case 2: return listeners.fn.call(listeners.context, a1), true;
  5967. case 3: return listeners.fn.call(listeners.context, a1, a2), true;
  5968. case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
  5969. case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  5970. case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  5971. }
  5972. for (i = 1, args = new Array(len -1); i < len; i++) {
  5973. args[i - 1] = arguments[i];
  5974. }
  5975. listeners.fn.apply(listeners.context, args);
  5976. } else {
  5977. var length = listeners.length
  5978. , j;
  5979. for (i = 0; i < length; i++) {
  5980. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  5981. switch (len) {
  5982. case 1: listeners[i].fn.call(listeners[i].context); break;
  5983. case 2: listeners[i].fn.call(listeners[i].context, a1); break;
  5984. case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
  5985. case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
  5986. default:
  5987. if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
  5988. args[j - 1] = arguments[j];
  5989. }
  5990. listeners[i].fn.apply(listeners[i].context, args);
  5991. }
  5992. }
  5993. }
  5994. return true;
  5995. };
  5996. /**
  5997. * Add a listener for a given event.
  5998. *
  5999. * @param {String|Symbol} event The event name.
  6000. * @param {Function} fn The listener function.
  6001. * @param {Mixed} [context=this] The context to invoke the listener with.
  6002. * @returns {EventEmitter} `this`.
  6003. * @api public
  6004. */
  6005. EventEmitter.prototype.on = function on(event, fn, context) {
  6006. var listener = new EE(fn, context || this)
  6007. , evt = prefix ? prefix + event : event;
  6008. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  6009. else if (!this._events[evt].fn) this._events[evt].push(listener);
  6010. else this._events[evt] = [this._events[evt], listener];
  6011. return this;
  6012. };
  6013. /**
  6014. * Add a one-time listener for a given event.
  6015. *
  6016. * @param {String|Symbol} event The event name.
  6017. * @param {Function} fn The listener function.
  6018. * @param {Mixed} [context=this] The context to invoke the listener with.
  6019. * @returns {EventEmitter} `this`.
  6020. * @api public
  6021. */
  6022. EventEmitter.prototype.once = function once(event, fn, context) {
  6023. var listener = new EE(fn, context || this, true)
  6024. , evt = prefix ? prefix + event : event;
  6025. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  6026. else if (!this._events[evt].fn) this._events[evt].push(listener);
  6027. else this._events[evt] = [this._events[evt], listener];
  6028. return this;
  6029. };
  6030. /**
  6031. * Remove the listeners of a given event.
  6032. *
  6033. * @param {String|Symbol} event The event name.
  6034. * @param {Function} fn Only remove the listeners that match this function.
  6035. * @param {Mixed} context Only remove the listeners that have this context.
  6036. * @param {Boolean} once Only remove one-time listeners.
  6037. * @returns {EventEmitter} `this`.
  6038. * @api public
  6039. */
  6040. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  6041. var evt = prefix ? prefix + event : event;
  6042. if (!this._events[evt]) return this;
  6043. if (!fn) {
  6044. if (--this._eventsCount === 0) this._events = new Events();
  6045. else delete this._events[evt];
  6046. return this;
  6047. }
  6048. var listeners = this._events[evt];
  6049. if (listeners.fn) {
  6050. if (
  6051. listeners.fn === fn
  6052. && (!once || listeners.once)
  6053. && (!context || listeners.context === context)
  6054. ) {
  6055. if (--this._eventsCount === 0) this._events = new Events();
  6056. else delete this._events[evt];
  6057. }
  6058. } else {
  6059. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  6060. if (
  6061. listeners[i].fn !== fn
  6062. || (once && !listeners[i].once)
  6063. || (context && listeners[i].context !== context)
  6064. ) {
  6065. events.push(listeners[i]);
  6066. }
  6067. }
  6068. //
  6069. // Reset the array, or remove it completely if we have no more listeners.
  6070. //
  6071. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
  6072. else if (--this._eventsCount === 0) this._events = new Events();
  6073. else delete this._events[evt];
  6074. }
  6075. return this;
  6076. };
  6077. /**
  6078. * Remove all listeners, or those of the specified event.
  6079. *
  6080. * @param {String|Symbol} [event] The event name.
  6081. * @returns {EventEmitter} `this`.
  6082. * @api public
  6083. */
  6084. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  6085. var evt;
  6086. if (event) {
  6087. evt = prefix ? prefix + event : event;
  6088. if (this._events[evt]) {
  6089. if (--this._eventsCount === 0) this._events = new Events();
  6090. else delete this._events[evt];
  6091. }
  6092. } else {
  6093. this._events = new Events();
  6094. this._eventsCount = 0;
  6095. }
  6096. return this;
  6097. };
  6098. //
  6099. // Alias methods names because people roll like that.
  6100. //
  6101. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  6102. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  6103. //
  6104. // This function doesn't apply anymore.
  6105. //
  6106. EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
  6107. return this;
  6108. };
  6109. //
  6110. // Expose the prefix.
  6111. //
  6112. EventEmitter.prefixed = prefix;
  6113. //
  6114. // Allow `EventEmitter` to be imported as module namespace.
  6115. //
  6116. EventEmitter.EventEmitter = EventEmitter;
  6117. //
  6118. // Expose the module.
  6119. //
  6120. if (true) {
  6121. module.exports = EventEmitter;
  6122. }
  6123. /***/ }),
  6124. /* 236 */
  6125. /***/ (function(module, exports, __webpack_require__) {
  6126. "use strict";
  6127. var _interopRequireDefault = __webpack_require__(1);
  6128. var _promise = _interopRequireDefault(__webpack_require__(12));
  6129. var _require = __webpack_require__(72),
  6130. getAdapter = _require.getAdapter;
  6131. var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
  6132. var localStorage = {
  6133. get async() {
  6134. return getAdapter('storage').async;
  6135. }
  6136. }; // wrap sync apis with async ones.
  6137. syncApiNames.forEach(function (apiName) {
  6138. localStorage[apiName + 'Async'] = function () {
  6139. var storage = getAdapter('storage');
  6140. return _promise.default.resolve(storage[apiName].apply(storage, arguments));
  6141. };
  6142. localStorage[apiName] = function () {
  6143. var storage = getAdapter('storage');
  6144. if (!storage.async) {
  6145. return storage[apiName].apply(storage, arguments);
  6146. }
  6147. var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
  6148. error.code = 'SYNC_API_NOT_AVAILABLE';
  6149. throw error;
  6150. };
  6151. });
  6152. module.exports = localStorage;
  6153. /***/ }),
  6154. /* 237 */
  6155. /***/ (function(module, exports, __webpack_require__) {
  6156. "use strict";
  6157. var _interopRequireDefault = __webpack_require__(1);
  6158. var _concat = _interopRequireDefault(__webpack_require__(22));
  6159. var _stringify = _interopRequireDefault(__webpack_require__(36));
  6160. var storage = __webpack_require__(236);
  6161. var AV = __webpack_require__(69);
  6162. var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
  6163. var getCacheData = function getCacheData(cacheData, key) {
  6164. try {
  6165. cacheData = JSON.parse(cacheData);
  6166. } catch (e) {
  6167. return null;
  6168. }
  6169. if (cacheData) {
  6170. var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
  6171. if (!expired) {
  6172. return cacheData.value;
  6173. }
  6174. return removeAsync(key).then(function () {
  6175. return null;
  6176. });
  6177. }
  6178. return null;
  6179. };
  6180. exports.getAsync = function (key) {
  6181. var _context;
  6182. key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
  6183. return storage.getItemAsync(key).then(function (cache) {
  6184. return getCacheData(cache, key);
  6185. });
  6186. };
  6187. exports.setAsync = function (key, value, ttl) {
  6188. var _context2;
  6189. var cache = {
  6190. value: value
  6191. };
  6192. if (typeof ttl === 'number') {
  6193. cache.expiredAt = Date.now() + ttl;
  6194. }
  6195. return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
  6196. };
  6197. /***/ }),
  6198. /* 238 */
  6199. /***/ (function(module, exports, __webpack_require__) {
  6200. module.exports = __webpack_require__(239);
  6201. /***/ }),
  6202. /* 239 */
  6203. /***/ (function(module, exports, __webpack_require__) {
  6204. var parent = __webpack_require__(417);
  6205. module.exports = parent;
  6206. /***/ }),
  6207. /* 240 */
  6208. /***/ (function(module, exports, __webpack_require__) {
  6209. var parent = __webpack_require__(420);
  6210. module.exports = parent;
  6211. /***/ }),
  6212. /* 241 */
  6213. /***/ (function(module, exports, __webpack_require__) {
  6214. var parent = __webpack_require__(423);
  6215. module.exports = parent;
  6216. /***/ }),
  6217. /* 242 */
  6218. /***/ (function(module, exports, __webpack_require__) {
  6219. module.exports = __webpack_require__(426);
  6220. /***/ }),
  6221. /* 243 */
  6222. /***/ (function(module, exports, __webpack_require__) {
  6223. var parent = __webpack_require__(429);
  6224. __webpack_require__(39);
  6225. module.exports = parent;
  6226. /***/ }),
  6227. /* 244 */
  6228. /***/ (function(module, exports, __webpack_require__) {
  6229. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  6230. __webpack_require__(430);
  6231. __webpack_require__(432);
  6232. __webpack_require__(433);
  6233. __webpack_require__(230);
  6234. __webpack_require__(434);
  6235. /***/ }),
  6236. /* 245 */
  6237. /***/ (function(module, exports, __webpack_require__) {
  6238. /* eslint-disable es-x/no-object-getownpropertynames -- safe */
  6239. var classof = __webpack_require__(63);
  6240. var toIndexedObject = __webpack_require__(32);
  6241. var $getOwnPropertyNames = __webpack_require__(103).f;
  6242. var arraySlice = __webpack_require__(431);
  6243. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  6244. ? Object.getOwnPropertyNames(window) : [];
  6245. var getWindowNames = function (it) {
  6246. try {
  6247. return $getOwnPropertyNames(it);
  6248. } catch (error) {
  6249. return arraySlice(windowNames);
  6250. }
  6251. };
  6252. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  6253. module.exports.f = function getOwnPropertyNames(it) {
  6254. return windowNames && classof(it) == 'Window'
  6255. ? getWindowNames(it)
  6256. : $getOwnPropertyNames(toIndexedObject(it));
  6257. };
  6258. /***/ }),
  6259. /* 246 */
  6260. /***/ (function(module, exports, __webpack_require__) {
  6261. var call = __webpack_require__(15);
  6262. var getBuiltIn = __webpack_require__(18);
  6263. var wellKnownSymbol = __webpack_require__(9);
  6264. var defineBuiltIn = __webpack_require__(44);
  6265. module.exports = function () {
  6266. var Symbol = getBuiltIn('Symbol');
  6267. var SymbolPrototype = Symbol && Symbol.prototype;
  6268. var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
  6269. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  6270. if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
  6271. // `Symbol.prototype[@@toPrimitive]` method
  6272. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  6273. // eslint-disable-next-line no-unused-vars -- required for .length
  6274. defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
  6275. return call(valueOf, this);
  6276. }, { arity: 1 });
  6277. }
  6278. };
  6279. /***/ }),
  6280. /* 247 */
  6281. /***/ (function(module, exports, __webpack_require__) {
  6282. var NATIVE_SYMBOL = __webpack_require__(64);
  6283. /* eslint-disable es-x/no-symbol -- safe */
  6284. module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
  6285. /***/ }),
  6286. /* 248 */
  6287. /***/ (function(module, exports, __webpack_require__) {
  6288. var defineWellKnownSymbol = __webpack_require__(10);
  6289. // `Symbol.iterator` well-known symbol
  6290. // https://tc39.es/ecma262/#sec-symbol.iterator
  6291. defineWellKnownSymbol('iterator');
  6292. /***/ }),
  6293. /* 249 */
  6294. /***/ (function(module, exports, __webpack_require__) {
  6295. var parent = __webpack_require__(463);
  6296. __webpack_require__(39);
  6297. module.exports = parent;
  6298. /***/ }),
  6299. /* 250 */
  6300. /***/ (function(module, exports, __webpack_require__) {
  6301. module.exports = __webpack_require__(464);
  6302. /***/ }),
  6303. /* 251 */
  6304. /***/ (function(module, exports, __webpack_require__) {
  6305. "use strict";
  6306. // Copyright (c) 2015-2017 David M. Lee, II
  6307. /**
  6308. * Local reference to TimeoutError
  6309. * @private
  6310. */
  6311. var TimeoutError;
  6312. /**
  6313. * Rejects a promise with a {@link TimeoutError} if it does not settle within
  6314. * the specified timeout.
  6315. *
  6316. * @param {Promise} promise The promise.
  6317. * @param {number} timeoutMillis Number of milliseconds to wait on settling.
  6318. * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
  6319. * `TimeoutError`, whichever settles first.
  6320. */
  6321. var timeout = module.exports.timeout = function(promise, timeoutMillis) {
  6322. var error = new TimeoutError(),
  6323. timeout;
  6324. return Promise.race([
  6325. promise,
  6326. new Promise(function(resolve, reject) {
  6327. timeout = setTimeout(function() {
  6328. reject(error);
  6329. }, timeoutMillis);
  6330. }),
  6331. ]).then(function(v) {
  6332. clearTimeout(timeout);
  6333. return v;
  6334. }, function(err) {
  6335. clearTimeout(timeout);
  6336. throw err;
  6337. });
  6338. };
  6339. /**
  6340. * Exception indicating that the timeout expired.
  6341. */
  6342. TimeoutError = module.exports.TimeoutError = function() {
  6343. Error.call(this)
  6344. this.stack = Error().stack
  6345. this.message = 'Timeout';
  6346. };
  6347. TimeoutError.prototype = Object.create(Error.prototype);
  6348. TimeoutError.prototype.name = "TimeoutError";
  6349. /***/ }),
  6350. /* 252 */
  6351. /***/ (function(module, exports, __webpack_require__) {
  6352. module.exports = __webpack_require__(253);
  6353. /***/ }),
  6354. /* 253 */
  6355. /***/ (function(module, exports, __webpack_require__) {
  6356. var parent = __webpack_require__(480);
  6357. module.exports = parent;
  6358. /***/ }),
  6359. /* 254 */
  6360. /***/ (function(module, exports, __webpack_require__) {
  6361. module.exports = __webpack_require__(484);
  6362. /***/ }),
  6363. /* 255 */
  6364. /***/ (function(module, exports, __webpack_require__) {
  6365. "use strict";
  6366. var uncurryThis = __webpack_require__(4);
  6367. var aCallable = __webpack_require__(31);
  6368. var isObject = __webpack_require__(11);
  6369. var hasOwn = __webpack_require__(13);
  6370. var arraySlice = __webpack_require__(110);
  6371. var NATIVE_BIND = __webpack_require__(76);
  6372. var $Function = Function;
  6373. var concat = uncurryThis([].concat);
  6374. var join = uncurryThis([].join);
  6375. var factories = {};
  6376. var construct = function (C, argsLength, args) {
  6377. if (!hasOwn(factories, argsLength)) {
  6378. for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
  6379. factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
  6380. } return factories[argsLength](C, args);
  6381. };
  6382. // `Function.prototype.bind` method implementation
  6383. // https://tc39.es/ecma262/#sec-function.prototype.bind
  6384. module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
  6385. var F = aCallable(this);
  6386. var Prototype = F.prototype;
  6387. var partArgs = arraySlice(arguments, 1);
  6388. var boundFunction = function bound(/* args... */) {
  6389. var args = concat(partArgs, arraySlice(arguments));
  6390. return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
  6391. };
  6392. if (isObject(Prototype)) boundFunction.prototype = Prototype;
  6393. return boundFunction;
  6394. };
  6395. /***/ }),
  6396. /* 256 */
  6397. /***/ (function(module, exports, __webpack_require__) {
  6398. module.exports = __webpack_require__(505);
  6399. /***/ }),
  6400. /* 257 */
  6401. /***/ (function(module, exports, __webpack_require__) {
  6402. module.exports = __webpack_require__(508);
  6403. /***/ }),
  6404. /* 258 */
  6405. /***/ (function(module, exports) {
  6406. var charenc = {
  6407. // UTF-8 encoding
  6408. utf8: {
  6409. // Convert a string to a byte array
  6410. stringToBytes: function(str) {
  6411. return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
  6412. },
  6413. // Convert a byte array to a string
  6414. bytesToString: function(bytes) {
  6415. return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
  6416. }
  6417. },
  6418. // Binary encoding
  6419. bin: {
  6420. // Convert a string to a byte array
  6421. stringToBytes: function(str) {
  6422. for (var bytes = [], i = 0; i < str.length; i++)
  6423. bytes.push(str.charCodeAt(i) & 0xFF);
  6424. return bytes;
  6425. },
  6426. // Convert a byte array to a string
  6427. bytesToString: function(bytes) {
  6428. for (var str = [], i = 0; i < bytes.length; i++)
  6429. str.push(String.fromCharCode(bytes[i]));
  6430. return str.join('');
  6431. }
  6432. }
  6433. };
  6434. module.exports = charenc;
  6435. /***/ }),
  6436. /* 259 */
  6437. /***/ (function(module, exports, __webpack_require__) {
  6438. "use strict";
  6439. var adapters = __webpack_require__(569);
  6440. module.exports = function (AV) {
  6441. AV.setAdapters(adapters);
  6442. return AV;
  6443. };
  6444. /***/ }),
  6445. /* 260 */
  6446. /***/ (function(module, exports, __webpack_require__) {
  6447. module.exports = __webpack_require__(577);
  6448. /***/ }),
  6449. /* 261 */
  6450. /***/ (function(module, exports, __webpack_require__) {
  6451. var fails = __webpack_require__(2);
  6452. var isObject = __webpack_require__(11);
  6453. var classof = __webpack_require__(63);
  6454. var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(581);
  6455. // eslint-disable-next-line es-x/no-object-isextensible -- safe
  6456. var $isExtensible = Object.isExtensible;
  6457. var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
  6458. // `Object.isExtensible` method
  6459. // https://tc39.es/ecma262/#sec-object.isextensible
  6460. module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
  6461. if (!isObject(it)) return false;
  6462. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
  6463. return $isExtensible ? $isExtensible(it) : true;
  6464. } : $isExtensible;
  6465. /***/ }),
  6466. /* 262 */
  6467. /***/ (function(module, exports, __webpack_require__) {
  6468. var fails = __webpack_require__(2);
  6469. module.exports = !fails(function () {
  6470. // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
  6471. return Object.isExtensible(Object.preventExtensions({}));
  6472. });
  6473. /***/ }),
  6474. /* 263 */
  6475. /***/ (function(module, exports, __webpack_require__) {
  6476. "use strict";
  6477. var defineProperty = __webpack_require__(23).f;
  6478. var create = __webpack_require__(49);
  6479. var defineBuiltIns = __webpack_require__(154);
  6480. var bind = __webpack_require__(48);
  6481. var anInstance = __webpack_require__(108);
  6482. var iterate = __webpack_require__(42);
  6483. var defineIterator = __webpack_require__(131);
  6484. var setSpecies = __webpack_require__(172);
  6485. var DESCRIPTORS = __webpack_require__(14);
  6486. var fastKey = __webpack_require__(94).fastKey;
  6487. var InternalStateModule = __webpack_require__(43);
  6488. var setInternalState = InternalStateModule.set;
  6489. var internalStateGetterFor = InternalStateModule.getterFor;
  6490. module.exports = {
  6491. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  6492. var Constructor = wrapper(function (that, iterable) {
  6493. anInstance(that, Prototype);
  6494. setInternalState(that, {
  6495. type: CONSTRUCTOR_NAME,
  6496. index: create(null),
  6497. first: undefined,
  6498. last: undefined,
  6499. size: 0
  6500. });
  6501. if (!DESCRIPTORS) that.size = 0;
  6502. if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
  6503. });
  6504. var Prototype = Constructor.prototype;
  6505. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  6506. var define = function (that, key, value) {
  6507. var state = getInternalState(that);
  6508. var entry = getEntry(that, key);
  6509. var previous, index;
  6510. // change existing entry
  6511. if (entry) {
  6512. entry.value = value;
  6513. // create new entry
  6514. } else {
  6515. state.last = entry = {
  6516. index: index = fastKey(key, true),
  6517. key: key,
  6518. value: value,
  6519. previous: previous = state.last,
  6520. next: undefined,
  6521. removed: false
  6522. };
  6523. if (!state.first) state.first = entry;
  6524. if (previous) previous.next = entry;
  6525. if (DESCRIPTORS) state.size++;
  6526. else that.size++;
  6527. // add to index
  6528. if (index !== 'F') state.index[index] = entry;
  6529. } return that;
  6530. };
  6531. var getEntry = function (that, key) {
  6532. var state = getInternalState(that);
  6533. // fast case
  6534. var index = fastKey(key);
  6535. var entry;
  6536. if (index !== 'F') return state.index[index];
  6537. // frozen object case
  6538. for (entry = state.first; entry; entry = entry.next) {
  6539. if (entry.key == key) return entry;
  6540. }
  6541. };
  6542. defineBuiltIns(Prototype, {
  6543. // `{ Map, Set }.prototype.clear()` methods
  6544. // https://tc39.es/ecma262/#sec-map.prototype.clear
  6545. // https://tc39.es/ecma262/#sec-set.prototype.clear
  6546. clear: function clear() {
  6547. var that = this;
  6548. var state = getInternalState(that);
  6549. var data = state.index;
  6550. var entry = state.first;
  6551. while (entry) {
  6552. entry.removed = true;
  6553. if (entry.previous) entry.previous = entry.previous.next = undefined;
  6554. delete data[entry.index];
  6555. entry = entry.next;
  6556. }
  6557. state.first = state.last = undefined;
  6558. if (DESCRIPTORS) state.size = 0;
  6559. else that.size = 0;
  6560. },
  6561. // `{ Map, Set }.prototype.delete(key)` methods
  6562. // https://tc39.es/ecma262/#sec-map.prototype.delete
  6563. // https://tc39.es/ecma262/#sec-set.prototype.delete
  6564. 'delete': function (key) {
  6565. var that = this;
  6566. var state = getInternalState(that);
  6567. var entry = getEntry(that, key);
  6568. if (entry) {
  6569. var next = entry.next;
  6570. var prev = entry.previous;
  6571. delete state.index[entry.index];
  6572. entry.removed = true;
  6573. if (prev) prev.next = next;
  6574. if (next) next.previous = prev;
  6575. if (state.first == entry) state.first = next;
  6576. if (state.last == entry) state.last = prev;
  6577. if (DESCRIPTORS) state.size--;
  6578. else that.size--;
  6579. } return !!entry;
  6580. },
  6581. // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
  6582. // https://tc39.es/ecma262/#sec-map.prototype.foreach
  6583. // https://tc39.es/ecma262/#sec-set.prototype.foreach
  6584. forEach: function forEach(callbackfn /* , that = undefined */) {
  6585. var state = getInternalState(this);
  6586. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  6587. var entry;
  6588. while (entry = entry ? entry.next : state.first) {
  6589. boundFunction(entry.value, entry.key, this);
  6590. // revert to the last existing entry
  6591. while (entry && entry.removed) entry = entry.previous;
  6592. }
  6593. },
  6594. // `{ Map, Set}.prototype.has(key)` methods
  6595. // https://tc39.es/ecma262/#sec-map.prototype.has
  6596. // https://tc39.es/ecma262/#sec-set.prototype.has
  6597. has: function has(key) {
  6598. return !!getEntry(this, key);
  6599. }
  6600. });
  6601. defineBuiltIns(Prototype, IS_MAP ? {
  6602. // `Map.prototype.get(key)` method
  6603. // https://tc39.es/ecma262/#sec-map.prototype.get
  6604. get: function get(key) {
  6605. var entry = getEntry(this, key);
  6606. return entry && entry.value;
  6607. },
  6608. // `Map.prototype.set(key, value)` method
  6609. // https://tc39.es/ecma262/#sec-map.prototype.set
  6610. set: function set(key, value) {
  6611. return define(this, key === 0 ? 0 : key, value);
  6612. }
  6613. } : {
  6614. // `Set.prototype.add(value)` method
  6615. // https://tc39.es/ecma262/#sec-set.prototype.add
  6616. add: function add(value) {
  6617. return define(this, value = value === 0 ? 0 : value, value);
  6618. }
  6619. });
  6620. if (DESCRIPTORS) defineProperty(Prototype, 'size', {
  6621. get: function () {
  6622. return getInternalState(this).size;
  6623. }
  6624. });
  6625. return Constructor;
  6626. },
  6627. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  6628. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  6629. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  6630. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  6631. // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
  6632. // https://tc39.es/ecma262/#sec-map.prototype.entries
  6633. // https://tc39.es/ecma262/#sec-map.prototype.keys
  6634. // https://tc39.es/ecma262/#sec-map.prototype.values
  6635. // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
  6636. // https://tc39.es/ecma262/#sec-set.prototype.entries
  6637. // https://tc39.es/ecma262/#sec-set.prototype.keys
  6638. // https://tc39.es/ecma262/#sec-set.prototype.values
  6639. // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
  6640. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  6641. setInternalState(this, {
  6642. type: ITERATOR_NAME,
  6643. target: iterated,
  6644. state: getInternalCollectionState(iterated),
  6645. kind: kind,
  6646. last: undefined
  6647. });
  6648. }, function () {
  6649. var state = getInternalIteratorState(this);
  6650. var kind = state.kind;
  6651. var entry = state.last;
  6652. // revert to the last existing entry
  6653. while (entry && entry.removed) entry = entry.previous;
  6654. // get next entry
  6655. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  6656. // or finish the iteration
  6657. state.target = undefined;
  6658. return { value: undefined, done: true };
  6659. }
  6660. // return step by kind
  6661. if (kind == 'keys') return { value: entry.key, done: false };
  6662. if (kind == 'values') return { value: entry.value, done: false };
  6663. return { value: [entry.key, entry.value], done: false };
  6664. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  6665. // `{ Map, Set }.prototype[@@species]` accessors
  6666. // https://tc39.es/ecma262/#sec-get-map-@@species
  6667. // https://tc39.es/ecma262/#sec-get-set-@@species
  6668. setSpecies(CONSTRUCTOR_NAME);
  6669. }
  6670. };
  6671. /***/ }),
  6672. /* 264 */
  6673. /***/ (function(module, exports, __webpack_require__) {
  6674. module.exports = __webpack_require__(608);
  6675. /***/ }),
  6676. /* 265 */
  6677. /***/ (function(module, exports) {
  6678. function _arrayLikeToArray(arr, len) {
  6679. if (len == null || len > arr.length) len = arr.length;
  6680. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  6681. arr2[i] = arr[i];
  6682. }
  6683. return arr2;
  6684. }
  6685. module.exports = _arrayLikeToArray;
  6686. /***/ }),
  6687. /* 266 */
  6688. /***/ (function(module, exports) {
  6689. function _iterableToArray(iter) {
  6690. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  6691. }
  6692. module.exports = _iterableToArray;
  6693. /***/ }),
  6694. /* 267 */
  6695. /***/ (function(module, exports, __webpack_require__) {
  6696. var arrayLikeToArray = __webpack_require__(265);
  6697. function _unsupportedIterableToArray(o, minLen) {
  6698. if (!o) return;
  6699. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  6700. var n = Object.prototype.toString.call(o).slice(8, -1);
  6701. if (n === "Object" && o.constructor) n = o.constructor.name;
  6702. if (n === "Map" || n === "Set") return Array.from(o);
  6703. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  6704. }
  6705. module.exports = _unsupportedIterableToArray;
  6706. /***/ }),
  6707. /* 268 */
  6708. /***/ (function(module, exports, __webpack_require__) {
  6709. var baseRandom = __webpack_require__(631);
  6710. /**
  6711. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  6712. *
  6713. * @private
  6714. * @param {Array} array The array to shuffle.
  6715. * @param {number} [size=array.length] The size of `array`.
  6716. * @returns {Array} Returns `array`.
  6717. */
  6718. function shuffleSelf(array, size) {
  6719. var index = -1,
  6720. length = array.length,
  6721. lastIndex = length - 1;
  6722. size = size === undefined ? length : size;
  6723. while (++index < size) {
  6724. var rand = baseRandom(index, lastIndex),
  6725. value = array[rand];
  6726. array[rand] = array[index];
  6727. array[index] = value;
  6728. }
  6729. array.length = size;
  6730. return array;
  6731. }
  6732. module.exports = shuffleSelf;
  6733. /***/ }),
  6734. /* 269 */
  6735. /***/ (function(module, exports, __webpack_require__) {
  6736. var baseValues = __webpack_require__(633),
  6737. keys = __webpack_require__(635);
  6738. /**
  6739. * Creates an array of the own enumerable string keyed property values of `object`.
  6740. *
  6741. * **Note:** Non-object values are coerced to objects.
  6742. *
  6743. * @static
  6744. * @since 0.1.0
  6745. * @memberOf _
  6746. * @category Object
  6747. * @param {Object} object The object to query.
  6748. * @returns {Array} Returns the array of property values.
  6749. * @example
  6750. *
  6751. * function Foo() {
  6752. * this.a = 1;
  6753. * this.b = 2;
  6754. * }
  6755. *
  6756. * Foo.prototype.c = 3;
  6757. *
  6758. * _.values(new Foo);
  6759. * // => [1, 2] (iteration order is not guaranteed)
  6760. *
  6761. * _.values('hi');
  6762. * // => ['h', 'i']
  6763. */
  6764. function values(object) {
  6765. return object == null ? [] : baseValues(object, keys(object));
  6766. }
  6767. module.exports = values;
  6768. /***/ }),
  6769. /* 270 */
  6770. /***/ (function(module, exports, __webpack_require__) {
  6771. var root = __webpack_require__(271);
  6772. /** Built-in value references. */
  6773. var Symbol = root.Symbol;
  6774. module.exports = Symbol;
  6775. /***/ }),
  6776. /* 271 */
  6777. /***/ (function(module, exports, __webpack_require__) {
  6778. var freeGlobal = __webpack_require__(272);
  6779. /** Detect free variable `self`. */
  6780. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  6781. /** Used as a reference to the global object. */
  6782. var root = freeGlobal || freeSelf || Function('return this')();
  6783. module.exports = root;
  6784. /***/ }),
  6785. /* 272 */
  6786. /***/ (function(module, exports, __webpack_require__) {
  6787. /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
  6788. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  6789. module.exports = freeGlobal;
  6790. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  6791. /***/ }),
  6792. /* 273 */
  6793. /***/ (function(module, exports) {
  6794. /**
  6795. * Checks if `value` is classified as an `Array` object.
  6796. *
  6797. * @static
  6798. * @memberOf _
  6799. * @since 0.1.0
  6800. * @category Lang
  6801. * @param {*} value The value to check.
  6802. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6803. * @example
  6804. *
  6805. * _.isArray([1, 2, 3]);
  6806. * // => true
  6807. *
  6808. * _.isArray(document.body.children);
  6809. * // => false
  6810. *
  6811. * _.isArray('abc');
  6812. * // => false
  6813. *
  6814. * _.isArray(_.noop);
  6815. * // => false
  6816. */
  6817. var isArray = Array.isArray;
  6818. module.exports = isArray;
  6819. /***/ }),
  6820. /* 274 */
  6821. /***/ (function(module, exports) {
  6822. module.exports = function(module) {
  6823. if(!module.webpackPolyfill) {
  6824. module.deprecate = function() {};
  6825. module.paths = [];
  6826. // module.parent = undefined by default
  6827. if(!module.children) module.children = [];
  6828. Object.defineProperty(module, "loaded", {
  6829. enumerable: true,
  6830. get: function() {
  6831. return module.l;
  6832. }
  6833. });
  6834. Object.defineProperty(module, "id", {
  6835. enumerable: true,
  6836. get: function() {
  6837. return module.i;
  6838. }
  6839. });
  6840. module.webpackPolyfill = 1;
  6841. }
  6842. return module;
  6843. };
  6844. /***/ }),
  6845. /* 275 */
  6846. /***/ (function(module, exports) {
  6847. /** Used as references for various `Number` constants. */
  6848. var MAX_SAFE_INTEGER = 9007199254740991;
  6849. /**
  6850. * Checks if `value` is a valid array-like length.
  6851. *
  6852. * **Note:** This method is loosely based on
  6853. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6854. *
  6855. * @static
  6856. * @memberOf _
  6857. * @since 4.0.0
  6858. * @category Lang
  6859. * @param {*} value The value to check.
  6860. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  6861. * @example
  6862. *
  6863. * _.isLength(3);
  6864. * // => true
  6865. *
  6866. * _.isLength(Number.MIN_VALUE);
  6867. * // => false
  6868. *
  6869. * _.isLength(Infinity);
  6870. * // => false
  6871. *
  6872. * _.isLength('3');
  6873. * // => false
  6874. */
  6875. function isLength(value) {
  6876. return typeof value == 'number' &&
  6877. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  6878. }
  6879. module.exports = isLength;
  6880. /***/ }),
  6881. /* 276 */
  6882. /***/ (function(module, exports) {
  6883. /**
  6884. * Creates a unary function that invokes `func` with its argument transformed.
  6885. *
  6886. * @private
  6887. * @param {Function} func The function to wrap.
  6888. * @param {Function} transform The argument transform.
  6889. * @returns {Function} Returns the new function.
  6890. */
  6891. function overArg(func, transform) {
  6892. return function(arg) {
  6893. return func(transform(arg));
  6894. };
  6895. }
  6896. module.exports = overArg;
  6897. /***/ }),
  6898. /* 277 */
  6899. /***/ (function(module, exports, __webpack_require__) {
  6900. "use strict";
  6901. var AV = __webpack_require__(278);
  6902. var useLiveQuery = __webpack_require__(588);
  6903. var useAdatpers = __webpack_require__(259);
  6904. module.exports = useAdatpers(useLiveQuery(AV));
  6905. /***/ }),
  6906. /* 278 */
  6907. /***/ (function(module, exports, __webpack_require__) {
  6908. "use strict";
  6909. var AV = __webpack_require__(279);
  6910. var useAdatpers = __webpack_require__(259);
  6911. module.exports = useAdatpers(AV);
  6912. /***/ }),
  6913. /* 279 */
  6914. /***/ (function(module, exports, __webpack_require__) {
  6915. "use strict";
  6916. module.exports = __webpack_require__(280);
  6917. /***/ }),
  6918. /* 280 */
  6919. /***/ (function(module, exports, __webpack_require__) {
  6920. "use strict";
  6921. var _interopRequireDefault = __webpack_require__(1);
  6922. var _promise = _interopRequireDefault(__webpack_require__(12));
  6923. /*!
  6924. * LeanCloud JavaScript SDK
  6925. * https://leancloud.cn
  6926. *
  6927. * Copyright 2016 LeanCloud.cn, Inc.
  6928. * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
  6929. */
  6930. var _ = __webpack_require__(3);
  6931. var AV = __webpack_require__(69);
  6932. AV._ = _;
  6933. AV.version = __webpack_require__(234);
  6934. AV.Promise = _promise.default;
  6935. AV.localStorage = __webpack_require__(236);
  6936. AV.Cache = __webpack_require__(237);
  6937. AV.Error = __webpack_require__(46);
  6938. __webpack_require__(419);
  6939. __webpack_require__(468)(AV);
  6940. __webpack_require__(469)(AV);
  6941. __webpack_require__(470)(AV);
  6942. __webpack_require__(471)(AV);
  6943. __webpack_require__(476)(AV);
  6944. __webpack_require__(477)(AV);
  6945. __webpack_require__(530)(AV);
  6946. __webpack_require__(555)(AV);
  6947. __webpack_require__(556)(AV);
  6948. __webpack_require__(558)(AV);
  6949. __webpack_require__(559)(AV);
  6950. __webpack_require__(560)(AV);
  6951. __webpack_require__(561)(AV);
  6952. __webpack_require__(562)(AV);
  6953. __webpack_require__(563)(AV);
  6954. __webpack_require__(564)(AV);
  6955. __webpack_require__(565)(AV);
  6956. __webpack_require__(566)(AV);
  6957. AV.Conversation = __webpack_require__(567);
  6958. __webpack_require__(568);
  6959. module.exports = AV;
  6960. /**
  6961. * Options to controll the authentication for an operation
  6962. * @typedef {Object} AuthOptions
  6963. * @property {String} [sessionToken] Specify a user to excute the operation as.
  6964. * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
  6965. * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
  6966. */
  6967. /**
  6968. * Options to controll the authentication for an SMS operation
  6969. * @typedef {Object} SMSAuthOptions
  6970. * @property {String} [sessionToken] Specify a user to excute the operation as.
  6971. * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
  6972. * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
  6973. * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
  6974. */
  6975. /***/ }),
  6976. /* 281 */
  6977. /***/ (function(module, exports, __webpack_require__) {
  6978. var parent = __webpack_require__(282);
  6979. __webpack_require__(39);
  6980. module.exports = parent;
  6981. /***/ }),
  6982. /* 282 */
  6983. /***/ (function(module, exports, __webpack_require__) {
  6984. __webpack_require__(283);
  6985. __webpack_require__(38);
  6986. __webpack_require__(53);
  6987. __webpack_require__(299);
  6988. __webpack_require__(313);
  6989. __webpack_require__(314);
  6990. __webpack_require__(315);
  6991. __webpack_require__(55);
  6992. var path = __webpack_require__(5);
  6993. module.exports = path.Promise;
  6994. /***/ }),
  6995. /* 283 */
  6996. /***/ (function(module, exports, __webpack_require__) {
  6997. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  6998. __webpack_require__(284);
  6999. /***/ }),
  7000. /* 284 */
  7001. /***/ (function(module, exports, __webpack_require__) {
  7002. "use strict";
  7003. var $ = __webpack_require__(0);
  7004. var isPrototypeOf = __webpack_require__(19);
  7005. var getPrototypeOf = __webpack_require__(100);
  7006. var setPrototypeOf = __webpack_require__(102);
  7007. var copyConstructorProperties = __webpack_require__(289);
  7008. var create = __webpack_require__(49);
  7009. var createNonEnumerableProperty = __webpack_require__(37);
  7010. var createPropertyDescriptor = __webpack_require__(47);
  7011. var clearErrorStack = __webpack_require__(292);
  7012. var installErrorCause = __webpack_require__(293);
  7013. var iterate = __webpack_require__(42);
  7014. var normalizeStringArgument = __webpack_require__(294);
  7015. var wellKnownSymbol = __webpack_require__(9);
  7016. var ERROR_STACK_INSTALLABLE = __webpack_require__(295);
  7017. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  7018. var $Error = Error;
  7019. var push = [].push;
  7020. var $AggregateError = function AggregateError(errors, message /* , options */) {
  7021. var options = arguments.length > 2 ? arguments[2] : undefined;
  7022. var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
  7023. var that;
  7024. if (setPrototypeOf) {
  7025. that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
  7026. } else {
  7027. that = isInstance ? this : create(AggregateErrorPrototype);
  7028. createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
  7029. }
  7030. if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
  7031. if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
  7032. installErrorCause(that, options);
  7033. var errorsArray = [];
  7034. iterate(errors, push, { that: errorsArray });
  7035. createNonEnumerableProperty(that, 'errors', errorsArray);
  7036. return that;
  7037. };
  7038. if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
  7039. else copyConstructorProperties($AggregateError, $Error, { name: true });
  7040. var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
  7041. constructor: createPropertyDescriptor(1, $AggregateError),
  7042. message: createPropertyDescriptor(1, ''),
  7043. name: createPropertyDescriptor(1, 'AggregateError')
  7044. });
  7045. // `AggregateError` constructor
  7046. // https://tc39.es/ecma262/#sec-aggregate-error-constructor
  7047. $({ global: true, constructor: true, arity: 2 }, {
  7048. AggregateError: $AggregateError
  7049. });
  7050. /***/ }),
  7051. /* 285 */
  7052. /***/ (function(module, exports, __webpack_require__) {
  7053. var call = __webpack_require__(15);
  7054. var isObject = __webpack_require__(11);
  7055. var isSymbol = __webpack_require__(97);
  7056. var getMethod = __webpack_require__(122);
  7057. var ordinaryToPrimitive = __webpack_require__(286);
  7058. var wellKnownSymbol = __webpack_require__(9);
  7059. var $TypeError = TypeError;
  7060. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  7061. // `ToPrimitive` abstract operation
  7062. // https://tc39.es/ecma262/#sec-toprimitive
  7063. module.exports = function (input, pref) {
  7064. if (!isObject(input) || isSymbol(input)) return input;
  7065. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  7066. var result;
  7067. if (exoticToPrim) {
  7068. if (pref === undefined) pref = 'default';
  7069. result = call(exoticToPrim, input, pref);
  7070. if (!isObject(result) || isSymbol(result)) return result;
  7071. throw $TypeError("Can't convert object to primitive value");
  7072. }
  7073. if (pref === undefined) pref = 'number';
  7074. return ordinaryToPrimitive(input, pref);
  7075. };
  7076. /***/ }),
  7077. /* 286 */
  7078. /***/ (function(module, exports, __webpack_require__) {
  7079. var call = __webpack_require__(15);
  7080. var isCallable = __webpack_require__(8);
  7081. var isObject = __webpack_require__(11);
  7082. var $TypeError = TypeError;
  7083. // `OrdinaryToPrimitive` abstract operation
  7084. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  7085. module.exports = function (input, pref) {
  7086. var fn, val;
  7087. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  7088. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
  7089. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  7090. throw $TypeError("Can't convert object to primitive value");
  7091. };
  7092. /***/ }),
  7093. /* 287 */
  7094. /***/ (function(module, exports, __webpack_require__) {
  7095. var global = __webpack_require__(7);
  7096. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  7097. var defineProperty = Object.defineProperty;
  7098. module.exports = function (key, value) {
  7099. try {
  7100. defineProperty(global, key, { value: value, configurable: true, writable: true });
  7101. } catch (error) {
  7102. global[key] = value;
  7103. } return value;
  7104. };
  7105. /***/ }),
  7106. /* 288 */
  7107. /***/ (function(module, exports, __webpack_require__) {
  7108. var isCallable = __webpack_require__(8);
  7109. var $String = String;
  7110. var $TypeError = TypeError;
  7111. module.exports = function (argument) {
  7112. if (typeof argument == 'object' || isCallable(argument)) return argument;
  7113. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  7114. };
  7115. /***/ }),
  7116. /* 289 */
  7117. /***/ (function(module, exports, __webpack_require__) {
  7118. var hasOwn = __webpack_require__(13);
  7119. var ownKeys = __webpack_require__(162);
  7120. var getOwnPropertyDescriptorModule = __webpack_require__(62);
  7121. var definePropertyModule = __webpack_require__(23);
  7122. module.exports = function (target, source, exceptions) {
  7123. var keys = ownKeys(source);
  7124. var defineProperty = definePropertyModule.f;
  7125. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  7126. for (var i = 0; i < keys.length; i++) {
  7127. var key = keys[i];
  7128. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  7129. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  7130. }
  7131. }
  7132. };
  7133. /***/ }),
  7134. /* 290 */
  7135. /***/ (function(module, exports) {
  7136. var ceil = Math.ceil;
  7137. var floor = Math.floor;
  7138. // `Math.trunc` method
  7139. // https://tc39.es/ecma262/#sec-math.trunc
  7140. // eslint-disable-next-line es-x/no-math-trunc -- safe
  7141. module.exports = Math.trunc || function trunc(x) {
  7142. var n = +x;
  7143. return (n > 0 ? floor : ceil)(n);
  7144. };
  7145. /***/ }),
  7146. /* 291 */
  7147. /***/ (function(module, exports, __webpack_require__) {
  7148. var toIntegerOrInfinity = __webpack_require__(126);
  7149. var min = Math.min;
  7150. // `ToLength` abstract operation
  7151. // https://tc39.es/ecma262/#sec-tolength
  7152. module.exports = function (argument) {
  7153. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  7154. };
  7155. /***/ }),
  7156. /* 292 */
  7157. /***/ (function(module, exports, __webpack_require__) {
  7158. var uncurryThis = __webpack_require__(4);
  7159. var $Error = Error;
  7160. var replace = uncurryThis(''.replace);
  7161. var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
  7162. var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
  7163. var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
  7164. module.exports = function (stack, dropEntries) {
  7165. if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
  7166. while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
  7167. } return stack;
  7168. };
  7169. /***/ }),
  7170. /* 293 */
  7171. /***/ (function(module, exports, __webpack_require__) {
  7172. var isObject = __webpack_require__(11);
  7173. var createNonEnumerableProperty = __webpack_require__(37);
  7174. // `InstallErrorCause` abstract operation
  7175. // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
  7176. module.exports = function (O, options) {
  7177. if (isObject(options) && 'cause' in options) {
  7178. createNonEnumerableProperty(O, 'cause', options.cause);
  7179. }
  7180. };
  7181. /***/ }),
  7182. /* 294 */
  7183. /***/ (function(module, exports, __webpack_require__) {
  7184. var toString = __webpack_require__(81);
  7185. module.exports = function (argument, $default) {
  7186. return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
  7187. };
  7188. /***/ }),
  7189. /* 295 */
  7190. /***/ (function(module, exports, __webpack_require__) {
  7191. var fails = __webpack_require__(2);
  7192. var createPropertyDescriptor = __webpack_require__(47);
  7193. module.exports = !fails(function () {
  7194. var error = Error('a');
  7195. if (!('stack' in error)) return true;
  7196. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  7197. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  7198. return error.stack !== 7;
  7199. });
  7200. /***/ }),
  7201. /* 296 */
  7202. /***/ (function(module, exports, __webpack_require__) {
  7203. var DESCRIPTORS = __webpack_require__(14);
  7204. var hasOwn = __webpack_require__(13);
  7205. var FunctionPrototype = Function.prototype;
  7206. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  7207. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  7208. var EXISTS = hasOwn(FunctionPrototype, 'name');
  7209. // additional protection from minified / mangled / dropped function names
  7210. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  7211. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
  7212. module.exports = {
  7213. EXISTS: EXISTS,
  7214. PROPER: PROPER,
  7215. CONFIGURABLE: CONFIGURABLE
  7216. };
  7217. /***/ }),
  7218. /* 297 */
  7219. /***/ (function(module, exports, __webpack_require__) {
  7220. "use strict";
  7221. var IteratorPrototype = __webpack_require__(171).IteratorPrototype;
  7222. var create = __webpack_require__(49);
  7223. var createPropertyDescriptor = __webpack_require__(47);
  7224. var setToStringTag = __webpack_require__(52);
  7225. var Iterators = __webpack_require__(50);
  7226. var returnThis = function () { return this; };
  7227. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  7228. var TO_STRING_TAG = NAME + ' Iterator';
  7229. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  7230. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  7231. Iterators[TO_STRING_TAG] = returnThis;
  7232. return IteratorConstructor;
  7233. };
  7234. /***/ }),
  7235. /* 298 */
  7236. /***/ (function(module, exports, __webpack_require__) {
  7237. "use strict";
  7238. var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
  7239. var classof = __webpack_require__(51);
  7240. // `Object.prototype.toString` method implementation
  7241. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  7242. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  7243. return '[object ' + classof(this) + ']';
  7244. };
  7245. /***/ }),
  7246. /* 299 */
  7247. /***/ (function(module, exports, __webpack_require__) {
  7248. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  7249. __webpack_require__(300);
  7250. __webpack_require__(308);
  7251. __webpack_require__(309);
  7252. __webpack_require__(310);
  7253. __webpack_require__(311);
  7254. __webpack_require__(312);
  7255. /***/ }),
  7256. /* 300 */
  7257. /***/ (function(module, exports, __webpack_require__) {
  7258. "use strict";
  7259. var $ = __webpack_require__(0);
  7260. var IS_PURE = __webpack_require__(33);
  7261. var IS_NODE = __webpack_require__(107);
  7262. var global = __webpack_require__(7);
  7263. var call = __webpack_require__(15);
  7264. var defineBuiltIn = __webpack_require__(44);
  7265. var setPrototypeOf = __webpack_require__(102);
  7266. var setToStringTag = __webpack_require__(52);
  7267. var setSpecies = __webpack_require__(172);
  7268. var aCallable = __webpack_require__(31);
  7269. var isCallable = __webpack_require__(8);
  7270. var isObject = __webpack_require__(11);
  7271. var anInstance = __webpack_require__(108);
  7272. var speciesConstructor = __webpack_require__(173);
  7273. var task = __webpack_require__(175).set;
  7274. var microtask = __webpack_require__(302);
  7275. var hostReportErrors = __webpack_require__(305);
  7276. var perform = __webpack_require__(82);
  7277. var Queue = __webpack_require__(306);
  7278. var InternalStateModule = __webpack_require__(43);
  7279. var NativePromiseConstructor = __webpack_require__(65);
  7280. var PromiseConstructorDetection = __webpack_require__(83);
  7281. var newPromiseCapabilityModule = __webpack_require__(54);
  7282. var PROMISE = 'Promise';
  7283. var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
  7284. var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
  7285. var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
  7286. var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
  7287. var setInternalState = InternalStateModule.set;
  7288. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  7289. var PromiseConstructor = NativePromiseConstructor;
  7290. var PromisePrototype = NativePromisePrototype;
  7291. var TypeError = global.TypeError;
  7292. var document = global.document;
  7293. var process = global.process;
  7294. var newPromiseCapability = newPromiseCapabilityModule.f;
  7295. var newGenericPromiseCapability = newPromiseCapability;
  7296. var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
  7297. var UNHANDLED_REJECTION = 'unhandledrejection';
  7298. var REJECTION_HANDLED = 'rejectionhandled';
  7299. var PENDING = 0;
  7300. var FULFILLED = 1;
  7301. var REJECTED = 2;
  7302. var HANDLED = 1;
  7303. var UNHANDLED = 2;
  7304. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  7305. // helpers
  7306. var isThenable = function (it) {
  7307. var then;
  7308. return isObject(it) && isCallable(then = it.then) ? then : false;
  7309. };
  7310. var callReaction = function (reaction, state) {
  7311. var value = state.value;
  7312. var ok = state.state == FULFILLED;
  7313. var handler = ok ? reaction.ok : reaction.fail;
  7314. var resolve = reaction.resolve;
  7315. var reject = reaction.reject;
  7316. var domain = reaction.domain;
  7317. var result, then, exited;
  7318. try {
  7319. if (handler) {
  7320. if (!ok) {
  7321. if (state.rejection === UNHANDLED) onHandleUnhandled(state);
  7322. state.rejection = HANDLED;
  7323. }
  7324. if (handler === true) result = value;
  7325. else {
  7326. if (domain) domain.enter();
  7327. result = handler(value); // can throw
  7328. if (domain) {
  7329. domain.exit();
  7330. exited = true;
  7331. }
  7332. }
  7333. if (result === reaction.promise) {
  7334. reject(TypeError('Promise-chain cycle'));
  7335. } else if (then = isThenable(result)) {
  7336. call(then, result, resolve, reject);
  7337. } else resolve(result);
  7338. } else reject(value);
  7339. } catch (error) {
  7340. if (domain && !exited) domain.exit();
  7341. reject(error);
  7342. }
  7343. };
  7344. var notify = function (state, isReject) {
  7345. if (state.notified) return;
  7346. state.notified = true;
  7347. microtask(function () {
  7348. var reactions = state.reactions;
  7349. var reaction;
  7350. while (reaction = reactions.get()) {
  7351. callReaction(reaction, state);
  7352. }
  7353. state.notified = false;
  7354. if (isReject && !state.rejection) onUnhandled(state);
  7355. });
  7356. };
  7357. var dispatchEvent = function (name, promise, reason) {
  7358. var event, handler;
  7359. if (DISPATCH_EVENT) {
  7360. event = document.createEvent('Event');
  7361. event.promise = promise;
  7362. event.reason = reason;
  7363. event.initEvent(name, false, true);
  7364. global.dispatchEvent(event);
  7365. } else event = { promise: promise, reason: reason };
  7366. if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
  7367. else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
  7368. };
  7369. var onUnhandled = function (state) {
  7370. call(task, global, function () {
  7371. var promise = state.facade;
  7372. var value = state.value;
  7373. var IS_UNHANDLED = isUnhandled(state);
  7374. var result;
  7375. if (IS_UNHANDLED) {
  7376. result = perform(function () {
  7377. if (IS_NODE) {
  7378. process.emit('unhandledRejection', value, promise);
  7379. } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
  7380. });
  7381. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  7382. state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
  7383. if (result.error) throw result.value;
  7384. }
  7385. });
  7386. };
  7387. var isUnhandled = function (state) {
  7388. return state.rejection !== HANDLED && !state.parent;
  7389. };
  7390. var onHandleUnhandled = function (state) {
  7391. call(task, global, function () {
  7392. var promise = state.facade;
  7393. if (IS_NODE) {
  7394. process.emit('rejectionHandled', promise);
  7395. } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  7396. });
  7397. };
  7398. var bind = function (fn, state, unwrap) {
  7399. return function (value) {
  7400. fn(state, value, unwrap);
  7401. };
  7402. };
  7403. var internalReject = function (state, value, unwrap) {
  7404. if (state.done) return;
  7405. state.done = true;
  7406. if (unwrap) state = unwrap;
  7407. state.value = value;
  7408. state.state = REJECTED;
  7409. notify(state, true);
  7410. };
  7411. var internalResolve = function (state, value, unwrap) {
  7412. if (state.done) return;
  7413. state.done = true;
  7414. if (unwrap) state = unwrap;
  7415. try {
  7416. if (state.facade === value) throw TypeError("Promise can't be resolved itself");
  7417. var then = isThenable(value);
  7418. if (then) {
  7419. microtask(function () {
  7420. var wrapper = { done: false };
  7421. try {
  7422. call(then, value,
  7423. bind(internalResolve, wrapper, state),
  7424. bind(internalReject, wrapper, state)
  7425. );
  7426. } catch (error) {
  7427. internalReject(wrapper, error, state);
  7428. }
  7429. });
  7430. } else {
  7431. state.value = value;
  7432. state.state = FULFILLED;
  7433. notify(state, false);
  7434. }
  7435. } catch (error) {
  7436. internalReject({ done: false }, error, state);
  7437. }
  7438. };
  7439. // constructor polyfill
  7440. if (FORCED_PROMISE_CONSTRUCTOR) {
  7441. // 25.4.3.1 Promise(executor)
  7442. PromiseConstructor = function Promise(executor) {
  7443. anInstance(this, PromisePrototype);
  7444. aCallable(executor);
  7445. call(Internal, this);
  7446. var state = getInternalPromiseState(this);
  7447. try {
  7448. executor(bind(internalResolve, state), bind(internalReject, state));
  7449. } catch (error) {
  7450. internalReject(state, error);
  7451. }
  7452. };
  7453. PromisePrototype = PromiseConstructor.prototype;
  7454. // eslint-disable-next-line no-unused-vars -- required for `.length`
  7455. Internal = function Promise(executor) {
  7456. setInternalState(this, {
  7457. type: PROMISE,
  7458. done: false,
  7459. notified: false,
  7460. parent: false,
  7461. reactions: new Queue(),
  7462. rejection: false,
  7463. state: PENDING,
  7464. value: undefined
  7465. });
  7466. };
  7467. // `Promise.prototype.then` method
  7468. // https://tc39.es/ecma262/#sec-promise.prototype.then
  7469. Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
  7470. var state = getInternalPromiseState(this);
  7471. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  7472. state.parent = true;
  7473. reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
  7474. reaction.fail = isCallable(onRejected) && onRejected;
  7475. reaction.domain = IS_NODE ? process.domain : undefined;
  7476. if (state.state == PENDING) state.reactions.add(reaction);
  7477. else microtask(function () {
  7478. callReaction(reaction, state);
  7479. });
  7480. return reaction.promise;
  7481. });
  7482. OwnPromiseCapability = function () {
  7483. var promise = new Internal();
  7484. var state = getInternalPromiseState(promise);
  7485. this.promise = promise;
  7486. this.resolve = bind(internalResolve, state);
  7487. this.reject = bind(internalReject, state);
  7488. };
  7489. newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
  7490. return C === PromiseConstructor || C === PromiseWrapper
  7491. ? new OwnPromiseCapability(C)
  7492. : newGenericPromiseCapability(C);
  7493. };
  7494. if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
  7495. nativeThen = NativePromisePrototype.then;
  7496. if (!NATIVE_PROMISE_SUBCLASSING) {
  7497. // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
  7498. defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
  7499. var that = this;
  7500. return new PromiseConstructor(function (resolve, reject) {
  7501. call(nativeThen, that, resolve, reject);
  7502. }).then(onFulfilled, onRejected);
  7503. // https://github.com/zloirock/core-js/issues/640
  7504. }, { unsafe: true });
  7505. }
  7506. // make `.constructor === Promise` work for native promise-based APIs
  7507. try {
  7508. delete NativePromisePrototype.constructor;
  7509. } catch (error) { /* empty */ }
  7510. // make `instanceof Promise` work for native promise-based APIs
  7511. if (setPrototypeOf) {
  7512. setPrototypeOf(NativePromisePrototype, PromisePrototype);
  7513. }
  7514. }
  7515. }
  7516. $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  7517. Promise: PromiseConstructor
  7518. });
  7519. setToStringTag(PromiseConstructor, PROMISE, false, true);
  7520. setSpecies(PROMISE);
  7521. /***/ }),
  7522. /* 301 */
  7523. /***/ (function(module, exports) {
  7524. var $TypeError = TypeError;
  7525. module.exports = function (passed, required) {
  7526. if (passed < required) throw $TypeError('Not enough arguments');
  7527. return passed;
  7528. };
  7529. /***/ }),
  7530. /* 302 */
  7531. /***/ (function(module, exports, __webpack_require__) {
  7532. var global = __webpack_require__(7);
  7533. var bind = __webpack_require__(48);
  7534. var getOwnPropertyDescriptor = __webpack_require__(62).f;
  7535. var macrotask = __webpack_require__(175).set;
  7536. var IS_IOS = __webpack_require__(176);
  7537. var IS_IOS_PEBBLE = __webpack_require__(303);
  7538. var IS_WEBOS_WEBKIT = __webpack_require__(304);
  7539. var IS_NODE = __webpack_require__(107);
  7540. var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
  7541. var document = global.document;
  7542. var process = global.process;
  7543. var Promise = global.Promise;
  7544. // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
  7545. var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
  7546. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  7547. var flush, head, last, notify, toggle, node, promise, then;
  7548. // modern engines have queueMicrotask method
  7549. if (!queueMicrotask) {
  7550. flush = function () {
  7551. var parent, fn;
  7552. if (IS_NODE && (parent = process.domain)) parent.exit();
  7553. while (head) {
  7554. fn = head.fn;
  7555. head = head.next;
  7556. try {
  7557. fn();
  7558. } catch (error) {
  7559. if (head) notify();
  7560. else last = undefined;
  7561. throw error;
  7562. }
  7563. } last = undefined;
  7564. if (parent) parent.enter();
  7565. };
  7566. // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  7567. // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  7568. if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
  7569. toggle = true;
  7570. node = document.createTextNode('');
  7571. new MutationObserver(flush).observe(node, { characterData: true });
  7572. notify = function () {
  7573. node.data = toggle = !toggle;
  7574. };
  7575. // environments with maybe non-completely correct, but existent Promise
  7576. } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
  7577. // Promise.resolve without an argument throws an error in LG WebOS 2
  7578. promise = Promise.resolve(undefined);
  7579. // workaround of WebKit ~ iOS Safari 10.1 bug
  7580. promise.constructor = Promise;
  7581. then = bind(promise.then, promise);
  7582. notify = function () {
  7583. then(flush);
  7584. };
  7585. // Node.js without promises
  7586. } else if (IS_NODE) {
  7587. notify = function () {
  7588. process.nextTick(flush);
  7589. };
  7590. // for other environments - macrotask based on:
  7591. // - setImmediate
  7592. // - MessageChannel
  7593. // - window.postMessage
  7594. // - onreadystatechange
  7595. // - setTimeout
  7596. } else {
  7597. // strange IE + webpack dev server bug - use .bind(global)
  7598. macrotask = bind(macrotask, global);
  7599. notify = function () {
  7600. macrotask(flush);
  7601. };
  7602. }
  7603. }
  7604. module.exports = queueMicrotask || function (fn) {
  7605. var task = { fn: fn, next: undefined };
  7606. if (last) last.next = task;
  7607. if (!head) {
  7608. head = task;
  7609. notify();
  7610. } last = task;
  7611. };
  7612. /***/ }),
  7613. /* 303 */
  7614. /***/ (function(module, exports, __webpack_require__) {
  7615. var userAgent = __webpack_require__(98);
  7616. var global = __webpack_require__(7);
  7617. module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
  7618. /***/ }),
  7619. /* 304 */
  7620. /***/ (function(module, exports, __webpack_require__) {
  7621. var userAgent = __webpack_require__(98);
  7622. module.exports = /web0s(?!.*chrome)/i.test(userAgent);
  7623. /***/ }),
  7624. /* 305 */
  7625. /***/ (function(module, exports, __webpack_require__) {
  7626. var global = __webpack_require__(7);
  7627. module.exports = function (a, b) {
  7628. var console = global.console;
  7629. if (console && console.error) {
  7630. arguments.length == 1 ? console.error(a) : console.error(a, b);
  7631. }
  7632. };
  7633. /***/ }),
  7634. /* 306 */
  7635. /***/ (function(module, exports) {
  7636. var Queue = function () {
  7637. this.head = null;
  7638. this.tail = null;
  7639. };
  7640. Queue.prototype = {
  7641. add: function (item) {
  7642. var entry = { item: item, next: null };
  7643. if (this.head) this.tail.next = entry;
  7644. else this.head = entry;
  7645. this.tail = entry;
  7646. },
  7647. get: function () {
  7648. var entry = this.head;
  7649. if (entry) {
  7650. this.head = entry.next;
  7651. if (this.tail === entry) this.tail = null;
  7652. return entry.item;
  7653. }
  7654. }
  7655. };
  7656. module.exports = Queue;
  7657. /***/ }),
  7658. /* 307 */
  7659. /***/ (function(module, exports) {
  7660. module.exports = typeof window == 'object' && typeof Deno != 'object';
  7661. /***/ }),
  7662. /* 308 */
  7663. /***/ (function(module, exports, __webpack_require__) {
  7664. "use strict";
  7665. var $ = __webpack_require__(0);
  7666. var call = __webpack_require__(15);
  7667. var aCallable = __webpack_require__(31);
  7668. var newPromiseCapabilityModule = __webpack_require__(54);
  7669. var perform = __webpack_require__(82);
  7670. var iterate = __webpack_require__(42);
  7671. var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
  7672. // `Promise.all` method
  7673. // https://tc39.es/ecma262/#sec-promise.all
  7674. $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
  7675. all: function all(iterable) {
  7676. var C = this;
  7677. var capability = newPromiseCapabilityModule.f(C);
  7678. var resolve = capability.resolve;
  7679. var reject = capability.reject;
  7680. var result = perform(function () {
  7681. var $promiseResolve = aCallable(C.resolve);
  7682. var values = [];
  7683. var counter = 0;
  7684. var remaining = 1;
  7685. iterate(iterable, function (promise) {
  7686. var index = counter++;
  7687. var alreadyCalled = false;
  7688. remaining++;
  7689. call($promiseResolve, C, promise).then(function (value) {
  7690. if (alreadyCalled) return;
  7691. alreadyCalled = true;
  7692. values[index] = value;
  7693. --remaining || resolve(values);
  7694. }, reject);
  7695. });
  7696. --remaining || resolve(values);
  7697. });
  7698. if (result.error) reject(result.value);
  7699. return capability.promise;
  7700. }
  7701. });
  7702. /***/ }),
  7703. /* 309 */
  7704. /***/ (function(module, exports, __webpack_require__) {
  7705. "use strict";
  7706. var $ = __webpack_require__(0);
  7707. var IS_PURE = __webpack_require__(33);
  7708. var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
  7709. var NativePromiseConstructor = __webpack_require__(65);
  7710. var getBuiltIn = __webpack_require__(18);
  7711. var isCallable = __webpack_require__(8);
  7712. var defineBuiltIn = __webpack_require__(44);
  7713. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  7714. // `Promise.prototype.catch` method
  7715. // https://tc39.es/ecma262/#sec-promise.prototype.catch
  7716. $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
  7717. 'catch': function (onRejected) {
  7718. return this.then(undefined, onRejected);
  7719. }
  7720. });
  7721. // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
  7722. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  7723. var method = getBuiltIn('Promise').prototype['catch'];
  7724. if (NativePromisePrototype['catch'] !== method) {
  7725. defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
  7726. }
  7727. }
  7728. /***/ }),
  7729. /* 310 */
  7730. /***/ (function(module, exports, __webpack_require__) {
  7731. "use strict";
  7732. var $ = __webpack_require__(0);
  7733. var call = __webpack_require__(15);
  7734. var aCallable = __webpack_require__(31);
  7735. var newPromiseCapabilityModule = __webpack_require__(54);
  7736. var perform = __webpack_require__(82);
  7737. var iterate = __webpack_require__(42);
  7738. var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
  7739. // `Promise.race` method
  7740. // https://tc39.es/ecma262/#sec-promise.race
  7741. $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
  7742. race: function race(iterable) {
  7743. var C = this;
  7744. var capability = newPromiseCapabilityModule.f(C);
  7745. var reject = capability.reject;
  7746. var result = perform(function () {
  7747. var $promiseResolve = aCallable(C.resolve);
  7748. iterate(iterable, function (promise) {
  7749. call($promiseResolve, C, promise).then(capability.resolve, reject);
  7750. });
  7751. });
  7752. if (result.error) reject(result.value);
  7753. return capability.promise;
  7754. }
  7755. });
  7756. /***/ }),
  7757. /* 311 */
  7758. /***/ (function(module, exports, __webpack_require__) {
  7759. "use strict";
  7760. var $ = __webpack_require__(0);
  7761. var call = __webpack_require__(15);
  7762. var newPromiseCapabilityModule = __webpack_require__(54);
  7763. var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
  7764. // `Promise.reject` method
  7765. // https://tc39.es/ecma262/#sec-promise.reject
  7766. $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  7767. reject: function reject(r) {
  7768. var capability = newPromiseCapabilityModule.f(this);
  7769. call(capability.reject, undefined, r);
  7770. return capability.promise;
  7771. }
  7772. });
  7773. /***/ }),
  7774. /* 312 */
  7775. /***/ (function(module, exports, __webpack_require__) {
  7776. "use strict";
  7777. var $ = __webpack_require__(0);
  7778. var getBuiltIn = __webpack_require__(18);
  7779. var IS_PURE = __webpack_require__(33);
  7780. var NativePromiseConstructor = __webpack_require__(65);
  7781. var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
  7782. var promiseResolve = __webpack_require__(179);
  7783. var PromiseConstructorWrapper = getBuiltIn('Promise');
  7784. var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
  7785. // `Promise.resolve` method
  7786. // https://tc39.es/ecma262/#sec-promise.resolve
  7787. $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
  7788. resolve: function resolve(x) {
  7789. return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
  7790. }
  7791. });
  7792. /***/ }),
  7793. /* 313 */
  7794. /***/ (function(module, exports, __webpack_require__) {
  7795. "use strict";
  7796. var $ = __webpack_require__(0);
  7797. var call = __webpack_require__(15);
  7798. var aCallable = __webpack_require__(31);
  7799. var newPromiseCapabilityModule = __webpack_require__(54);
  7800. var perform = __webpack_require__(82);
  7801. var iterate = __webpack_require__(42);
  7802. // `Promise.allSettled` method
  7803. // https://tc39.es/ecma262/#sec-promise.allsettled
  7804. $({ target: 'Promise', stat: true }, {
  7805. allSettled: function allSettled(iterable) {
  7806. var C = this;
  7807. var capability = newPromiseCapabilityModule.f(C);
  7808. var resolve = capability.resolve;
  7809. var reject = capability.reject;
  7810. var result = perform(function () {
  7811. var promiseResolve = aCallable(C.resolve);
  7812. var values = [];
  7813. var counter = 0;
  7814. var remaining = 1;
  7815. iterate(iterable, function (promise) {
  7816. var index = counter++;
  7817. var alreadyCalled = false;
  7818. remaining++;
  7819. call(promiseResolve, C, promise).then(function (value) {
  7820. if (alreadyCalled) return;
  7821. alreadyCalled = true;
  7822. values[index] = { status: 'fulfilled', value: value };
  7823. --remaining || resolve(values);
  7824. }, function (error) {
  7825. if (alreadyCalled) return;
  7826. alreadyCalled = true;
  7827. values[index] = { status: 'rejected', reason: error };
  7828. --remaining || resolve(values);
  7829. });
  7830. });
  7831. --remaining || resolve(values);
  7832. });
  7833. if (result.error) reject(result.value);
  7834. return capability.promise;
  7835. }
  7836. });
  7837. /***/ }),
  7838. /* 314 */
  7839. /***/ (function(module, exports, __webpack_require__) {
  7840. "use strict";
  7841. var $ = __webpack_require__(0);
  7842. var call = __webpack_require__(15);
  7843. var aCallable = __webpack_require__(31);
  7844. var getBuiltIn = __webpack_require__(18);
  7845. var newPromiseCapabilityModule = __webpack_require__(54);
  7846. var perform = __webpack_require__(82);
  7847. var iterate = __webpack_require__(42);
  7848. var PROMISE_ANY_ERROR = 'No one promise resolved';
  7849. // `Promise.any` method
  7850. // https://tc39.es/ecma262/#sec-promise.any
  7851. $({ target: 'Promise', stat: true }, {
  7852. any: function any(iterable) {
  7853. var C = this;
  7854. var AggregateError = getBuiltIn('AggregateError');
  7855. var capability = newPromiseCapabilityModule.f(C);
  7856. var resolve = capability.resolve;
  7857. var reject = capability.reject;
  7858. var result = perform(function () {
  7859. var promiseResolve = aCallable(C.resolve);
  7860. var errors = [];
  7861. var counter = 0;
  7862. var remaining = 1;
  7863. var alreadyResolved = false;
  7864. iterate(iterable, function (promise) {
  7865. var index = counter++;
  7866. var alreadyRejected = false;
  7867. remaining++;
  7868. call(promiseResolve, C, promise).then(function (value) {
  7869. if (alreadyRejected || alreadyResolved) return;
  7870. alreadyResolved = true;
  7871. resolve(value);
  7872. }, function (error) {
  7873. if (alreadyRejected || alreadyResolved) return;
  7874. alreadyRejected = true;
  7875. errors[index] = error;
  7876. --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
  7877. });
  7878. });
  7879. --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
  7880. });
  7881. if (result.error) reject(result.value);
  7882. return capability.promise;
  7883. }
  7884. });
  7885. /***/ }),
  7886. /* 315 */
  7887. /***/ (function(module, exports, __webpack_require__) {
  7888. "use strict";
  7889. var $ = __webpack_require__(0);
  7890. var IS_PURE = __webpack_require__(33);
  7891. var NativePromiseConstructor = __webpack_require__(65);
  7892. var fails = __webpack_require__(2);
  7893. var getBuiltIn = __webpack_require__(18);
  7894. var isCallable = __webpack_require__(8);
  7895. var speciesConstructor = __webpack_require__(173);
  7896. var promiseResolve = __webpack_require__(179);
  7897. var defineBuiltIn = __webpack_require__(44);
  7898. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  7899. // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
  7900. var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
  7901. // eslint-disable-next-line unicorn/no-thenable -- required for testing
  7902. NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
  7903. });
  7904. // `Promise.prototype.finally` method
  7905. // https://tc39.es/ecma262/#sec-promise.prototype.finally
  7906. $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
  7907. 'finally': function (onFinally) {
  7908. var C = speciesConstructor(this, getBuiltIn('Promise'));
  7909. var isFunction = isCallable(onFinally);
  7910. return this.then(
  7911. isFunction ? function (x) {
  7912. return promiseResolve(C, onFinally()).then(function () { return x; });
  7913. } : onFinally,
  7914. isFunction ? function (e) {
  7915. return promiseResolve(C, onFinally()).then(function () { throw e; });
  7916. } : onFinally
  7917. );
  7918. }
  7919. });
  7920. // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
  7921. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  7922. var method = getBuiltIn('Promise').prototype['finally'];
  7923. if (NativePromisePrototype['finally'] !== method) {
  7924. defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
  7925. }
  7926. }
  7927. /***/ }),
  7928. /* 316 */
  7929. /***/ (function(module, exports, __webpack_require__) {
  7930. var uncurryThis = __webpack_require__(4);
  7931. var toIntegerOrInfinity = __webpack_require__(126);
  7932. var toString = __webpack_require__(81);
  7933. var requireObjectCoercible = __webpack_require__(121);
  7934. var charAt = uncurryThis(''.charAt);
  7935. var charCodeAt = uncurryThis(''.charCodeAt);
  7936. var stringSlice = uncurryThis(''.slice);
  7937. var createMethod = function (CONVERT_TO_STRING) {
  7938. return function ($this, pos) {
  7939. var S = toString(requireObjectCoercible($this));
  7940. var position = toIntegerOrInfinity(pos);
  7941. var size = S.length;
  7942. var first, second;
  7943. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  7944. first = charCodeAt(S, position);
  7945. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  7946. || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
  7947. ? CONVERT_TO_STRING
  7948. ? charAt(S, position)
  7949. : first
  7950. : CONVERT_TO_STRING
  7951. ? stringSlice(S, position, position + 2)
  7952. : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  7953. };
  7954. };
  7955. module.exports = {
  7956. // `String.prototype.codePointAt` method
  7957. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  7958. codeAt: createMethod(false),
  7959. // `String.prototype.at` method
  7960. // https://github.com/mathiasbynens/String.prototype.at
  7961. charAt: createMethod(true)
  7962. };
  7963. /***/ }),
  7964. /* 317 */
  7965. /***/ (function(module, exports) {
  7966. // iterable DOM collections
  7967. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  7968. module.exports = {
  7969. CSSRuleList: 0,
  7970. CSSStyleDeclaration: 0,
  7971. CSSValueList: 0,
  7972. ClientRectList: 0,
  7973. DOMRectList: 0,
  7974. DOMStringList: 0,
  7975. DOMTokenList: 1,
  7976. DataTransferItemList: 0,
  7977. FileList: 0,
  7978. HTMLAllCollection: 0,
  7979. HTMLCollection: 0,
  7980. HTMLFormElement: 0,
  7981. HTMLSelectElement: 0,
  7982. MediaList: 0,
  7983. MimeTypeArray: 0,
  7984. NamedNodeMap: 0,
  7985. NodeList: 1,
  7986. PaintRequestList: 0,
  7987. Plugin: 0,
  7988. PluginArray: 0,
  7989. SVGLengthList: 0,
  7990. SVGNumberList: 0,
  7991. SVGPathSegList: 0,
  7992. SVGPointList: 0,
  7993. SVGStringList: 0,
  7994. SVGTransformList: 0,
  7995. SourceBufferList: 0,
  7996. StyleSheetList: 0,
  7997. TextTrackCueList: 0,
  7998. TextTrackList: 0,
  7999. TouchList: 0
  8000. };
  8001. /***/ }),
  8002. /* 318 */
  8003. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8004. "use strict";
  8005. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(132);
  8006. // Default Export
  8007. // ==============
  8008. // In this module, we mix our bundled exports into the `_` object and export
  8009. // the result. This is analogous to setting `module.exports = _` in CommonJS.
  8010. // Hence, this module is also the entry point of our UMD bundle and the package
  8011. // entry point for CommonJS and AMD users. In other words, this is (the source
  8012. // of) the module you are interfacing with when you do any of the following:
  8013. //
  8014. // ```js
  8015. // // CommonJS
  8016. // var _ = require('underscore');
  8017. //
  8018. // // AMD
  8019. // define(['underscore'], function(_) {...});
  8020. //
  8021. // // UMD in the browser
  8022. // // _ is available as a global variable
  8023. // ```
  8024. // Add all of the Underscore functions to the wrapper object.
  8025. var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
  8026. // Legacy Node.js API.
  8027. _._ = _;
  8028. // Export the Underscore API.
  8029. /* harmony default export */ __webpack_exports__["a"] = (_);
  8030. /***/ }),
  8031. /* 319 */
  8032. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8033. "use strict";
  8034. /* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
  8035. // Is a given value equal to null?
  8036. function isNull(obj) {
  8037. return obj === null;
  8038. }
  8039. /***/ }),
  8040. /* 320 */
  8041. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8042. "use strict";
  8043. /* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
  8044. // Is a given value a DOM element?
  8045. function isElement(obj) {
  8046. return !!(obj && obj.nodeType === 1);
  8047. }
  8048. /***/ }),
  8049. /* 321 */
  8050. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8051. "use strict";
  8052. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8053. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
  8054. /***/ }),
  8055. /* 322 */
  8056. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8057. "use strict";
  8058. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8059. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
  8060. /***/ }),
  8061. /* 323 */
  8062. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8063. "use strict";
  8064. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8065. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
  8066. /***/ }),
  8067. /* 324 */
  8068. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8069. "use strict";
  8070. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8071. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
  8072. /***/ }),
  8073. /* 325 */
  8074. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8075. "use strict";
  8076. /* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
  8077. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  8078. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(183);
  8079. // Is a given object a finite number?
  8080. function isFinite(obj) {
  8081. return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
  8082. }
  8083. /***/ }),
  8084. /* 326 */
  8085. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8086. "use strict";
  8087. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
  8088. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(136);
  8089. // Internal helper to determine whether we should spend extensive checks against
  8090. // `ArrayBuffer` et al.
  8091. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
  8092. /***/ }),
  8093. /* 327 */
  8094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8095. "use strict";
  8096. /* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
  8097. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
  8098. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
  8099. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133);
  8100. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135);
  8101. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(16);
  8102. // Is a given array, string, or object empty?
  8103. // An "empty" object has no enumerable own-properties.
  8104. function isEmpty(obj) {
  8105. if (obj == null) return true;
  8106. // Skip the more expensive `toString`-based type checks if `obj` has no
  8107. // `.length`.
  8108. var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
  8109. if (typeof length == 'number' && (
  8110. Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(obj)
  8111. )) return length === 0;
  8112. return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
  8113. }
  8114. /***/ }),
  8115. /* 328 */
  8116. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8117. "use strict";
  8118. /* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
  8119. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  8120. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  8121. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(136);
  8122. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(186);
  8123. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(28);
  8124. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(84);
  8125. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(134);
  8126. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(16);
  8127. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(45);
  8128. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(329);
  8129. // We use this string twice, so give it a name for minification.
  8130. var tagDataView = '[object DataView]';
  8131. // Internal recursive comparison function for `_.isEqual`.
  8132. function eq(a, b, aStack, bStack) {
  8133. // Identical objects are equal. `0 === -0`, but they aren't identical.
  8134. // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
  8135. if (a === b) return a !== 0 || 1 / a === 1 / b;
  8136. // `null` or `undefined` only equal to itself (strict comparison).
  8137. if (a == null || b == null) return false;
  8138. // `NaN`s are equivalent, but non-reflexive.
  8139. if (a !== a) return b !== b;
  8140. // Exhaust primitive checks
  8141. var type = typeof a;
  8142. if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
  8143. return deepEq(a, b, aStack, bStack);
  8144. }
  8145. // Internal recursive comparison function for `_.isEqual`.
  8146. function deepEq(a, b, aStack, bStack) {
  8147. // Unwrap any wrapped objects.
  8148. if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
  8149. if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
  8150. // Compare `[[Class]]` names.
  8151. var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
  8152. if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
  8153. // Work around a bug in IE 10 - Edge 13.
  8154. if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
  8155. if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
  8156. className = tagDataView;
  8157. }
  8158. switch (className) {
  8159. // These types are compared by value.
  8160. case '[object RegExp]':
  8161. // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
  8162. case '[object String]':
  8163. // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
  8164. // equivalent to `new String("5")`.
  8165. return '' + a === '' + b;
  8166. case '[object Number]':
  8167. // `NaN`s are equivalent, but non-reflexive.
  8168. // Object(NaN) is equivalent to NaN.
  8169. if (+a !== +a) return +b !== +b;
  8170. // An `egal` comparison is performed for other numeric values.
  8171. return +a === 0 ? 1 / +a === 1 / b : +a === +b;
  8172. case '[object Date]':
  8173. case '[object Boolean]':
  8174. // Coerce dates and booleans to numeric primitive values. Dates are compared by their
  8175. // millisecond representations. Note that invalid dates with millisecond representations
  8176. // of `NaN` are not equivalent.
  8177. return +a === +b;
  8178. case '[object Symbol]':
  8179. return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
  8180. case '[object ArrayBuffer]':
  8181. case tagDataView:
  8182. // Coerce to typed array so we can fall through.
  8183. return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
  8184. }
  8185. var areArrays = className === '[object Array]';
  8186. if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
  8187. var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
  8188. if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
  8189. if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
  8190. areArrays = true;
  8191. }
  8192. if (!areArrays) {
  8193. if (typeof a != 'object' || typeof b != 'object') return false;
  8194. // Objects with different constructors are not equivalent, but `Object`s or `Array`s
  8195. // from different frames are.
  8196. var aCtor = a.constructor, bCtor = b.constructor;
  8197. if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
  8198. Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
  8199. && ('constructor' in a && 'constructor' in b)) {
  8200. return false;
  8201. }
  8202. }
  8203. // Assume equality for cyclic structures. The algorithm for detecting cyclic
  8204. // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
  8205. // Initializing stack of traversed objects.
  8206. // It's done here since we only need them for objects and arrays comparison.
  8207. aStack = aStack || [];
  8208. bStack = bStack || [];
  8209. var length = aStack.length;
  8210. while (length--) {
  8211. // Linear search. Performance is inversely proportional to the number of
  8212. // unique nested structures.
  8213. if (aStack[length] === a) return bStack[length] === b;
  8214. }
  8215. // Add the first object to the stack of traversed objects.
  8216. aStack.push(a);
  8217. bStack.push(b);
  8218. // Recursively compare objects and arrays.
  8219. if (areArrays) {
  8220. // Compare array lengths to determine if a deep comparison is necessary.
  8221. length = a.length;
  8222. if (length !== b.length) return false;
  8223. // Deep compare the contents, ignoring non-numeric properties.
  8224. while (length--) {
  8225. if (!eq(a[length], b[length], aStack, bStack)) return false;
  8226. }
  8227. } else {
  8228. // Deep compare objects.
  8229. var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
  8230. length = _keys.length;
  8231. // Ensure that both objects contain the same number of properties before comparing deep equality.
  8232. if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
  8233. while (length--) {
  8234. // Deep compare each member
  8235. key = _keys[length];
  8236. if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
  8237. }
  8238. }
  8239. // Remove the first object from the stack of traversed objects.
  8240. aStack.pop();
  8241. bStack.pop();
  8242. return true;
  8243. }
  8244. // Perform a deep comparison to check if two objects are equal.
  8245. function isEqual(a, b) {
  8246. return eq(a, b);
  8247. }
  8248. /***/ }),
  8249. /* 329 */
  8250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8251. "use strict";
  8252. /* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
  8253. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(136);
  8254. // Internal function to wrap or shallow-copy an ArrayBuffer,
  8255. // typed array or DataView to a new view, reusing the buffer.
  8256. function toBufferView(bufferSource) {
  8257. return new Uint8Array(
  8258. bufferSource.buffer || bufferSource,
  8259. bufferSource.byteOffset || 0,
  8260. Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
  8261. );
  8262. }
  8263. /***/ }),
  8264. /* 330 */
  8265. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8266. "use strict";
  8267. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8268. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
  8269. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
  8270. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["b" /* mapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Map'));
  8271. /***/ }),
  8272. /* 331 */
  8273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8274. "use strict";
  8275. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8276. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
  8277. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
  8278. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["d" /* weakMapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakMap'));
  8279. /***/ }),
  8280. /* 332 */
  8281. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8282. "use strict";
  8283. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8284. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
  8285. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
  8286. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["c" /* setMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Set'));
  8287. /***/ }),
  8288. /* 333 */
  8289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8290. "use strict";
  8291. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
  8292. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
  8293. /***/ }),
  8294. /* 334 */
  8295. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8296. "use strict";
  8297. /* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
  8298. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
  8299. // Convert an object into a list of `[key, value]` pairs.
  8300. // The opposite of `_.object` with one argument.
  8301. function pairs(obj) {
  8302. var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
  8303. var length = _keys.length;
  8304. var pairs = Array(length);
  8305. for (var i = 0; i < length; i++) {
  8306. pairs[i] = [_keys[i], obj[_keys[i]]];
  8307. }
  8308. return pairs;
  8309. }
  8310. /***/ }),
  8311. /* 335 */
  8312. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8313. "use strict";
  8314. /* harmony export (immutable) */ __webpack_exports__["a"] = create;
  8315. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
  8316. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(139);
  8317. // Creates an object that inherits from the given prototype object.
  8318. // If additional properties are provided then they will be added to the
  8319. // created object.
  8320. function create(prototype, props) {
  8321. var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
  8322. if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
  8323. return result;
  8324. }
  8325. /***/ }),
  8326. /* 336 */
  8327. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8328. "use strict";
  8329. /* harmony export (immutable) */ __webpack_exports__["a"] = tap;
  8330. // Invokes `interceptor` with the `obj` and then returns `obj`.
  8331. // The primary purpose of this method is to "tap into" a method chain, in
  8332. // order to perform operations on intermediate results within the chain.
  8333. function tap(obj, interceptor) {
  8334. interceptor(obj);
  8335. return obj;
  8336. }
  8337. /***/ }),
  8338. /* 337 */
  8339. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8340. "use strict";
  8341. /* harmony export (immutable) */ __webpack_exports__["a"] = has;
  8342. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
  8343. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
  8344. // Shortcut function for checking if an object has a given property directly on
  8345. // itself (in other words, not on a prototype). Unlike the internal `has`
  8346. // function, this public version can also traverse nested properties.
  8347. function has(obj, path) {
  8348. path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
  8349. var length = path.length;
  8350. for (var i = 0; i < length; i++) {
  8351. var key = path[i];
  8352. if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
  8353. obj = obj[key];
  8354. }
  8355. return !!length;
  8356. }
  8357. /***/ }),
  8358. /* 338 */
  8359. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8360. "use strict";
  8361. /* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
  8362. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  8363. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
  8364. // Returns the results of applying the `iteratee` to each element of `obj`.
  8365. // In contrast to `_.map` it returns an object.
  8366. function mapObject(obj, iteratee, context) {
  8367. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
  8368. var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
  8369. length = _keys.length,
  8370. results = {};
  8371. for (var index = 0; index < length; index++) {
  8372. var currentKey = _keys[index];
  8373. results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
  8374. }
  8375. return results;
  8376. }
  8377. /***/ }),
  8378. /* 339 */
  8379. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8380. "use strict";
  8381. /* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
  8382. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(202);
  8383. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(198);
  8384. // Generates a function for a given object that returns a given property.
  8385. function propertyOf(obj) {
  8386. if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
  8387. return function(path) {
  8388. return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
  8389. };
  8390. }
  8391. /***/ }),
  8392. /* 340 */
  8393. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8394. "use strict";
  8395. /* harmony export (immutable) */ __webpack_exports__["a"] = times;
  8396. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
  8397. // Run a function **n** times.
  8398. function times(n, iteratee, context) {
  8399. var accum = Array(Math.max(0, n));
  8400. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
  8401. for (var i = 0; i < n; i++) accum[i] = iteratee(i);
  8402. return accum;
  8403. }
  8404. /***/ }),
  8405. /* 341 */
  8406. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8407. "use strict";
  8408. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
  8409. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
  8410. // Function for escaping strings to HTML interpolation.
  8411. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
  8412. /***/ }),
  8413. /* 342 */
  8414. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8415. "use strict";
  8416. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
  8417. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(343);
  8418. // Function for unescaping strings from HTML interpolation.
  8419. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
  8420. /***/ }),
  8421. /* 343 */
  8422. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8423. "use strict";
  8424. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(192);
  8425. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
  8426. // Internal list of HTML entities for unescaping.
  8427. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
  8428. /***/ }),
  8429. /* 344 */
  8430. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8431. "use strict";
  8432. /* harmony export (immutable) */ __webpack_exports__["a"] = template;
  8433. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(195);
  8434. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
  8435. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(206);
  8436. // When customizing `_.templateSettings`, if you don't want to define an
  8437. // interpolation, evaluation or escaping regex, we need one that is
  8438. // guaranteed not to match.
  8439. var noMatch = /(.)^/;
  8440. // Certain characters need to be escaped so that they can be put into a
  8441. // string literal.
  8442. var escapes = {
  8443. "'": "'",
  8444. '\\': '\\',
  8445. '\r': 'r',
  8446. '\n': 'n',
  8447. '\u2028': 'u2028',
  8448. '\u2029': 'u2029'
  8449. };
  8450. var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
  8451. function escapeChar(match) {
  8452. return '\\' + escapes[match];
  8453. }
  8454. var bareIdentifier = /^\s*(\w|\$)+\s*$/;
  8455. // JavaScript micro-templating, similar to John Resig's implementation.
  8456. // Underscore templating handles arbitrary delimiters, preserves whitespace,
  8457. // and correctly escapes quotes within interpolated code.
  8458. // NB: `oldSettings` only exists for backwards compatibility.
  8459. function template(text, settings, oldSettings) {
  8460. if (!settings && oldSettings) settings = oldSettings;
  8461. settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
  8462. // Combine delimiters into one regular expression via alternation.
  8463. var matcher = RegExp([
  8464. (settings.escape || noMatch).source,
  8465. (settings.interpolate || noMatch).source,
  8466. (settings.evaluate || noMatch).source
  8467. ].join('|') + '|$', 'g');
  8468. // Compile the template source, escaping string literals appropriately.
  8469. var index = 0;
  8470. var source = "__p+='";
  8471. text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
  8472. source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
  8473. index = offset + match.length;
  8474. if (escape) {
  8475. source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
  8476. } else if (interpolate) {
  8477. source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
  8478. } else if (evaluate) {
  8479. source += "';\n" + evaluate + "\n__p+='";
  8480. }
  8481. // Adobe VMs need the match returned to produce the correct offset.
  8482. return match;
  8483. });
  8484. source += "';\n";
  8485. var argument = settings.variable;
  8486. if (argument) {
  8487. if (!bareIdentifier.test(argument)) throw new Error(argument);
  8488. } else {
  8489. // If a variable is not specified, place data values in local scope.
  8490. source = 'with(obj||{}){\n' + source + '}\n';
  8491. argument = 'obj';
  8492. }
  8493. source = "var __t,__p='',__j=Array.prototype.join," +
  8494. "print=function(){__p+=__j.call(arguments,'');};\n" +
  8495. source + 'return __p;\n';
  8496. var render;
  8497. try {
  8498. render = new Function(argument, '_', source);
  8499. } catch (e) {
  8500. e.source = source;
  8501. throw e;
  8502. }
  8503. var template = function(data) {
  8504. return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
  8505. };
  8506. // Provide the compiled source as a convenience for precompilation.
  8507. template.source = 'function(' + argument + '){\n' + source + '}';
  8508. return template;
  8509. }
  8510. /***/ }),
  8511. /* 345 */
  8512. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8513. "use strict";
  8514. /* harmony export (immutable) */ __webpack_exports__["a"] = result;
  8515. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
  8516. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
  8517. // Traverses the children of `obj` along `path`. If a child is a function, it
  8518. // is invoked with its parent as context. Returns the value of the final
  8519. // child, or `fallback` if any child is undefined.
  8520. function result(obj, path, fallback) {
  8521. path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
  8522. var length = path.length;
  8523. if (!length) {
  8524. return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
  8525. }
  8526. for (var i = 0; i < length; i++) {
  8527. var prop = obj == null ? void 0 : obj[path[i]];
  8528. if (prop === void 0) {
  8529. prop = fallback;
  8530. i = length; // Ensure we don't continue iterating.
  8531. }
  8532. obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
  8533. }
  8534. return obj;
  8535. }
  8536. /***/ }),
  8537. /* 346 */
  8538. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8539. "use strict";
  8540. /* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
  8541. // Generate a unique integer id (unique within the entire client session).
  8542. // Useful for temporary DOM ids.
  8543. var idCounter = 0;
  8544. function uniqueId(prefix) {
  8545. var id = ++idCounter + '';
  8546. return prefix ? prefix + id : id;
  8547. }
  8548. /***/ }),
  8549. /* 347 */
  8550. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8551. "use strict";
  8552. /* harmony export (immutable) */ __webpack_exports__["a"] = chain;
  8553. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  8554. // Start chaining a wrapped Underscore object.
  8555. function chain(obj) {
  8556. var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
  8557. instance._chain = true;
  8558. return instance;
  8559. }
  8560. /***/ }),
  8561. /* 348 */
  8562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8563. "use strict";
  8564. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  8565. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
  8566. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(208);
  8567. // Bind a number of an object's methods to that object. Remaining arguments
  8568. // are the method names to be bound. Useful for ensuring that all callbacks
  8569. // defined on an object belong to it.
  8570. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
  8571. keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
  8572. var index = keys.length;
  8573. if (index < 1) throw new Error('bindAll must be passed function names');
  8574. while (index--) {
  8575. var key = keys[index];
  8576. obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
  8577. }
  8578. return obj;
  8579. }));
  8580. /***/ }),
  8581. /* 349 */
  8582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8583. "use strict";
  8584. /* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
  8585. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
  8586. // Memoize an expensive function by storing its results.
  8587. function memoize(func, hasher) {
  8588. var memoize = function(key) {
  8589. var cache = memoize.cache;
  8590. var address = '' + (hasher ? hasher.apply(this, arguments) : key);
  8591. if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
  8592. return cache[address];
  8593. };
  8594. memoize.cache = {};
  8595. return memoize;
  8596. }
  8597. /***/ }),
  8598. /* 350 */
  8599. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8600. "use strict";
  8601. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
  8602. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(209);
  8603. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
  8604. // Defers a function, scheduling it to run after the current call stack has
  8605. // cleared.
  8606. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__delay_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */], 1));
  8607. /***/ }),
  8608. /* 351 */
  8609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8610. "use strict";
  8611. /* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
  8612. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(143);
  8613. // Returns a function, that, when invoked, will only be triggered at most once
  8614. // during a given window of time. Normally, the throttled function will run
  8615. // as much as it can, without ever going more than once per `wait` duration;
  8616. // but if you'd like to disable the execution on the leading edge, pass
  8617. // `{leading: false}`. To disable execution on the trailing edge, ditto.
  8618. function throttle(func, wait, options) {
  8619. var timeout, context, args, result;
  8620. var previous = 0;
  8621. if (!options) options = {};
  8622. var later = function() {
  8623. previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
  8624. timeout = null;
  8625. result = func.apply(context, args);
  8626. if (!timeout) context = args = null;
  8627. };
  8628. var throttled = function() {
  8629. var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
  8630. if (!previous && options.leading === false) previous = _now;
  8631. var remaining = wait - (_now - previous);
  8632. context = this;
  8633. args = arguments;
  8634. if (remaining <= 0 || remaining > wait) {
  8635. if (timeout) {
  8636. clearTimeout(timeout);
  8637. timeout = null;
  8638. }
  8639. previous = _now;
  8640. result = func.apply(context, args);
  8641. if (!timeout) context = args = null;
  8642. } else if (!timeout && options.trailing !== false) {
  8643. timeout = setTimeout(later, remaining);
  8644. }
  8645. return result;
  8646. };
  8647. throttled.cancel = function() {
  8648. clearTimeout(timeout);
  8649. previous = 0;
  8650. timeout = context = args = null;
  8651. };
  8652. return throttled;
  8653. }
  8654. /***/ }),
  8655. /* 352 */
  8656. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8657. "use strict";
  8658. /* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
  8659. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  8660. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(143);
  8661. // When a sequence of calls of the returned function ends, the argument
  8662. // function is triggered. The end of a sequence is defined by the `wait`
  8663. // parameter. If `immediate` is passed, the argument function will be
  8664. // triggered at the beginning of the sequence instead of at the end.
  8665. function debounce(func, wait, immediate) {
  8666. var timeout, previous, args, result, context;
  8667. var later = function() {
  8668. var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
  8669. if (wait > passed) {
  8670. timeout = setTimeout(later, wait - passed);
  8671. } else {
  8672. timeout = null;
  8673. if (!immediate) result = func.apply(context, args);
  8674. // This check is needed because `func` can recursively invoke `debounced`.
  8675. if (!timeout) args = context = null;
  8676. }
  8677. };
  8678. var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
  8679. context = this;
  8680. args = _args;
  8681. previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
  8682. if (!timeout) {
  8683. timeout = setTimeout(later, wait);
  8684. if (immediate) result = func.apply(context, args);
  8685. }
  8686. return result;
  8687. });
  8688. debounced.cancel = function() {
  8689. clearTimeout(timeout);
  8690. timeout = args = context = null;
  8691. };
  8692. return debounced;
  8693. }
  8694. /***/ }),
  8695. /* 353 */
  8696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8697. "use strict";
  8698. /* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
  8699. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
  8700. // Returns the first function passed as an argument to the second,
  8701. // allowing you to adjust arguments, run code before and after, and
  8702. // conditionally execute the original function.
  8703. function wrap(func, wrapper) {
  8704. return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
  8705. }
  8706. /***/ }),
  8707. /* 354 */
  8708. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8709. "use strict";
  8710. /* harmony export (immutable) */ __webpack_exports__["a"] = compose;
  8711. // Returns a function that is the composition of a list of functions, each
  8712. // consuming the return value of the function that follows.
  8713. function compose() {
  8714. var args = arguments;
  8715. var start = args.length - 1;
  8716. return function() {
  8717. var i = start;
  8718. var result = args[start].apply(this, arguments);
  8719. while (i--) result = args[i].call(this, result);
  8720. return result;
  8721. };
  8722. }
  8723. /***/ }),
  8724. /* 355 */
  8725. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8726. "use strict";
  8727. /* harmony export (immutable) */ __webpack_exports__["a"] = after;
  8728. // Returns a function that will only be executed on and after the Nth call.
  8729. function after(times, func) {
  8730. return function() {
  8731. if (--times < 1) {
  8732. return func.apply(this, arguments);
  8733. }
  8734. };
  8735. }
  8736. /***/ }),
  8737. /* 356 */
  8738. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8739. "use strict";
  8740. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
  8741. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(210);
  8742. // Returns a function that will be executed at most one time, no matter how
  8743. // often you call it. Useful for lazy initialization.
  8744. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
  8745. /***/ }),
  8746. /* 357 */
  8747. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8748. "use strict";
  8749. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(213);
  8750. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(216);
  8751. // Return the position of the last occurrence of an item in an array,
  8752. // or -1 if the item is not included in the array.
  8753. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
  8754. /***/ }),
  8755. /* 358 */
  8756. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8757. "use strict";
  8758. /* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
  8759. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(217);
  8760. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
  8761. // Convenience version of a common use case of `_.find`: getting the first
  8762. // object containing specific `key:value` pairs.
  8763. function findWhere(obj, attrs) {
  8764. return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
  8765. }
  8766. /***/ }),
  8767. /* 359 */
  8768. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8769. "use strict";
  8770. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
  8771. // **Reduce** builds up a single result from a list of values, aka `inject`,
  8772. // or `foldl`.
  8773. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
  8774. /***/ }),
  8775. /* 360 */
  8776. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8777. "use strict";
  8778. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
  8779. // The right-associative version of reduce, also known as `foldr`.
  8780. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
  8781. /***/ }),
  8782. /* 361 */
  8783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8784. "use strict";
  8785. /* harmony export (immutable) */ __webpack_exports__["a"] = reject;
  8786. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
  8787. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(144);
  8788. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
  8789. // Return all the elements for which a truth test fails.
  8790. function reject(obj, predicate, context) {
  8791. return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__negate_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(predicate)), context);
  8792. }
  8793. /***/ }),
  8794. /* 362 */
  8795. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8796. "use strict";
  8797. /* harmony export (immutable) */ __webpack_exports__["a"] = every;
  8798. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  8799. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
  8800. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
  8801. // Determine whether all of the elements pass a truth test.
  8802. function every(obj, predicate, context) {
  8803. predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
  8804. var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
  8805. length = (_keys || obj).length;
  8806. for (var index = 0; index < length; index++) {
  8807. var currentKey = _keys ? _keys[index] : index;
  8808. if (!predicate(obj[currentKey], currentKey, obj)) return false;
  8809. }
  8810. return true;
  8811. }
  8812. /***/ }),
  8813. /* 363 */
  8814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8815. "use strict";
  8816. /* harmony export (immutable) */ __webpack_exports__["a"] = some;
  8817. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  8818. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
  8819. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
  8820. // Determine if at least one element in the object passes a truth test.
  8821. function some(obj, predicate, context) {
  8822. predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
  8823. var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
  8824. length = (_keys || obj).length;
  8825. for (var index = 0; index < length; index++) {
  8826. var currentKey = _keys ? _keys[index] : index;
  8827. if (predicate(obj[currentKey], currentKey, obj)) return true;
  8828. }
  8829. return false;
  8830. }
  8831. /***/ }),
  8832. /* 364 */
  8833. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8834. "use strict";
  8835. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  8836. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  8837. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
  8838. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(140);
  8839. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(86);
  8840. // Invoke a method (with arguments) on every item in a collection.
  8841. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
  8842. var contextPath, func;
  8843. if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
  8844. func = path;
  8845. } else {
  8846. path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
  8847. contextPath = path.slice(0, -1);
  8848. path = path[path.length - 1];
  8849. }
  8850. return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
  8851. var method = func;
  8852. if (!method) {
  8853. if (contextPath && contextPath.length) {
  8854. context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
  8855. }
  8856. if (context == null) return void 0;
  8857. method = context[path];
  8858. }
  8859. return method == null ? method : method.apply(context, args);
  8860. });
  8861. }));
  8862. /***/ }),
  8863. /* 365 */
  8864. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8865. "use strict";
  8866. /* harmony export (immutable) */ __webpack_exports__["a"] = where;
  8867. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
  8868. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
  8869. // Convenience version of a common use case of `_.filter`: selecting only
  8870. // objects containing specific `key:value` pairs.
  8871. function where(obj, attrs) {
  8872. return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
  8873. }
  8874. /***/ }),
  8875. /* 366 */
  8876. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8877. "use strict";
  8878. /* harmony export (immutable) */ __webpack_exports__["a"] = min;
  8879. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  8880. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
  8881. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
  8882. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
  8883. // Return the minimum element (or element-based computation).
  8884. function min(obj, iteratee, context) {
  8885. var result = Infinity, lastComputed = Infinity,
  8886. value, computed;
  8887. if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
  8888. obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
  8889. for (var i = 0, length = obj.length; i < length; i++) {
  8890. value = obj[i];
  8891. if (value != null && value < result) {
  8892. result = value;
  8893. }
  8894. }
  8895. } else {
  8896. iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
  8897. Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
  8898. computed = iteratee(v, index, list);
  8899. if (computed < lastComputed || computed === Infinity && result === Infinity) {
  8900. result = v;
  8901. lastComputed = computed;
  8902. }
  8903. });
  8904. }
  8905. return result;
  8906. }
  8907. /***/ }),
  8908. /* 367 */
  8909. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8910. "use strict";
  8911. /* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
  8912. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(220);
  8913. // Shuffle a collection.
  8914. function shuffle(obj) {
  8915. return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
  8916. }
  8917. /***/ }),
  8918. /* 368 */
  8919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8920. "use strict";
  8921. /* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
  8922. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
  8923. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(146);
  8924. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
  8925. // Sort the object's values by a criterion produced by an iteratee.
  8926. function sortBy(obj, iteratee, context) {
  8927. var index = 0;
  8928. iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
  8929. return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
  8930. return {
  8931. value: value,
  8932. index: index++,
  8933. criteria: iteratee(value, key, list)
  8934. };
  8935. }).sort(function(left, right) {
  8936. var a = left.criteria;
  8937. var b = right.criteria;
  8938. if (a !== b) {
  8939. if (a > b || a === void 0) return 1;
  8940. if (a < b || b === void 0) return -1;
  8941. }
  8942. return left.index - right.index;
  8943. }), 'value');
  8944. }
  8945. /***/ }),
  8946. /* 369 */
  8947. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8948. "use strict";
  8949. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
  8950. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
  8951. // Groups the object's values by a criterion. Pass either a string attribute
  8952. // to group by, or a function that returns the criterion.
  8953. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
  8954. if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
  8955. }));
  8956. /***/ }),
  8957. /* 370 */
  8958. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8959. "use strict";
  8960. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
  8961. // Indexes the object's values by a criterion, similar to `_.groupBy`, but for
  8962. // when you know that your index values will be unique.
  8963. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
  8964. result[key] = value;
  8965. }));
  8966. /***/ }),
  8967. /* 371 */
  8968. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8969. "use strict";
  8970. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
  8971. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
  8972. // Counts instances of an object that group by a certain criterion. Pass
  8973. // either a string attribute to count by, or a function that returns the
  8974. // criterion.
  8975. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
  8976. if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
  8977. }));
  8978. /***/ }),
  8979. /* 372 */
  8980. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8981. "use strict";
  8982. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
  8983. // Split a collection into two arrays: one whose elements all pass the given
  8984. // truth test, and one whose elements all do not pass the truth test.
  8985. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
  8986. result[pass ? 0 : 1].push(value);
  8987. }, true));
  8988. /***/ }),
  8989. /* 373 */
  8990. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8991. "use strict";
  8992. /* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
  8993. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(57);
  8994. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
  8995. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133);
  8996. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
  8997. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(68);
  8998. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(141);
  8999. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(66);
  9000. // Safely create a real, live array from anything iterable.
  9001. var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
  9002. function toArray(obj) {
  9003. if (!obj) return [];
  9004. if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
  9005. if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
  9006. // Keep surrogate pair characters together.
  9007. return obj.match(reStrSymbol);
  9008. }
  9009. if (Object(__WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__["a" /* default */])(obj)) return Object(__WEBPACK_IMPORTED_MODULE_4__map_js__["a" /* default */])(obj, __WEBPACK_IMPORTED_MODULE_5__identity_js__["a" /* default */]);
  9010. return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
  9011. }
  9012. /***/ }),
  9013. /* 374 */
  9014. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9015. "use strict";
  9016. /* harmony export (immutable) */ __webpack_exports__["a"] = size;
  9017. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
  9018. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
  9019. // Return the number of elements in a collection.
  9020. function size(obj) {
  9021. if (obj == null) return 0;
  9022. return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
  9023. }
  9024. /***/ }),
  9025. /* 375 */
  9026. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9027. "use strict";
  9028. /* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
  9029. // Internal `_.pick` helper function to determine whether `key` is an enumerable
  9030. // property name of `obj`.
  9031. function keyInObj(value, key, obj) {
  9032. return key in obj;
  9033. }
  9034. /***/ }),
  9035. /* 376 */
  9036. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9037. "use strict";
  9038. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  9039. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
  9040. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(144);
  9041. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(68);
  9042. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(67);
  9043. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(89);
  9044. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(221);
  9045. // Return a copy of the object without the disallowed properties.
  9046. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
  9047. var iteratee = keys[0], context;
  9048. if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
  9049. iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
  9050. if (keys.length > 1) context = keys[1];
  9051. } else {
  9052. keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
  9053. iteratee = function(value, key) {
  9054. return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
  9055. };
  9056. }
  9057. return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
  9058. }));
  9059. /***/ }),
  9060. /* 377 */
  9061. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9062. "use strict";
  9063. /* harmony export (immutable) */ __webpack_exports__["a"] = first;
  9064. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(222);
  9065. // Get the first element of an array. Passing **n** will return the first N
  9066. // values in the array. The **guard** check allows it to work with `_.map`.
  9067. function first(array, n, guard) {
  9068. if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
  9069. if (n == null || guard) return array[0];
  9070. return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
  9071. }
  9072. /***/ }),
  9073. /* 378 */
  9074. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9075. "use strict";
  9076. /* harmony export (immutable) */ __webpack_exports__["a"] = last;
  9077. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(223);
  9078. // Get the last element of an array. Passing **n** will return the last N
  9079. // values in the array.
  9080. function last(array, n, guard) {
  9081. if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
  9082. if (n == null || guard) return array[array.length - 1];
  9083. return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
  9084. }
  9085. /***/ }),
  9086. /* 379 */
  9087. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9088. "use strict";
  9089. /* harmony export (immutable) */ __webpack_exports__["a"] = compact;
  9090. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
  9091. // Trim out all falsy values from an array.
  9092. function compact(array) {
  9093. return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
  9094. }
  9095. /***/ }),
  9096. /* 380 */
  9097. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9098. "use strict";
  9099. /* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
  9100. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(67);
  9101. // Flatten out an array, either recursively (by default), or up to `depth`.
  9102. // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
  9103. function flatten(array, depth) {
  9104. return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
  9105. }
  9106. /***/ }),
  9107. /* 381 */
  9108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9109. "use strict";
  9110. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  9111. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(224);
  9112. // Return a version of the array that does not contain the specified value(s).
  9113. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
  9114. return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
  9115. }));
  9116. /***/ }),
  9117. /* 382 */
  9118. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9119. "use strict";
  9120. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  9121. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(225);
  9122. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(67);
  9123. // Produce an array that contains the union: each distinct element from all of
  9124. // the passed-in arrays.
  9125. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
  9126. return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
  9127. }));
  9128. /***/ }),
  9129. /* 383 */
  9130. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9131. "use strict";
  9132. /* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
  9133. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
  9134. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(89);
  9135. // Produce an array that contains every item shared between all the
  9136. // passed-in arrays.
  9137. function intersection(array) {
  9138. var result = [];
  9139. var argsLength = arguments.length;
  9140. for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
  9141. var item = array[i];
  9142. if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
  9143. var j;
  9144. for (j = 1; j < argsLength; j++) {
  9145. if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
  9146. }
  9147. if (j === argsLength) result.push(item);
  9148. }
  9149. return result;
  9150. }
  9151. /***/ }),
  9152. /* 384 */
  9153. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9154. "use strict";
  9155. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
  9156. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(226);
  9157. // Zip together multiple lists into a single array -- elements that share
  9158. // an index go together.
  9159. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
  9160. /***/ }),
  9161. /* 385 */
  9162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9163. "use strict";
  9164. /* harmony export (immutable) */ __webpack_exports__["a"] = object;
  9165. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
  9166. // Converts lists into objects. Pass either a single array of `[key, value]`
  9167. // pairs, or two parallel arrays of the same length -- one of keys, and one of
  9168. // the corresponding values. Passing by pairs is the reverse of `_.pairs`.
  9169. function object(list, values) {
  9170. var result = {};
  9171. for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
  9172. if (values) {
  9173. result[list[i]] = values[i];
  9174. } else {
  9175. result[list[i][0]] = list[i][1];
  9176. }
  9177. }
  9178. return result;
  9179. }
  9180. /***/ }),
  9181. /* 386 */
  9182. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9183. "use strict";
  9184. /* harmony export (immutable) */ __webpack_exports__["a"] = range;
  9185. // Generate an integer Array containing an arithmetic progression. A port of
  9186. // the native Python `range()` function. See
  9187. // [the Python documentation](https://docs.python.org/library/functions.html#range).
  9188. function range(start, stop, step) {
  9189. if (stop == null) {
  9190. stop = start || 0;
  9191. start = 0;
  9192. }
  9193. if (!step) {
  9194. step = stop < start ? -1 : 1;
  9195. }
  9196. var length = Math.max(Math.ceil((stop - start) / step), 0);
  9197. var range = Array(length);
  9198. for (var idx = 0; idx < length; idx++, start += step) {
  9199. range[idx] = start;
  9200. }
  9201. return range;
  9202. }
  9203. /***/ }),
  9204. /* 387 */
  9205. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9206. "use strict";
  9207. /* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
  9208. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
  9209. // Chunk a single array into multiple arrays, each containing `count` or fewer
  9210. // items.
  9211. function chunk(array, count) {
  9212. if (count == null || count < 1) return [];
  9213. var result = [];
  9214. var i = 0, length = array.length;
  9215. while (i < length) {
  9216. result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
  9217. }
  9218. return result;
  9219. }
  9220. /***/ }),
  9221. /* 388 */
  9222. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9223. "use strict";
  9224. /* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
  9225. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  9226. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
  9227. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(193);
  9228. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
  9229. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(227);
  9230. // Add your own custom functions to the Underscore object.
  9231. function mixin(obj) {
  9232. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
  9233. var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
  9234. __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
  9235. var args = [this._wrapped];
  9236. __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
  9237. return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
  9238. };
  9239. });
  9240. return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
  9241. }
  9242. /***/ }),
  9243. /* 389 */
  9244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9245. "use strict";
  9246. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
  9247. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
  9248. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
  9249. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(227);
  9250. // Add all mutator `Array` functions to the wrapper.
  9251. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
  9252. var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
  9253. __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
  9254. var obj = this._wrapped;
  9255. if (obj != null) {
  9256. method.apply(obj, arguments);
  9257. if ((name === 'shift' || name === 'splice') && obj.length === 0) {
  9258. delete obj[0];
  9259. }
  9260. }
  9261. return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
  9262. };
  9263. });
  9264. // Add all accessor `Array` functions to the wrapper.
  9265. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
  9266. var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
  9267. __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
  9268. var obj = this._wrapped;
  9269. if (obj != null) obj = method.apply(obj, arguments);
  9270. return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
  9271. };
  9272. });
  9273. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
  9274. /***/ }),
  9275. /* 390 */
  9276. /***/ (function(module, exports, __webpack_require__) {
  9277. var parent = __webpack_require__(391);
  9278. module.exports = parent;
  9279. /***/ }),
  9280. /* 391 */
  9281. /***/ (function(module, exports, __webpack_require__) {
  9282. var isPrototypeOf = __webpack_require__(19);
  9283. var method = __webpack_require__(392);
  9284. var ArrayPrototype = Array.prototype;
  9285. module.exports = function (it) {
  9286. var own = it.concat;
  9287. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
  9288. };
  9289. /***/ }),
  9290. /* 392 */
  9291. /***/ (function(module, exports, __webpack_require__) {
  9292. __webpack_require__(228);
  9293. var entryVirtual = __webpack_require__(40);
  9294. module.exports = entryVirtual('Array').concat;
  9295. /***/ }),
  9296. /* 393 */
  9297. /***/ (function(module, exports) {
  9298. var $TypeError = TypeError;
  9299. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
  9300. module.exports = function (it) {
  9301. if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
  9302. return it;
  9303. };
  9304. /***/ }),
  9305. /* 394 */
  9306. /***/ (function(module, exports, __webpack_require__) {
  9307. var isArray = __webpack_require__(90);
  9308. var isConstructor = __webpack_require__(109);
  9309. var isObject = __webpack_require__(11);
  9310. var wellKnownSymbol = __webpack_require__(9);
  9311. var SPECIES = wellKnownSymbol('species');
  9312. var $Array = Array;
  9313. // a part of `ArraySpeciesCreate` abstract operation
  9314. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  9315. module.exports = function (originalArray) {
  9316. var C;
  9317. if (isArray(originalArray)) {
  9318. C = originalArray.constructor;
  9319. // cross-realm fallback
  9320. if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
  9321. else if (isObject(C)) {
  9322. C = C[SPECIES];
  9323. if (C === null) C = undefined;
  9324. }
  9325. } return C === undefined ? $Array : C;
  9326. };
  9327. /***/ }),
  9328. /* 395 */
  9329. /***/ (function(module, exports, __webpack_require__) {
  9330. var parent = __webpack_require__(396);
  9331. module.exports = parent;
  9332. /***/ }),
  9333. /* 396 */
  9334. /***/ (function(module, exports, __webpack_require__) {
  9335. var isPrototypeOf = __webpack_require__(19);
  9336. var method = __webpack_require__(397);
  9337. var ArrayPrototype = Array.prototype;
  9338. module.exports = function (it) {
  9339. var own = it.map;
  9340. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
  9341. };
  9342. /***/ }),
  9343. /* 397 */
  9344. /***/ (function(module, exports, __webpack_require__) {
  9345. __webpack_require__(398);
  9346. var entryVirtual = __webpack_require__(40);
  9347. module.exports = entryVirtual('Array').map;
  9348. /***/ }),
  9349. /* 398 */
  9350. /***/ (function(module, exports, __webpack_require__) {
  9351. "use strict";
  9352. var $ = __webpack_require__(0);
  9353. var $map = __webpack_require__(70).map;
  9354. var arrayMethodHasSpeciesSupport = __webpack_require__(114);
  9355. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
  9356. // `Array.prototype.map` method
  9357. // https://tc39.es/ecma262/#sec-array.prototype.map
  9358. // with adding support of @@species
  9359. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  9360. map: function map(callbackfn /* , thisArg */) {
  9361. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  9362. }
  9363. });
  9364. /***/ }),
  9365. /* 399 */
  9366. /***/ (function(module, exports, __webpack_require__) {
  9367. var parent = __webpack_require__(400);
  9368. module.exports = parent;
  9369. /***/ }),
  9370. /* 400 */
  9371. /***/ (function(module, exports, __webpack_require__) {
  9372. __webpack_require__(401);
  9373. var path = __webpack_require__(5);
  9374. module.exports = path.Object.keys;
  9375. /***/ }),
  9376. /* 401 */
  9377. /***/ (function(module, exports, __webpack_require__) {
  9378. var $ = __webpack_require__(0);
  9379. var toObject = __webpack_require__(34);
  9380. var nativeKeys = __webpack_require__(105);
  9381. var fails = __webpack_require__(2);
  9382. var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
  9383. // `Object.keys` method
  9384. // https://tc39.es/ecma262/#sec-object.keys
  9385. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  9386. keys: function keys(it) {
  9387. return nativeKeys(toObject(it));
  9388. }
  9389. });
  9390. /***/ }),
  9391. /* 402 */
  9392. /***/ (function(module, exports, __webpack_require__) {
  9393. var parent = __webpack_require__(403);
  9394. module.exports = parent;
  9395. /***/ }),
  9396. /* 403 */
  9397. /***/ (function(module, exports, __webpack_require__) {
  9398. __webpack_require__(230);
  9399. var path = __webpack_require__(5);
  9400. var apply = __webpack_require__(75);
  9401. // eslint-disable-next-line es-x/no-json -- safe
  9402. if (!path.JSON) path.JSON = { stringify: JSON.stringify };
  9403. // eslint-disable-next-line no-unused-vars -- required for `.length`
  9404. module.exports = function stringify(it, replacer, space) {
  9405. return apply(path.JSON.stringify, null, arguments);
  9406. };
  9407. /***/ }),
  9408. /* 404 */
  9409. /***/ (function(module, exports, __webpack_require__) {
  9410. var parent = __webpack_require__(405);
  9411. module.exports = parent;
  9412. /***/ }),
  9413. /* 405 */
  9414. /***/ (function(module, exports, __webpack_require__) {
  9415. var isPrototypeOf = __webpack_require__(19);
  9416. var method = __webpack_require__(406);
  9417. var ArrayPrototype = Array.prototype;
  9418. module.exports = function (it) {
  9419. var own = it.indexOf;
  9420. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
  9421. };
  9422. /***/ }),
  9423. /* 406 */
  9424. /***/ (function(module, exports, __webpack_require__) {
  9425. __webpack_require__(407);
  9426. var entryVirtual = __webpack_require__(40);
  9427. module.exports = entryVirtual('Array').indexOf;
  9428. /***/ }),
  9429. /* 407 */
  9430. /***/ (function(module, exports, __webpack_require__) {
  9431. "use strict";
  9432. /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
  9433. var $ = __webpack_require__(0);
  9434. var uncurryThis = __webpack_require__(4);
  9435. var $IndexOf = __webpack_require__(164).indexOf;
  9436. var arrayMethodIsStrict = __webpack_require__(231);
  9437. var un$IndexOf = uncurryThis([].indexOf);
  9438. var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
  9439. var STRICT_METHOD = arrayMethodIsStrict('indexOf');
  9440. // `Array.prototype.indexOf` method
  9441. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  9442. $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
  9443. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  9444. var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  9445. return NEGATIVE_ZERO
  9446. // convert -0 to +0
  9447. ? un$IndexOf(this, searchElement, fromIndex) || 0
  9448. : $IndexOf(this, searchElement, fromIndex);
  9449. }
  9450. });
  9451. /***/ }),
  9452. /* 408 */
  9453. /***/ (function(module, exports, __webpack_require__) {
  9454. __webpack_require__(39);
  9455. var classof = __webpack_require__(51);
  9456. var hasOwn = __webpack_require__(13);
  9457. var isPrototypeOf = __webpack_require__(19);
  9458. var method = __webpack_require__(409);
  9459. var ArrayPrototype = Array.prototype;
  9460. var DOMIterables = {
  9461. DOMTokenList: true,
  9462. NodeList: true
  9463. };
  9464. module.exports = function (it) {
  9465. var own = it.keys;
  9466. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
  9467. || hasOwn(DOMIterables, classof(it)) ? method : own;
  9468. };
  9469. /***/ }),
  9470. /* 409 */
  9471. /***/ (function(module, exports, __webpack_require__) {
  9472. var parent = __webpack_require__(410);
  9473. module.exports = parent;
  9474. /***/ }),
  9475. /* 410 */
  9476. /***/ (function(module, exports, __webpack_require__) {
  9477. __webpack_require__(38);
  9478. __webpack_require__(53);
  9479. var entryVirtual = __webpack_require__(40);
  9480. module.exports = entryVirtual('Array').keys;
  9481. /***/ }),
  9482. /* 411 */
  9483. /***/ (function(module, exports) {
  9484. // Unique ID creation requires a high quality random # generator. In the
  9485. // browser this is a little complicated due to unknown quality of Math.random()
  9486. // and inconsistent support for the `crypto` API. We do the best we can via
  9487. // feature-detection
  9488. // getRandomValues needs to be invoked in a context where "this" is a Crypto
  9489. // implementation. Also, find the complete implementation of crypto on IE11.
  9490. var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
  9491. (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
  9492. if (getRandomValues) {
  9493. // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
  9494. var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
  9495. module.exports = function whatwgRNG() {
  9496. getRandomValues(rnds8);
  9497. return rnds8;
  9498. };
  9499. } else {
  9500. // Math.random()-based (RNG)
  9501. //
  9502. // If all else fails, use Math.random(). It's fast, but is of unspecified
  9503. // quality.
  9504. var rnds = new Array(16);
  9505. module.exports = function mathRNG() {
  9506. for (var i = 0, r; i < 16; i++) {
  9507. if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
  9508. rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
  9509. }
  9510. return rnds;
  9511. };
  9512. }
  9513. /***/ }),
  9514. /* 412 */
  9515. /***/ (function(module, exports) {
  9516. /**
  9517. * Convert array of 16 byte values to UUID string format of the form:
  9518. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  9519. */
  9520. var byteToHex = [];
  9521. for (var i = 0; i < 256; ++i) {
  9522. byteToHex[i] = (i + 0x100).toString(16).substr(1);
  9523. }
  9524. function bytesToUuid(buf, offset) {
  9525. var i = offset || 0;
  9526. var bth = byteToHex;
  9527. // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  9528. return ([bth[buf[i++]], bth[buf[i++]],
  9529. bth[buf[i++]], bth[buf[i++]], '-',
  9530. bth[buf[i++]], bth[buf[i++]], '-',
  9531. bth[buf[i++]], bth[buf[i++]], '-',
  9532. bth[buf[i++]], bth[buf[i++]], '-',
  9533. bth[buf[i++]], bth[buf[i++]],
  9534. bth[buf[i++]], bth[buf[i++]],
  9535. bth[buf[i++]], bth[buf[i++]]]).join('');
  9536. }
  9537. module.exports = bytesToUuid;
  9538. /***/ }),
  9539. /* 413 */
  9540. /***/ (function(module, exports, __webpack_require__) {
  9541. "use strict";
  9542. /**
  9543. * This is the common logic for both the Node.js and web browser
  9544. * implementations of `debug()`.
  9545. */
  9546. function setup(env) {
  9547. createDebug.debug = createDebug;
  9548. createDebug.default = createDebug;
  9549. createDebug.coerce = coerce;
  9550. createDebug.disable = disable;
  9551. createDebug.enable = enable;
  9552. createDebug.enabled = enabled;
  9553. createDebug.humanize = __webpack_require__(414);
  9554. Object.keys(env).forEach(function (key) {
  9555. createDebug[key] = env[key];
  9556. });
  9557. /**
  9558. * Active `debug` instances.
  9559. */
  9560. createDebug.instances = [];
  9561. /**
  9562. * The currently active debug mode names, and names to skip.
  9563. */
  9564. createDebug.names = [];
  9565. createDebug.skips = [];
  9566. /**
  9567. * Map of special "%n" handling functions, for the debug "format" argument.
  9568. *
  9569. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  9570. */
  9571. createDebug.formatters = {};
  9572. /**
  9573. * Selects a color for a debug namespace
  9574. * @param {String} namespace The namespace string for the for the debug instance to be colored
  9575. * @return {Number|String} An ANSI color code for the given namespace
  9576. * @api private
  9577. */
  9578. function selectColor(namespace) {
  9579. var hash = 0;
  9580. for (var i = 0; i < namespace.length; i++) {
  9581. hash = (hash << 5) - hash + namespace.charCodeAt(i);
  9582. hash |= 0; // Convert to 32bit integer
  9583. }
  9584. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  9585. }
  9586. createDebug.selectColor = selectColor;
  9587. /**
  9588. * Create a debugger with the given `namespace`.
  9589. *
  9590. * @param {String} namespace
  9591. * @return {Function}
  9592. * @api public
  9593. */
  9594. function createDebug(namespace) {
  9595. var prevTime;
  9596. function debug() {
  9597. // Disabled?
  9598. if (!debug.enabled) {
  9599. return;
  9600. }
  9601. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9602. args[_key] = arguments[_key];
  9603. }
  9604. var self = debug; // Set `diff` timestamp
  9605. var curr = Number(new Date());
  9606. var ms = curr - (prevTime || curr);
  9607. self.diff = ms;
  9608. self.prev = prevTime;
  9609. self.curr = curr;
  9610. prevTime = curr;
  9611. args[0] = createDebug.coerce(args[0]);
  9612. if (typeof args[0] !== 'string') {
  9613. // Anything else let's inspect with %O
  9614. args.unshift('%O');
  9615. } // Apply any `formatters` transformations
  9616. var index = 0;
  9617. args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
  9618. // If we encounter an escaped % then don't increase the array index
  9619. if (match === '%%') {
  9620. return match;
  9621. }
  9622. index++;
  9623. var formatter = createDebug.formatters[format];
  9624. if (typeof formatter === 'function') {
  9625. var val = args[index];
  9626. match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
  9627. args.splice(index, 1);
  9628. index--;
  9629. }
  9630. return match;
  9631. }); // Apply env-specific formatting (colors, etc.)
  9632. createDebug.formatArgs.call(self, args);
  9633. var logFn = self.log || createDebug.log;
  9634. logFn.apply(self, args);
  9635. }
  9636. debug.namespace = namespace;
  9637. debug.enabled = createDebug.enabled(namespace);
  9638. debug.useColors = createDebug.useColors();
  9639. debug.color = selectColor(namespace);
  9640. debug.destroy = destroy;
  9641. debug.extend = extend; // Debug.formatArgs = formatArgs;
  9642. // debug.rawLog = rawLog;
  9643. // env-specific initialization logic for debug instances
  9644. if (typeof createDebug.init === 'function') {
  9645. createDebug.init(debug);
  9646. }
  9647. createDebug.instances.push(debug);
  9648. return debug;
  9649. }
  9650. function destroy() {
  9651. var index = createDebug.instances.indexOf(this);
  9652. if (index !== -1) {
  9653. createDebug.instances.splice(index, 1);
  9654. return true;
  9655. }
  9656. return false;
  9657. }
  9658. function extend(namespace, delimiter) {
  9659. return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  9660. }
  9661. /**
  9662. * Enables a debug mode by namespaces. This can include modes
  9663. * separated by a colon and wildcards.
  9664. *
  9665. * @param {String} namespaces
  9666. * @api public
  9667. */
  9668. function enable(namespaces) {
  9669. createDebug.save(namespaces);
  9670. createDebug.names = [];
  9671. createDebug.skips = [];
  9672. var i;
  9673. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  9674. var len = split.length;
  9675. for (i = 0; i < len; i++) {
  9676. if (!split[i]) {
  9677. // ignore empty strings
  9678. continue;
  9679. }
  9680. namespaces = split[i].replace(/\*/g, '.*?');
  9681. if (namespaces[0] === '-') {
  9682. createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  9683. } else {
  9684. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  9685. }
  9686. }
  9687. for (i = 0; i < createDebug.instances.length; i++) {
  9688. var instance = createDebug.instances[i];
  9689. instance.enabled = createDebug.enabled(instance.namespace);
  9690. }
  9691. }
  9692. /**
  9693. * Disable debug output.
  9694. *
  9695. * @api public
  9696. */
  9697. function disable() {
  9698. createDebug.enable('');
  9699. }
  9700. /**
  9701. * Returns true if the given mode name is enabled, false otherwise.
  9702. *
  9703. * @param {String} name
  9704. * @return {Boolean}
  9705. * @api public
  9706. */
  9707. function enabled(name) {
  9708. if (name[name.length - 1] === '*') {
  9709. return true;
  9710. }
  9711. var i;
  9712. var len;
  9713. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  9714. if (createDebug.skips[i].test(name)) {
  9715. return false;
  9716. }
  9717. }
  9718. for (i = 0, len = createDebug.names.length; i < len; i++) {
  9719. if (createDebug.names[i].test(name)) {
  9720. return true;
  9721. }
  9722. }
  9723. return false;
  9724. }
  9725. /**
  9726. * Coerce `val`.
  9727. *
  9728. * @param {Mixed} val
  9729. * @return {Mixed}
  9730. * @api private
  9731. */
  9732. function coerce(val) {
  9733. if (val instanceof Error) {
  9734. return val.stack || val.message;
  9735. }
  9736. return val;
  9737. }
  9738. createDebug.enable(createDebug.load());
  9739. return createDebug;
  9740. }
  9741. module.exports = setup;
  9742. /***/ }),
  9743. /* 414 */
  9744. /***/ (function(module, exports) {
  9745. /**
  9746. * Helpers.
  9747. */
  9748. var s = 1000;
  9749. var m = s * 60;
  9750. var h = m * 60;
  9751. var d = h * 24;
  9752. var w = d * 7;
  9753. var y = d * 365.25;
  9754. /**
  9755. * Parse or format the given `val`.
  9756. *
  9757. * Options:
  9758. *
  9759. * - `long` verbose formatting [false]
  9760. *
  9761. * @param {String|Number} val
  9762. * @param {Object} [options]
  9763. * @throws {Error} throw an error if val is not a non-empty string or a number
  9764. * @return {String|Number}
  9765. * @api public
  9766. */
  9767. module.exports = function(val, options) {
  9768. options = options || {};
  9769. var type = typeof val;
  9770. if (type === 'string' && val.length > 0) {
  9771. return parse(val);
  9772. } else if (type === 'number' && isFinite(val)) {
  9773. return options.long ? fmtLong(val) : fmtShort(val);
  9774. }
  9775. throw new Error(
  9776. 'val is not a non-empty string or a valid number. val=' +
  9777. JSON.stringify(val)
  9778. );
  9779. };
  9780. /**
  9781. * Parse the given `str` and return milliseconds.
  9782. *
  9783. * @param {String} str
  9784. * @return {Number}
  9785. * @api private
  9786. */
  9787. function parse(str) {
  9788. str = String(str);
  9789. if (str.length > 100) {
  9790. return;
  9791. }
  9792. var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  9793. str
  9794. );
  9795. if (!match) {
  9796. return;
  9797. }
  9798. var n = parseFloat(match[1]);
  9799. var type = (match[2] || 'ms').toLowerCase();
  9800. switch (type) {
  9801. case 'years':
  9802. case 'year':
  9803. case 'yrs':
  9804. case 'yr':
  9805. case 'y':
  9806. return n * y;
  9807. case 'weeks':
  9808. case 'week':
  9809. case 'w':
  9810. return n * w;
  9811. case 'days':
  9812. case 'day':
  9813. case 'd':
  9814. return n * d;
  9815. case 'hours':
  9816. case 'hour':
  9817. case 'hrs':
  9818. case 'hr':
  9819. case 'h':
  9820. return n * h;
  9821. case 'minutes':
  9822. case 'minute':
  9823. case 'mins':
  9824. case 'min':
  9825. case 'm':
  9826. return n * m;
  9827. case 'seconds':
  9828. case 'second':
  9829. case 'secs':
  9830. case 'sec':
  9831. case 's':
  9832. return n * s;
  9833. case 'milliseconds':
  9834. case 'millisecond':
  9835. case 'msecs':
  9836. case 'msec':
  9837. case 'ms':
  9838. return n;
  9839. default:
  9840. return undefined;
  9841. }
  9842. }
  9843. /**
  9844. * Short format for `ms`.
  9845. *
  9846. * @param {Number} ms
  9847. * @return {String}
  9848. * @api private
  9849. */
  9850. function fmtShort(ms) {
  9851. var msAbs = Math.abs(ms);
  9852. if (msAbs >= d) {
  9853. return Math.round(ms / d) + 'd';
  9854. }
  9855. if (msAbs >= h) {
  9856. return Math.round(ms / h) + 'h';
  9857. }
  9858. if (msAbs >= m) {
  9859. return Math.round(ms / m) + 'm';
  9860. }
  9861. if (msAbs >= s) {
  9862. return Math.round(ms / s) + 's';
  9863. }
  9864. return ms + 'ms';
  9865. }
  9866. /**
  9867. * Long format for `ms`.
  9868. *
  9869. * @param {Number} ms
  9870. * @return {String}
  9871. * @api private
  9872. */
  9873. function fmtLong(ms) {
  9874. var msAbs = Math.abs(ms);
  9875. if (msAbs >= d) {
  9876. return plural(ms, msAbs, d, 'day');
  9877. }
  9878. if (msAbs >= h) {
  9879. return plural(ms, msAbs, h, 'hour');
  9880. }
  9881. if (msAbs >= m) {
  9882. return plural(ms, msAbs, m, 'minute');
  9883. }
  9884. if (msAbs >= s) {
  9885. return plural(ms, msAbs, s, 'second');
  9886. }
  9887. return ms + ' ms';
  9888. }
  9889. /**
  9890. * Pluralization helper.
  9891. */
  9892. function plural(ms, msAbs, n, name) {
  9893. var isPlural = msAbs >= n * 1.5;
  9894. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  9895. }
  9896. /***/ }),
  9897. /* 415 */
  9898. /***/ (function(module, exports, __webpack_require__) {
  9899. __webpack_require__(416);
  9900. var path = __webpack_require__(5);
  9901. module.exports = path.Object.getPrototypeOf;
  9902. /***/ }),
  9903. /* 416 */
  9904. /***/ (function(module, exports, __webpack_require__) {
  9905. var $ = __webpack_require__(0);
  9906. var fails = __webpack_require__(2);
  9907. var toObject = __webpack_require__(34);
  9908. var nativeGetPrototypeOf = __webpack_require__(100);
  9909. var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
  9910. var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
  9911. // `Object.getPrototypeOf` method
  9912. // https://tc39.es/ecma262/#sec-object.getprototypeof
  9913. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
  9914. getPrototypeOf: function getPrototypeOf(it) {
  9915. return nativeGetPrototypeOf(toObject(it));
  9916. }
  9917. });
  9918. /***/ }),
  9919. /* 417 */
  9920. /***/ (function(module, exports, __webpack_require__) {
  9921. __webpack_require__(418);
  9922. var path = __webpack_require__(5);
  9923. module.exports = path.Object.setPrototypeOf;
  9924. /***/ }),
  9925. /* 418 */
  9926. /***/ (function(module, exports, __webpack_require__) {
  9927. var $ = __webpack_require__(0);
  9928. var setPrototypeOf = __webpack_require__(102);
  9929. // `Object.setPrototypeOf` method
  9930. // https://tc39.es/ecma262/#sec-object.setprototypeof
  9931. $({ target: 'Object', stat: true }, {
  9932. setPrototypeOf: setPrototypeOf
  9933. });
  9934. /***/ }),
  9935. /* 419 */
  9936. /***/ (function(module, exports, __webpack_require__) {
  9937. "use strict";
  9938. var _interopRequireDefault = __webpack_require__(1);
  9939. var _slice = _interopRequireDefault(__webpack_require__(61));
  9940. var _concat = _interopRequireDefault(__webpack_require__(22));
  9941. var _defineProperty = _interopRequireDefault(__webpack_require__(92));
  9942. var AV = __webpack_require__(69);
  9943. var AppRouter = __webpack_require__(425);
  9944. var _require = __webpack_require__(30),
  9945. isNullOrUndefined = _require.isNullOrUndefined;
  9946. var _require2 = __webpack_require__(3),
  9947. extend = _require2.extend,
  9948. isObject = _require2.isObject,
  9949. isEmpty = _require2.isEmpty;
  9950. var isCNApp = function isCNApp(appId) {
  9951. return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
  9952. };
  9953. var fillServerURLs = function fillServerURLs(url) {
  9954. return {
  9955. push: url,
  9956. stats: url,
  9957. engine: url,
  9958. api: url,
  9959. rtm: url
  9960. };
  9961. };
  9962. function getDefaultServerURLs(appId) {
  9963. var _context, _context2, _context3, _context4, _context5;
  9964. if (isCNApp(appId)) {
  9965. return {};
  9966. }
  9967. var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
  9968. var domain = 'lncldglobal.com';
  9969. return {
  9970. push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
  9971. stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
  9972. engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
  9973. api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
  9974. rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
  9975. };
  9976. }
  9977. var _disableAppRouter = false;
  9978. var _initialized = false;
  9979. /**
  9980. * URLs for services
  9981. * @typedef {Object} ServerURLs
  9982. * @property {String} [api] serverURL for API service
  9983. * @property {String} [engine] serverURL for engine service
  9984. * @property {String} [stats] serverURL for stats service
  9985. * @property {String} [push] serverURL for push service
  9986. * @property {String} [rtm] serverURL for LiveQuery service
  9987. */
  9988. /**
  9989. * Call this method first to set up your authentication tokens for AV.
  9990. * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
  9991. * @function AV.init
  9992. * @param {Object} options
  9993. * @param {String} options.appId application id
  9994. * @param {String} options.appKey application key
  9995. * @param {String} [options.masterKey] application master key
  9996. * @param {Boolean} [options.production]
  9997. * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
  9998. * @param {Boolean} [options.disableCurrentUser]
  9999. */
  10000. AV.init = function init(options) {
  10001. if (!isObject(options)) {
  10002. return AV.init({
  10003. appId: options,
  10004. appKey: arguments.length <= 1 ? undefined : arguments[1],
  10005. masterKey: arguments.length <= 2 ? undefined : arguments[2]
  10006. });
  10007. }
  10008. var appId = options.appId,
  10009. appKey = options.appKey,
  10010. masterKey = options.masterKey,
  10011. hookKey = options.hookKey,
  10012. serverURL = options.serverURL,
  10013. _options$serverURLs = options.serverURLs,
  10014. serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
  10015. disableCurrentUser = options.disableCurrentUser,
  10016. production = options.production,
  10017. realtime = options.realtime;
  10018. if (_initialized) console.warn('Initializing LeanCloud Storage SDK which has already been initialized. Reinitializing the SDK might cause problems like unexpected cross-app data writing and invalid relations.');
  10019. if (!appId) throw new TypeError('appId must be a string');
  10020. if (!appKey) throw new TypeError('appKey must be a string');
  10021. if ("Weapp" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
  10022. if (isCNApp(appId)) {
  10023. if (!serverURLs && isEmpty(AV._config.serverURLs)) {
  10024. throw new TypeError("serverURL option is required for apps from CN region");
  10025. }
  10026. }
  10027. if (appId !== AV._config.applicationId) {
  10028. // overwrite all keys when reinitializing as a new app
  10029. AV._config.masterKey = masterKey;
  10030. AV._config.hookKey = hookKey;
  10031. } else {
  10032. if (masterKey) AV._config.masterKey = masterKey;
  10033. if (hookKey) AV._config.hookKey = hookKey;
  10034. }
  10035. AV._config.applicationId = appId;
  10036. AV._config.applicationKey = appKey;
  10037. if (!isNullOrUndefined(production)) {
  10038. AV.setProduction(production);
  10039. }
  10040. if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
  10041. var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
  10042. if (!disableAppRouter) {
  10043. AV._appRouter = new AppRouter(AV);
  10044. }
  10045. AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
  10046. if (realtime) {
  10047. AV._config.realtime = realtime;
  10048. } else if (AV._sharedConfig.liveQueryRealtime) {
  10049. var _AV$_config$serverURL = AV._config.serverURLs,
  10050. api = _AV$_config$serverURL.api,
  10051. rtm = _AV$_config$serverURL.rtm;
  10052. AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
  10053. appId: appId,
  10054. appKey: appKey,
  10055. server: {
  10056. api: api,
  10057. RTMRouter: rtm
  10058. }
  10059. });
  10060. }
  10061. _initialized = true;
  10062. }; // If we're running in node.js, allow using the master key.
  10063. if (false) {
  10064. AV.Cloud = AV.Cloud || {};
  10065. /**
  10066. * Switches the LeanCloud SDK to using the Master key. The Master key grants
  10067. * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
  10068. * other restrictions that are applied to the client SDKs.
  10069. * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
  10070. * </p>
  10071. */
  10072. AV.Cloud.useMasterKey = function () {
  10073. AV._config.useMasterKey = true;
  10074. };
  10075. }
  10076. /**
  10077. * Call this method to set production environment variable.
  10078. * @function AV.setProduction
  10079. * @param {Boolean} production True is production environment,and
  10080. * it's true by default.
  10081. */
  10082. AV.setProduction = function (production) {
  10083. if (!isNullOrUndefined(production)) {
  10084. AV._config.production = production ? 1 : 0;
  10085. } else {
  10086. // change to default value
  10087. AV._config.production = null;
  10088. }
  10089. };
  10090. AV._setServerURLs = function (urls) {
  10091. var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  10092. if (typeof urls !== 'string') {
  10093. extend(AV._config.serverURLs, urls);
  10094. } else {
  10095. AV._config.serverURLs = fillServerURLs(urls);
  10096. }
  10097. if (disableAppRouter) {
  10098. if (AV._appRouter) {
  10099. AV._appRouter.disable();
  10100. } else {
  10101. _disableAppRouter = true;
  10102. }
  10103. }
  10104. };
  10105. /**
  10106. * Set server URLs for services.
  10107. * @function AV.setServerURL
  10108. * @since 4.3.0
  10109. * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
  10110. * You can also set them when initializing SDK with `options.serverURL`
  10111. */
  10112. AV.setServerURL = function (urls) {
  10113. return AV._setServerURLs(urls);
  10114. };
  10115. AV.setServerURLs = AV.setServerURL;
  10116. AV.keepErrorRawMessage = function (value) {
  10117. AV._sharedConfig.keepErrorRawMessage = value;
  10118. };
  10119. /**
  10120. * Set a deadline for requests to complete.
  10121. * Note that file upload requests are not affected.
  10122. * @function AV.setRequestTimeout
  10123. * @since 3.6.0
  10124. * @param {number} ms
  10125. */
  10126. AV.setRequestTimeout = function (ms) {
  10127. AV._config.requestTimeout = ms;
  10128. }; // backword compatible
  10129. AV.initialize = AV.init;
  10130. var defineConfig = function defineConfig(property) {
  10131. return (0, _defineProperty.default)(AV, property, {
  10132. get: function get() {
  10133. return AV._config[property];
  10134. },
  10135. set: function set(value) {
  10136. AV._config[property] = value;
  10137. }
  10138. });
  10139. };
  10140. ['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
  10141. /***/ }),
  10142. /* 420 */
  10143. /***/ (function(module, exports, __webpack_require__) {
  10144. var isPrototypeOf = __webpack_require__(19);
  10145. var method = __webpack_require__(421);
  10146. var ArrayPrototype = Array.prototype;
  10147. module.exports = function (it) {
  10148. var own = it.slice;
  10149. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
  10150. };
  10151. /***/ }),
  10152. /* 421 */
  10153. /***/ (function(module, exports, __webpack_require__) {
  10154. __webpack_require__(422);
  10155. var entryVirtual = __webpack_require__(40);
  10156. module.exports = entryVirtual('Array').slice;
  10157. /***/ }),
  10158. /* 422 */
  10159. /***/ (function(module, exports, __webpack_require__) {
  10160. "use strict";
  10161. var $ = __webpack_require__(0);
  10162. var isArray = __webpack_require__(90);
  10163. var isConstructor = __webpack_require__(109);
  10164. var isObject = __webpack_require__(11);
  10165. var toAbsoluteIndex = __webpack_require__(125);
  10166. var lengthOfArrayLike = __webpack_require__(41);
  10167. var toIndexedObject = __webpack_require__(32);
  10168. var createProperty = __webpack_require__(91);
  10169. var wellKnownSymbol = __webpack_require__(9);
  10170. var arrayMethodHasSpeciesSupport = __webpack_require__(114);
  10171. var un$Slice = __webpack_require__(110);
  10172. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
  10173. var SPECIES = wellKnownSymbol('species');
  10174. var $Array = Array;
  10175. var max = Math.max;
  10176. // `Array.prototype.slice` method
  10177. // https://tc39.es/ecma262/#sec-array.prototype.slice
  10178. // fallback for not array-like ES3 strings and DOM objects
  10179. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  10180. slice: function slice(start, end) {
  10181. var O = toIndexedObject(this);
  10182. var length = lengthOfArrayLike(O);
  10183. var k = toAbsoluteIndex(start, length);
  10184. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  10185. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  10186. var Constructor, result, n;
  10187. if (isArray(O)) {
  10188. Constructor = O.constructor;
  10189. // cross-realm fallback
  10190. if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
  10191. Constructor = undefined;
  10192. } else if (isObject(Constructor)) {
  10193. Constructor = Constructor[SPECIES];
  10194. if (Constructor === null) Constructor = undefined;
  10195. }
  10196. if (Constructor === $Array || Constructor === undefined) {
  10197. return un$Slice(O, k, fin);
  10198. }
  10199. }
  10200. result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
  10201. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  10202. result.length = n;
  10203. return result;
  10204. }
  10205. });
  10206. /***/ }),
  10207. /* 423 */
  10208. /***/ (function(module, exports, __webpack_require__) {
  10209. __webpack_require__(424);
  10210. var path = __webpack_require__(5);
  10211. var Object = path.Object;
  10212. var defineProperty = module.exports = function defineProperty(it, key, desc) {
  10213. return Object.defineProperty(it, key, desc);
  10214. };
  10215. if (Object.defineProperty.sham) defineProperty.sham = true;
  10216. /***/ }),
  10217. /* 424 */
  10218. /***/ (function(module, exports, __webpack_require__) {
  10219. var $ = __webpack_require__(0);
  10220. var DESCRIPTORS = __webpack_require__(14);
  10221. var defineProperty = __webpack_require__(23).f;
  10222. // `Object.defineProperty` method
  10223. // https://tc39.es/ecma262/#sec-object.defineproperty
  10224. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  10225. $({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
  10226. defineProperty: defineProperty
  10227. });
  10228. /***/ }),
  10229. /* 425 */
  10230. /***/ (function(module, exports, __webpack_require__) {
  10231. "use strict";
  10232. var ajax = __webpack_require__(116);
  10233. var Cache = __webpack_require__(237);
  10234. function AppRouter(AV) {
  10235. var _this = this;
  10236. this.AV = AV;
  10237. this.lockedUntil = 0;
  10238. Cache.getAsync('serverURLs').then(function (data) {
  10239. if (_this.disabled) return;
  10240. if (!data) return _this.lock(0);
  10241. var serverURLs = data.serverURLs,
  10242. lockedUntil = data.lockedUntil;
  10243. _this.AV._setServerURLs(serverURLs, false);
  10244. _this.lockedUntil = lockedUntil;
  10245. }).catch(function () {
  10246. return _this.lock(0);
  10247. });
  10248. }
  10249. AppRouter.prototype.disable = function disable() {
  10250. this.disabled = true;
  10251. };
  10252. AppRouter.prototype.lock = function lock(ttl) {
  10253. this.lockedUntil = Date.now() + ttl;
  10254. };
  10255. AppRouter.prototype.refresh = function refresh() {
  10256. var _this2 = this;
  10257. if (this.disabled) return;
  10258. if (Date.now() < this.lockedUntil) return;
  10259. this.lock(10);
  10260. var url = 'https://app-router.com/2/route';
  10261. return ajax({
  10262. method: 'get',
  10263. url: url,
  10264. query: {
  10265. appId: this.AV.applicationId
  10266. }
  10267. }).then(function (servers) {
  10268. if (_this2.disabled) return;
  10269. var ttl = servers.ttl;
  10270. if (!ttl) throw new Error('missing ttl');
  10271. ttl = ttl * 1000;
  10272. var protocal = 'https://';
  10273. var serverURLs = {
  10274. push: protocal + servers.push_server,
  10275. stats: protocal + servers.stats_server,
  10276. engine: protocal + servers.engine_server,
  10277. api: protocal + servers.api_server
  10278. };
  10279. _this2.AV._setServerURLs(serverURLs, false);
  10280. _this2.lock(ttl);
  10281. return Cache.setAsync('serverURLs', {
  10282. serverURLs: serverURLs,
  10283. lockedUntil: _this2.lockedUntil
  10284. }, ttl);
  10285. }).catch(function (error) {
  10286. // bypass all errors
  10287. console.warn("refresh server URLs failed: ".concat(error.message));
  10288. _this2.lock(600);
  10289. });
  10290. };
  10291. module.exports = AppRouter;
  10292. /***/ }),
  10293. /* 426 */
  10294. /***/ (function(module, exports, __webpack_require__) {
  10295. module.exports = __webpack_require__(427);
  10296. /***/ }),
  10297. /* 427 */
  10298. /***/ (function(module, exports, __webpack_require__) {
  10299. var parent = __webpack_require__(428);
  10300. __webpack_require__(451);
  10301. __webpack_require__(452);
  10302. __webpack_require__(453);
  10303. __webpack_require__(454);
  10304. __webpack_require__(455);
  10305. // TODO: Remove from `core-js@4`
  10306. __webpack_require__(456);
  10307. __webpack_require__(457);
  10308. __webpack_require__(458);
  10309. module.exports = parent;
  10310. /***/ }),
  10311. /* 428 */
  10312. /***/ (function(module, exports, __webpack_require__) {
  10313. var parent = __webpack_require__(243);
  10314. module.exports = parent;
  10315. /***/ }),
  10316. /* 429 */
  10317. /***/ (function(module, exports, __webpack_require__) {
  10318. __webpack_require__(228);
  10319. __webpack_require__(53);
  10320. __webpack_require__(244);
  10321. __webpack_require__(435);
  10322. __webpack_require__(436);
  10323. __webpack_require__(437);
  10324. __webpack_require__(438);
  10325. __webpack_require__(248);
  10326. __webpack_require__(439);
  10327. __webpack_require__(440);
  10328. __webpack_require__(441);
  10329. __webpack_require__(442);
  10330. __webpack_require__(443);
  10331. __webpack_require__(444);
  10332. __webpack_require__(445);
  10333. __webpack_require__(446);
  10334. __webpack_require__(447);
  10335. __webpack_require__(448);
  10336. __webpack_require__(449);
  10337. __webpack_require__(450);
  10338. var path = __webpack_require__(5);
  10339. module.exports = path.Symbol;
  10340. /***/ }),
  10341. /* 430 */
  10342. /***/ (function(module, exports, __webpack_require__) {
  10343. "use strict";
  10344. var $ = __webpack_require__(0);
  10345. var global = __webpack_require__(7);
  10346. var call = __webpack_require__(15);
  10347. var uncurryThis = __webpack_require__(4);
  10348. var IS_PURE = __webpack_require__(33);
  10349. var DESCRIPTORS = __webpack_require__(14);
  10350. var NATIVE_SYMBOL = __webpack_require__(64);
  10351. var fails = __webpack_require__(2);
  10352. var hasOwn = __webpack_require__(13);
  10353. var isPrototypeOf = __webpack_require__(19);
  10354. var anObject = __webpack_require__(20);
  10355. var toIndexedObject = __webpack_require__(32);
  10356. var toPropertyKey = __webpack_require__(96);
  10357. var $toString = __webpack_require__(81);
  10358. var createPropertyDescriptor = __webpack_require__(47);
  10359. var nativeObjectCreate = __webpack_require__(49);
  10360. var objectKeys = __webpack_require__(105);
  10361. var getOwnPropertyNamesModule = __webpack_require__(103);
  10362. var getOwnPropertyNamesExternal = __webpack_require__(245);
  10363. var getOwnPropertySymbolsModule = __webpack_require__(104);
  10364. var getOwnPropertyDescriptorModule = __webpack_require__(62);
  10365. var definePropertyModule = __webpack_require__(23);
  10366. var definePropertiesModule = __webpack_require__(128);
  10367. var propertyIsEnumerableModule = __webpack_require__(120);
  10368. var defineBuiltIn = __webpack_require__(44);
  10369. var shared = __webpack_require__(79);
  10370. var sharedKey = __webpack_require__(101);
  10371. var hiddenKeys = __webpack_require__(80);
  10372. var uid = __webpack_require__(99);
  10373. var wellKnownSymbol = __webpack_require__(9);
  10374. var wrappedWellKnownSymbolModule = __webpack_require__(148);
  10375. var defineWellKnownSymbol = __webpack_require__(10);
  10376. var defineSymbolToPrimitive = __webpack_require__(246);
  10377. var setToStringTag = __webpack_require__(52);
  10378. var InternalStateModule = __webpack_require__(43);
  10379. var $forEach = __webpack_require__(70).forEach;
  10380. var HIDDEN = sharedKey('hidden');
  10381. var SYMBOL = 'Symbol';
  10382. var PROTOTYPE = 'prototype';
  10383. var setInternalState = InternalStateModule.set;
  10384. var getInternalState = InternalStateModule.getterFor(SYMBOL);
  10385. var ObjectPrototype = Object[PROTOTYPE];
  10386. var $Symbol = global.Symbol;
  10387. var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
  10388. var TypeError = global.TypeError;
  10389. var QObject = global.QObject;
  10390. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  10391. var nativeDefineProperty = definePropertyModule.f;
  10392. var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
  10393. var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
  10394. var push = uncurryThis([].push);
  10395. var AllSymbols = shared('symbols');
  10396. var ObjectPrototypeSymbols = shared('op-symbols');
  10397. var WellKnownSymbolsStore = shared('wks');
  10398. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  10399. var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  10400. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  10401. var setSymbolDescriptor = DESCRIPTORS && fails(function () {
  10402. return nativeObjectCreate(nativeDefineProperty({}, 'a', {
  10403. get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
  10404. })).a != 7;
  10405. }) ? function (O, P, Attributes) {
  10406. var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
  10407. if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
  10408. nativeDefineProperty(O, P, Attributes);
  10409. if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
  10410. nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
  10411. }
  10412. } : nativeDefineProperty;
  10413. var wrap = function (tag, description) {
  10414. var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
  10415. setInternalState(symbol, {
  10416. type: SYMBOL,
  10417. tag: tag,
  10418. description: description
  10419. });
  10420. if (!DESCRIPTORS) symbol.description = description;
  10421. return symbol;
  10422. };
  10423. var $defineProperty = function defineProperty(O, P, Attributes) {
  10424. if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  10425. anObject(O);
  10426. var key = toPropertyKey(P);
  10427. anObject(Attributes);
  10428. if (hasOwn(AllSymbols, key)) {
  10429. if (!Attributes.enumerable) {
  10430. if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
  10431. O[HIDDEN][key] = true;
  10432. } else {
  10433. if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
  10434. Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
  10435. } return setSymbolDescriptor(O, key, Attributes);
  10436. } return nativeDefineProperty(O, key, Attributes);
  10437. };
  10438. var $defineProperties = function defineProperties(O, Properties) {
  10439. anObject(O);
  10440. var properties = toIndexedObject(Properties);
  10441. var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  10442. $forEach(keys, function (key) {
  10443. if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
  10444. });
  10445. return O;
  10446. };
  10447. var $create = function create(O, Properties) {
  10448. return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
  10449. };
  10450. var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  10451. var P = toPropertyKey(V);
  10452. var enumerable = call(nativePropertyIsEnumerable, this, P);
  10453. if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
  10454. return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
  10455. ? enumerable : true;
  10456. };
  10457. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  10458. var it = toIndexedObject(O);
  10459. var key = toPropertyKey(P);
  10460. if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
  10461. var descriptor = nativeGetOwnPropertyDescriptor(it, key);
  10462. if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
  10463. descriptor.enumerable = true;
  10464. }
  10465. return descriptor;
  10466. };
  10467. var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  10468. var names = nativeGetOwnPropertyNames(toIndexedObject(O));
  10469. var result = [];
  10470. $forEach(names, function (key) {
  10471. if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
  10472. });
  10473. return result;
  10474. };
  10475. var $getOwnPropertySymbols = function (O) {
  10476. var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  10477. var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  10478. var result = [];
  10479. $forEach(names, function (key) {
  10480. if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
  10481. push(result, AllSymbols[key]);
  10482. }
  10483. });
  10484. return result;
  10485. };
  10486. // `Symbol` constructor
  10487. // https://tc39.es/ecma262/#sec-symbol-constructor
  10488. if (!NATIVE_SYMBOL) {
  10489. $Symbol = function Symbol() {
  10490. if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
  10491. var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
  10492. var tag = uid(description);
  10493. var setter = function (value) {
  10494. if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
  10495. if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  10496. setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
  10497. };
  10498. if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
  10499. return wrap(tag, description);
  10500. };
  10501. SymbolPrototype = $Symbol[PROTOTYPE];
  10502. defineBuiltIn(SymbolPrototype, 'toString', function toString() {
  10503. return getInternalState(this).tag;
  10504. });
  10505. defineBuiltIn($Symbol, 'withoutSetter', function (description) {
  10506. return wrap(uid(description), description);
  10507. });
  10508. propertyIsEnumerableModule.f = $propertyIsEnumerable;
  10509. definePropertyModule.f = $defineProperty;
  10510. definePropertiesModule.f = $defineProperties;
  10511. getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
  10512. getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  10513. getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
  10514. wrappedWellKnownSymbolModule.f = function (name) {
  10515. return wrap(wellKnownSymbol(name), name);
  10516. };
  10517. if (DESCRIPTORS) {
  10518. // https://github.com/tc39/proposal-Symbol-description
  10519. nativeDefineProperty(SymbolPrototype, 'description', {
  10520. configurable: true,
  10521. get: function description() {
  10522. return getInternalState(this).description;
  10523. }
  10524. });
  10525. if (!IS_PURE) {
  10526. defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
  10527. }
  10528. }
  10529. }
  10530. $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
  10531. Symbol: $Symbol
  10532. });
  10533. $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  10534. defineWellKnownSymbol(name);
  10535. });
  10536. $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
  10537. useSetter: function () { USE_SETTER = true; },
  10538. useSimple: function () { USE_SETTER = false; }
  10539. });
  10540. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
  10541. // `Object.create` method
  10542. // https://tc39.es/ecma262/#sec-object.create
  10543. create: $create,
  10544. // `Object.defineProperty` method
  10545. // https://tc39.es/ecma262/#sec-object.defineproperty
  10546. defineProperty: $defineProperty,
  10547. // `Object.defineProperties` method
  10548. // https://tc39.es/ecma262/#sec-object.defineproperties
  10549. defineProperties: $defineProperties,
  10550. // `Object.getOwnPropertyDescriptor` method
  10551. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  10552. getOwnPropertyDescriptor: $getOwnPropertyDescriptor
  10553. });
  10554. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
  10555. // `Object.getOwnPropertyNames` method
  10556. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  10557. getOwnPropertyNames: $getOwnPropertyNames
  10558. });
  10559. // `Symbol.prototype[@@toPrimitive]` method
  10560. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  10561. defineSymbolToPrimitive();
  10562. // `Symbol.prototype[@@toStringTag]` property
  10563. // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
  10564. setToStringTag($Symbol, SYMBOL);
  10565. hiddenKeys[HIDDEN] = true;
  10566. /***/ }),
  10567. /* 431 */
  10568. /***/ (function(module, exports, __webpack_require__) {
  10569. var toAbsoluteIndex = __webpack_require__(125);
  10570. var lengthOfArrayLike = __webpack_require__(41);
  10571. var createProperty = __webpack_require__(91);
  10572. var $Array = Array;
  10573. var max = Math.max;
  10574. module.exports = function (O, start, end) {
  10575. var length = lengthOfArrayLike(O);
  10576. var k = toAbsoluteIndex(start, length);
  10577. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  10578. var result = $Array(max(fin - k, 0));
  10579. for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
  10580. result.length = n;
  10581. return result;
  10582. };
  10583. /***/ }),
  10584. /* 432 */
  10585. /***/ (function(module, exports, __webpack_require__) {
  10586. var $ = __webpack_require__(0);
  10587. var getBuiltIn = __webpack_require__(18);
  10588. var hasOwn = __webpack_require__(13);
  10589. var toString = __webpack_require__(81);
  10590. var shared = __webpack_require__(79);
  10591. var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
  10592. var StringToSymbolRegistry = shared('string-to-symbol-registry');
  10593. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  10594. // `Symbol.for` method
  10595. // https://tc39.es/ecma262/#sec-symbol.for
  10596. $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
  10597. 'for': function (key) {
  10598. var string = toString(key);
  10599. if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
  10600. var symbol = getBuiltIn('Symbol')(string);
  10601. StringToSymbolRegistry[string] = symbol;
  10602. SymbolToStringRegistry[symbol] = string;
  10603. return symbol;
  10604. }
  10605. });
  10606. /***/ }),
  10607. /* 433 */
  10608. /***/ (function(module, exports, __webpack_require__) {
  10609. var $ = __webpack_require__(0);
  10610. var hasOwn = __webpack_require__(13);
  10611. var isSymbol = __webpack_require__(97);
  10612. var tryToString = __webpack_require__(78);
  10613. var shared = __webpack_require__(79);
  10614. var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
  10615. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  10616. // `Symbol.keyFor` method
  10617. // https://tc39.es/ecma262/#sec-symbol.keyfor
  10618. $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
  10619. keyFor: function keyFor(sym) {
  10620. if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
  10621. if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
  10622. }
  10623. });
  10624. /***/ }),
  10625. /* 434 */
  10626. /***/ (function(module, exports, __webpack_require__) {
  10627. var $ = __webpack_require__(0);
  10628. var NATIVE_SYMBOL = __webpack_require__(64);
  10629. var fails = __webpack_require__(2);
  10630. var getOwnPropertySymbolsModule = __webpack_require__(104);
  10631. var toObject = __webpack_require__(34);
  10632. // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  10633. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  10634. var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
  10635. // `Object.getOwnPropertySymbols` method
  10636. // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
  10637. $({ target: 'Object', stat: true, forced: FORCED }, {
  10638. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  10639. var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  10640. return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
  10641. }
  10642. });
  10643. /***/ }),
  10644. /* 435 */
  10645. /***/ (function(module, exports, __webpack_require__) {
  10646. var defineWellKnownSymbol = __webpack_require__(10);
  10647. // `Symbol.asyncIterator` well-known symbol
  10648. // https://tc39.es/ecma262/#sec-symbol.asynciterator
  10649. defineWellKnownSymbol('asyncIterator');
  10650. /***/ }),
  10651. /* 436 */
  10652. /***/ (function(module, exports) {
  10653. // empty
  10654. /***/ }),
  10655. /* 437 */
  10656. /***/ (function(module, exports, __webpack_require__) {
  10657. var defineWellKnownSymbol = __webpack_require__(10);
  10658. // `Symbol.hasInstance` well-known symbol
  10659. // https://tc39.es/ecma262/#sec-symbol.hasinstance
  10660. defineWellKnownSymbol('hasInstance');
  10661. /***/ }),
  10662. /* 438 */
  10663. /***/ (function(module, exports, __webpack_require__) {
  10664. var defineWellKnownSymbol = __webpack_require__(10);
  10665. // `Symbol.isConcatSpreadable` well-known symbol
  10666. // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
  10667. defineWellKnownSymbol('isConcatSpreadable');
  10668. /***/ }),
  10669. /* 439 */
  10670. /***/ (function(module, exports, __webpack_require__) {
  10671. var defineWellKnownSymbol = __webpack_require__(10);
  10672. // `Symbol.match` well-known symbol
  10673. // https://tc39.es/ecma262/#sec-symbol.match
  10674. defineWellKnownSymbol('match');
  10675. /***/ }),
  10676. /* 440 */
  10677. /***/ (function(module, exports, __webpack_require__) {
  10678. var defineWellKnownSymbol = __webpack_require__(10);
  10679. // `Symbol.matchAll` well-known symbol
  10680. // https://tc39.es/ecma262/#sec-symbol.matchall
  10681. defineWellKnownSymbol('matchAll');
  10682. /***/ }),
  10683. /* 441 */
  10684. /***/ (function(module, exports, __webpack_require__) {
  10685. var defineWellKnownSymbol = __webpack_require__(10);
  10686. // `Symbol.replace` well-known symbol
  10687. // https://tc39.es/ecma262/#sec-symbol.replace
  10688. defineWellKnownSymbol('replace');
  10689. /***/ }),
  10690. /* 442 */
  10691. /***/ (function(module, exports, __webpack_require__) {
  10692. var defineWellKnownSymbol = __webpack_require__(10);
  10693. // `Symbol.search` well-known symbol
  10694. // https://tc39.es/ecma262/#sec-symbol.search
  10695. defineWellKnownSymbol('search');
  10696. /***/ }),
  10697. /* 443 */
  10698. /***/ (function(module, exports, __webpack_require__) {
  10699. var defineWellKnownSymbol = __webpack_require__(10);
  10700. // `Symbol.species` well-known symbol
  10701. // https://tc39.es/ecma262/#sec-symbol.species
  10702. defineWellKnownSymbol('species');
  10703. /***/ }),
  10704. /* 444 */
  10705. /***/ (function(module, exports, __webpack_require__) {
  10706. var defineWellKnownSymbol = __webpack_require__(10);
  10707. // `Symbol.split` well-known symbol
  10708. // https://tc39.es/ecma262/#sec-symbol.split
  10709. defineWellKnownSymbol('split');
  10710. /***/ }),
  10711. /* 445 */
  10712. /***/ (function(module, exports, __webpack_require__) {
  10713. var defineWellKnownSymbol = __webpack_require__(10);
  10714. var defineSymbolToPrimitive = __webpack_require__(246);
  10715. // `Symbol.toPrimitive` well-known symbol
  10716. // https://tc39.es/ecma262/#sec-symbol.toprimitive
  10717. defineWellKnownSymbol('toPrimitive');
  10718. // `Symbol.prototype[@@toPrimitive]` method
  10719. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  10720. defineSymbolToPrimitive();
  10721. /***/ }),
  10722. /* 446 */
  10723. /***/ (function(module, exports, __webpack_require__) {
  10724. var getBuiltIn = __webpack_require__(18);
  10725. var defineWellKnownSymbol = __webpack_require__(10);
  10726. var setToStringTag = __webpack_require__(52);
  10727. // `Symbol.toStringTag` well-known symbol
  10728. // https://tc39.es/ecma262/#sec-symbol.tostringtag
  10729. defineWellKnownSymbol('toStringTag');
  10730. // `Symbol.prototype[@@toStringTag]` property
  10731. // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
  10732. setToStringTag(getBuiltIn('Symbol'), 'Symbol');
  10733. /***/ }),
  10734. /* 447 */
  10735. /***/ (function(module, exports, __webpack_require__) {
  10736. var defineWellKnownSymbol = __webpack_require__(10);
  10737. // `Symbol.unscopables` well-known symbol
  10738. // https://tc39.es/ecma262/#sec-symbol.unscopables
  10739. defineWellKnownSymbol('unscopables');
  10740. /***/ }),
  10741. /* 448 */
  10742. /***/ (function(module, exports, __webpack_require__) {
  10743. var global = __webpack_require__(7);
  10744. var setToStringTag = __webpack_require__(52);
  10745. // JSON[@@toStringTag] property
  10746. // https://tc39.es/ecma262/#sec-json-@@tostringtag
  10747. setToStringTag(global.JSON, 'JSON', true);
  10748. /***/ }),
  10749. /* 449 */
  10750. /***/ (function(module, exports) {
  10751. // empty
  10752. /***/ }),
  10753. /* 450 */
  10754. /***/ (function(module, exports) {
  10755. // empty
  10756. /***/ }),
  10757. /* 451 */
  10758. /***/ (function(module, exports, __webpack_require__) {
  10759. var defineWellKnownSymbol = __webpack_require__(10);
  10760. // `Symbol.asyncDispose` well-known symbol
  10761. // https://github.com/tc39/proposal-using-statement
  10762. defineWellKnownSymbol('asyncDispose');
  10763. /***/ }),
  10764. /* 452 */
  10765. /***/ (function(module, exports, __webpack_require__) {
  10766. var defineWellKnownSymbol = __webpack_require__(10);
  10767. // `Symbol.dispose` well-known symbol
  10768. // https://github.com/tc39/proposal-using-statement
  10769. defineWellKnownSymbol('dispose');
  10770. /***/ }),
  10771. /* 453 */
  10772. /***/ (function(module, exports, __webpack_require__) {
  10773. var defineWellKnownSymbol = __webpack_require__(10);
  10774. // `Symbol.matcher` well-known symbol
  10775. // https://github.com/tc39/proposal-pattern-matching
  10776. defineWellKnownSymbol('matcher');
  10777. /***/ }),
  10778. /* 454 */
  10779. /***/ (function(module, exports, __webpack_require__) {
  10780. var defineWellKnownSymbol = __webpack_require__(10);
  10781. // `Symbol.metadataKey` well-known symbol
  10782. // https://github.com/tc39/proposal-decorator-metadata
  10783. defineWellKnownSymbol('metadataKey');
  10784. /***/ }),
  10785. /* 455 */
  10786. /***/ (function(module, exports, __webpack_require__) {
  10787. var defineWellKnownSymbol = __webpack_require__(10);
  10788. // `Symbol.observable` well-known symbol
  10789. // https://github.com/tc39/proposal-observable
  10790. defineWellKnownSymbol('observable');
  10791. /***/ }),
  10792. /* 456 */
  10793. /***/ (function(module, exports, __webpack_require__) {
  10794. // TODO: Remove from `core-js@4`
  10795. var defineWellKnownSymbol = __webpack_require__(10);
  10796. // `Symbol.metadata` well-known symbol
  10797. // https://github.com/tc39/proposal-decorators
  10798. defineWellKnownSymbol('metadata');
  10799. /***/ }),
  10800. /* 457 */
  10801. /***/ (function(module, exports, __webpack_require__) {
  10802. // TODO: remove from `core-js@4`
  10803. var defineWellKnownSymbol = __webpack_require__(10);
  10804. // `Symbol.patternMatch` well-known symbol
  10805. // https://github.com/tc39/proposal-pattern-matching
  10806. defineWellKnownSymbol('patternMatch');
  10807. /***/ }),
  10808. /* 458 */
  10809. /***/ (function(module, exports, __webpack_require__) {
  10810. // TODO: remove from `core-js@4`
  10811. var defineWellKnownSymbol = __webpack_require__(10);
  10812. defineWellKnownSymbol('replaceAll');
  10813. /***/ }),
  10814. /* 459 */
  10815. /***/ (function(module, exports, __webpack_require__) {
  10816. module.exports = __webpack_require__(460);
  10817. /***/ }),
  10818. /* 460 */
  10819. /***/ (function(module, exports, __webpack_require__) {
  10820. module.exports = __webpack_require__(461);
  10821. /***/ }),
  10822. /* 461 */
  10823. /***/ (function(module, exports, __webpack_require__) {
  10824. var parent = __webpack_require__(462);
  10825. module.exports = parent;
  10826. /***/ }),
  10827. /* 462 */
  10828. /***/ (function(module, exports, __webpack_require__) {
  10829. var parent = __webpack_require__(249);
  10830. module.exports = parent;
  10831. /***/ }),
  10832. /* 463 */
  10833. /***/ (function(module, exports, __webpack_require__) {
  10834. __webpack_require__(38);
  10835. __webpack_require__(53);
  10836. __webpack_require__(55);
  10837. __webpack_require__(248);
  10838. var WrappedWellKnownSymbolModule = __webpack_require__(148);
  10839. module.exports = WrappedWellKnownSymbolModule.f('iterator');
  10840. /***/ }),
  10841. /* 464 */
  10842. /***/ (function(module, exports, __webpack_require__) {
  10843. var parent = __webpack_require__(465);
  10844. module.exports = parent;
  10845. /***/ }),
  10846. /* 465 */
  10847. /***/ (function(module, exports, __webpack_require__) {
  10848. var isPrototypeOf = __webpack_require__(19);
  10849. var method = __webpack_require__(466);
  10850. var ArrayPrototype = Array.prototype;
  10851. module.exports = function (it) {
  10852. var own = it.filter;
  10853. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
  10854. };
  10855. /***/ }),
  10856. /* 466 */
  10857. /***/ (function(module, exports, __webpack_require__) {
  10858. __webpack_require__(467);
  10859. var entryVirtual = __webpack_require__(40);
  10860. module.exports = entryVirtual('Array').filter;
  10861. /***/ }),
  10862. /* 467 */
  10863. /***/ (function(module, exports, __webpack_require__) {
  10864. "use strict";
  10865. var $ = __webpack_require__(0);
  10866. var $filter = __webpack_require__(70).filter;
  10867. var arrayMethodHasSpeciesSupport = __webpack_require__(114);
  10868. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  10869. // `Array.prototype.filter` method
  10870. // https://tc39.es/ecma262/#sec-array.prototype.filter
  10871. // with adding support of @@species
  10872. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  10873. filter: function filter(callbackfn /* , thisArg */) {
  10874. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  10875. }
  10876. });
  10877. /***/ }),
  10878. /* 468 */
  10879. /***/ (function(module, exports, __webpack_require__) {
  10880. "use strict";
  10881. var _interopRequireDefault = __webpack_require__(1);
  10882. var _slice = _interopRequireDefault(__webpack_require__(61));
  10883. var _keys = _interopRequireDefault(__webpack_require__(59));
  10884. var _concat = _interopRequireDefault(__webpack_require__(22));
  10885. var _ = __webpack_require__(3);
  10886. module.exports = function (AV) {
  10887. var eventSplitter = /\s+/;
  10888. var slice = (0, _slice.default)(Array.prototype);
  10889. /**
  10890. * @class
  10891. *
  10892. * <p>AV.Events is a fork of Backbone's Events module, provided for your
  10893. * convenience.</p>
  10894. *
  10895. * <p>A module that can be mixed in to any object in order to provide
  10896. * it with custom events. You may bind callback functions to an event
  10897. * with `on`, or remove these functions with `off`.
  10898. * Triggering an event fires all callbacks in the order that `on` was
  10899. * called.
  10900. *
  10901. * @private
  10902. * @example
  10903. * var object = {};
  10904. * _.extend(object, AV.Events);
  10905. * object.on('expand', function(){ alert('expanded'); });
  10906. * object.trigger('expand');</pre></p>
  10907. *
  10908. */
  10909. AV.Events = {
  10910. /**
  10911. * Bind one or more space separated events, `events`, to a `callback`
  10912. * function. Passing `"all"` will bind the callback to all events fired.
  10913. */
  10914. on: function on(events, callback, context) {
  10915. var calls, event, node, tail, list;
  10916. if (!callback) {
  10917. return this;
  10918. }
  10919. events = events.split(eventSplitter);
  10920. calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
  10921. // modification. The tail is an empty object that will always be used
  10922. // as the next node.
  10923. event = events.shift();
  10924. while (event) {
  10925. list = calls[event];
  10926. node = list ? list.tail : {};
  10927. node.next = tail = {};
  10928. node.context = context;
  10929. node.callback = callback;
  10930. calls[event] = {
  10931. tail: tail,
  10932. next: list ? list.next : node
  10933. };
  10934. event = events.shift();
  10935. }
  10936. return this;
  10937. },
  10938. /**
  10939. * Remove one or many callbacks. If `context` is null, removes all callbacks
  10940. * with that function. If `callback` is null, removes all callbacks for the
  10941. * event. If `events` is null, removes all bound callbacks for all events.
  10942. */
  10943. off: function off(events, callback, context) {
  10944. var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
  10945. if (!(calls = this._callbacks)) {
  10946. return;
  10947. }
  10948. if (!(events || callback || context)) {
  10949. delete this._callbacks;
  10950. return this;
  10951. } // Loop through the listed events and contexts, splicing them out of the
  10952. // linked list of callbacks if appropriate.
  10953. events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
  10954. event = events.shift();
  10955. while (event) {
  10956. node = calls[event];
  10957. delete calls[event];
  10958. if (!node || !(callback || context)) {
  10959. continue;
  10960. } // Create a new list, omitting the indicated callbacks.
  10961. tail = node.tail;
  10962. node = node.next;
  10963. while (node !== tail) {
  10964. cb = node.callback;
  10965. ctx = node.context;
  10966. if (callback && cb !== callback || context && ctx !== context) {
  10967. this.on(event, cb, ctx);
  10968. }
  10969. node = node.next;
  10970. }
  10971. event = events.shift();
  10972. }
  10973. return this;
  10974. },
  10975. /**
  10976. * Trigger one or many events, firing all bound callbacks. Callbacks are
  10977. * passed the same arguments as `trigger` is, apart from the event name
  10978. * (unless you're listening on `"all"`, which will cause your callback to
  10979. * receive the true name of the event as the first argument).
  10980. */
  10981. trigger: function trigger(events) {
  10982. var event, node, calls, tail, args, all, rest;
  10983. if (!(calls = this._callbacks)) {
  10984. return this;
  10985. }
  10986. all = calls.all;
  10987. events = events.split(eventSplitter);
  10988. rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
  10989. // first to trigger the event, then to trigger any `"all"` callbacks.
  10990. event = events.shift();
  10991. while (event) {
  10992. node = calls[event];
  10993. if (node) {
  10994. tail = node.tail;
  10995. while ((node = node.next) !== tail) {
  10996. node.callback.apply(node.context || this, rest);
  10997. }
  10998. }
  10999. node = all;
  11000. if (node) {
  11001. var _context;
  11002. tail = node.tail;
  11003. args = (0, _concat.default)(_context = [event]).call(_context, rest);
  11004. while ((node = node.next) !== tail) {
  11005. node.callback.apply(node.context || this, args);
  11006. }
  11007. }
  11008. event = events.shift();
  11009. }
  11010. return this;
  11011. }
  11012. };
  11013. /**
  11014. * @function
  11015. */
  11016. AV.Events.bind = AV.Events.on;
  11017. /**
  11018. * @function
  11019. */
  11020. AV.Events.unbind = AV.Events.off;
  11021. };
  11022. /***/ }),
  11023. /* 469 */
  11024. /***/ (function(module, exports, __webpack_require__) {
  11025. "use strict";
  11026. var _interopRequireDefault = __webpack_require__(1);
  11027. var _promise = _interopRequireDefault(__webpack_require__(12));
  11028. var _ = __webpack_require__(3);
  11029. /*global navigator: false */
  11030. module.exports = function (AV) {
  11031. /**
  11032. * Creates a new GeoPoint with any of the following forms:<br>
  11033. * @example
  11034. * new GeoPoint(otherGeoPoint)
  11035. * new GeoPoint(30, 30)
  11036. * new GeoPoint([30, 30])
  11037. * new GeoPoint({latitude: 30, longitude: 30})
  11038. * new GeoPoint() // defaults to (0, 0)
  11039. * @class
  11040. *
  11041. * <p>Represents a latitude / longitude point that may be associated
  11042. * with a key in a AVObject or used as a reference point for geo queries.
  11043. * This allows proximity-based queries on the key.</p>
  11044. *
  11045. * <p>Only one key in a class may contain a GeoPoint.</p>
  11046. *
  11047. * <p>Example:<pre>
  11048. * var point = new AV.GeoPoint(30.0, -20.0);
  11049. * var object = new AV.Object("PlaceObject");
  11050. * object.set("location", point);
  11051. * object.save();</pre></p>
  11052. */
  11053. AV.GeoPoint = function (arg1, arg2) {
  11054. if (_.isArray(arg1)) {
  11055. AV.GeoPoint._validate(arg1[0], arg1[1]);
  11056. this.latitude = arg1[0];
  11057. this.longitude = arg1[1];
  11058. } else if (_.isObject(arg1)) {
  11059. AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
  11060. this.latitude = arg1.latitude;
  11061. this.longitude = arg1.longitude;
  11062. } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
  11063. AV.GeoPoint._validate(arg1, arg2);
  11064. this.latitude = arg1;
  11065. this.longitude = arg2;
  11066. } else {
  11067. this.latitude = 0;
  11068. this.longitude = 0;
  11069. } // Add properties so that anyone using Webkit or Mozilla will get an error
  11070. // if they try to set values that are out of bounds.
  11071. var self = this;
  11072. if (this.__defineGetter__ && this.__defineSetter__) {
  11073. // Use _latitude and _longitude to actually store the values, and add
  11074. // getters and setters for latitude and longitude.
  11075. this._latitude = this.latitude;
  11076. this._longitude = this.longitude;
  11077. this.__defineGetter__('latitude', function () {
  11078. return self._latitude;
  11079. });
  11080. this.__defineGetter__('longitude', function () {
  11081. return self._longitude;
  11082. });
  11083. this.__defineSetter__('latitude', function (val) {
  11084. AV.GeoPoint._validate(val, self.longitude);
  11085. self._latitude = val;
  11086. });
  11087. this.__defineSetter__('longitude', function (val) {
  11088. AV.GeoPoint._validate(self.latitude, val);
  11089. self._longitude = val;
  11090. });
  11091. }
  11092. };
  11093. /**
  11094. * @lends AV.GeoPoint.prototype
  11095. * @property {float} latitude North-south portion of the coordinate, in range
  11096. * [-90, 90]. Throws an exception if set out of range in a modern browser.
  11097. * @property {float} longitude East-west portion of the coordinate, in range
  11098. * [-180, 180]. Throws if set out of range in a modern browser.
  11099. */
  11100. /**
  11101. * Throws an exception if the given lat-long is out of bounds.
  11102. * @private
  11103. */
  11104. AV.GeoPoint._validate = function (latitude, longitude) {
  11105. if (latitude < -90.0) {
  11106. throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
  11107. }
  11108. if (latitude > 90.0) {
  11109. throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
  11110. }
  11111. if (longitude < -180.0) {
  11112. throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
  11113. }
  11114. if (longitude > 180.0) {
  11115. throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
  11116. }
  11117. };
  11118. /**
  11119. * Creates a GeoPoint with the user's current location, if available.
  11120. * @return {Promise.<AV.GeoPoint>}
  11121. */
  11122. AV.GeoPoint.current = function () {
  11123. return new _promise.default(function (resolve, reject) {
  11124. navigator.geolocation.getCurrentPosition(function (location) {
  11125. resolve(new AV.GeoPoint({
  11126. latitude: location.coords.latitude,
  11127. longitude: location.coords.longitude
  11128. }));
  11129. }, reject);
  11130. });
  11131. };
  11132. _.extend(AV.GeoPoint.prototype,
  11133. /** @lends AV.GeoPoint.prototype */
  11134. {
  11135. /**
  11136. * Returns a JSON representation of the GeoPoint, suitable for AV.
  11137. * @return {Object}
  11138. */
  11139. toJSON: function toJSON() {
  11140. AV.GeoPoint._validate(this.latitude, this.longitude);
  11141. return {
  11142. __type: 'GeoPoint',
  11143. latitude: this.latitude,
  11144. longitude: this.longitude
  11145. };
  11146. },
  11147. /**
  11148. * Returns the distance from this GeoPoint to another in radians.
  11149. * @param {AV.GeoPoint} point the other AV.GeoPoint.
  11150. * @return {Number}
  11151. */
  11152. radiansTo: function radiansTo(point) {
  11153. var d2r = Math.PI / 180.0;
  11154. var lat1rad = this.latitude * d2r;
  11155. var long1rad = this.longitude * d2r;
  11156. var lat2rad = point.latitude * d2r;
  11157. var long2rad = point.longitude * d2r;
  11158. var deltaLat = lat1rad - lat2rad;
  11159. var deltaLong = long1rad - long2rad;
  11160. var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
  11161. var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
  11162. var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
  11163. a = Math.min(1.0, a);
  11164. return 2 * Math.asin(Math.sqrt(a));
  11165. },
  11166. /**
  11167. * Returns the distance from this GeoPoint to another in kilometers.
  11168. * @param {AV.GeoPoint} point the other AV.GeoPoint.
  11169. * @return {Number}
  11170. */
  11171. kilometersTo: function kilometersTo(point) {
  11172. return this.radiansTo(point) * 6371.0;
  11173. },
  11174. /**
  11175. * Returns the distance from this GeoPoint to another in miles.
  11176. * @param {AV.GeoPoint} point the other AV.GeoPoint.
  11177. * @return {Number}
  11178. */
  11179. milesTo: function milesTo(point) {
  11180. return this.radiansTo(point) * 3958.8;
  11181. }
  11182. });
  11183. };
  11184. /***/ }),
  11185. /* 470 */
  11186. /***/ (function(module, exports, __webpack_require__) {
  11187. "use strict";
  11188. var _ = __webpack_require__(3);
  11189. module.exports = function (AV) {
  11190. var PUBLIC_KEY = '*';
  11191. /**
  11192. * Creates a new ACL.
  11193. * If no argument is given, the ACL has no permissions for anyone.
  11194. * If the argument is a AV.User, the ACL will have read and write
  11195. * permission for only that user.
  11196. * If the argument is any other JSON object, that object will be interpretted
  11197. * as a serialized ACL created with toJSON().
  11198. * @see AV.Object#setACL
  11199. * @class
  11200. *
  11201. * <p>An ACL, or Access Control List can be added to any
  11202. * <code>AV.Object</code> to restrict access to only a subset of users
  11203. * of your application.</p>
  11204. */
  11205. AV.ACL = function (arg1) {
  11206. var self = this;
  11207. self.permissionsById = {};
  11208. if (_.isObject(arg1)) {
  11209. if (arg1 instanceof AV.User) {
  11210. self.setReadAccess(arg1, true);
  11211. self.setWriteAccess(arg1, true);
  11212. } else {
  11213. if (_.isFunction(arg1)) {
  11214. throw new Error('AV.ACL() called with a function. Did you forget ()?');
  11215. }
  11216. AV._objectEach(arg1, function (accessList, userId) {
  11217. if (!_.isString(userId)) {
  11218. throw new Error('Tried to create an ACL with an invalid userId.');
  11219. }
  11220. self.permissionsById[userId] = {};
  11221. AV._objectEach(accessList, function (allowed, permission) {
  11222. if (permission !== 'read' && permission !== 'write') {
  11223. throw new Error('Tried to create an ACL with an invalid permission type.');
  11224. }
  11225. if (!_.isBoolean(allowed)) {
  11226. throw new Error('Tried to create an ACL with an invalid permission value.');
  11227. }
  11228. self.permissionsById[userId][permission] = allowed;
  11229. });
  11230. });
  11231. }
  11232. }
  11233. };
  11234. /**
  11235. * Returns a JSON-encoded version of the ACL.
  11236. * @return {Object}
  11237. */
  11238. AV.ACL.prototype.toJSON = function () {
  11239. return _.clone(this.permissionsById);
  11240. };
  11241. AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
  11242. if (userId instanceof AV.User) {
  11243. userId = userId.id;
  11244. } else if (userId instanceof AV.Role) {
  11245. userId = 'role:' + userId.getName();
  11246. }
  11247. if (!_.isString(userId)) {
  11248. throw new Error('userId must be a string.');
  11249. }
  11250. if (!_.isBoolean(allowed)) {
  11251. throw new Error('allowed must be either true or false.');
  11252. }
  11253. var permissions = this.permissionsById[userId];
  11254. if (!permissions) {
  11255. if (!allowed) {
  11256. // The user already doesn't have this permission, so no action needed.
  11257. return;
  11258. } else {
  11259. permissions = {};
  11260. this.permissionsById[userId] = permissions;
  11261. }
  11262. }
  11263. if (allowed) {
  11264. this.permissionsById[userId][accessType] = true;
  11265. } else {
  11266. delete permissions[accessType];
  11267. if (_.isEmpty(permissions)) {
  11268. delete this.permissionsById[userId];
  11269. }
  11270. }
  11271. };
  11272. AV.ACL.prototype._getAccess = function (accessType, userId) {
  11273. if (userId instanceof AV.User) {
  11274. userId = userId.id;
  11275. } else if (userId instanceof AV.Role) {
  11276. userId = 'role:' + userId.getName();
  11277. }
  11278. var permissions = this.permissionsById[userId];
  11279. if (!permissions) {
  11280. return false;
  11281. }
  11282. return permissions[accessType] ? true : false;
  11283. };
  11284. /**
  11285. * Set whether the given user is allowed to read this object.
  11286. * @param userId An instance of AV.User or its objectId.
  11287. * @param {Boolean} allowed Whether that user should have read access.
  11288. */
  11289. AV.ACL.prototype.setReadAccess = function (userId, allowed) {
  11290. this._setAccess('read', userId, allowed);
  11291. };
  11292. /**
  11293. * Get whether the given user id is *explicitly* allowed to read this object.
  11294. * Even if this returns false, the user may still be able to access it if
  11295. * getPublicReadAccess returns true or a role that the user belongs to has
  11296. * write access.
  11297. * @param userId An instance of AV.User or its objectId, or a AV.Role.
  11298. * @return {Boolean}
  11299. */
  11300. AV.ACL.prototype.getReadAccess = function (userId) {
  11301. return this._getAccess('read', userId);
  11302. };
  11303. /**
  11304. * Set whether the given user id is allowed to write this object.
  11305. * @param userId An instance of AV.User or its objectId, or a AV.Role..
  11306. * @param {Boolean} allowed Whether that user should have write access.
  11307. */
  11308. AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
  11309. this._setAccess('write', userId, allowed);
  11310. };
  11311. /**
  11312. * Get whether the given user id is *explicitly* allowed to write this object.
  11313. * Even if this returns false, the user may still be able to write it if
  11314. * getPublicWriteAccess returns true or a role that the user belongs to has
  11315. * write access.
  11316. * @param userId An instance of AV.User or its objectId, or a AV.Role.
  11317. * @return {Boolean}
  11318. */
  11319. AV.ACL.prototype.getWriteAccess = function (userId) {
  11320. return this._getAccess('write', userId);
  11321. };
  11322. /**
  11323. * Set whether the public is allowed to read this object.
  11324. * @param {Boolean} allowed
  11325. */
  11326. AV.ACL.prototype.setPublicReadAccess = function (allowed) {
  11327. this.setReadAccess(PUBLIC_KEY, allowed);
  11328. };
  11329. /**
  11330. * Get whether the public is allowed to read this object.
  11331. * @return {Boolean}
  11332. */
  11333. AV.ACL.prototype.getPublicReadAccess = function () {
  11334. return this.getReadAccess(PUBLIC_KEY);
  11335. };
  11336. /**
  11337. * Set whether the public is allowed to write this object.
  11338. * @param {Boolean} allowed
  11339. */
  11340. AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
  11341. this.setWriteAccess(PUBLIC_KEY, allowed);
  11342. };
  11343. /**
  11344. * Get whether the public is allowed to write this object.
  11345. * @return {Boolean}
  11346. */
  11347. AV.ACL.prototype.getPublicWriteAccess = function () {
  11348. return this.getWriteAccess(PUBLIC_KEY);
  11349. };
  11350. /**
  11351. * Get whether users belonging to the given role are allowed
  11352. * to read this object. Even if this returns false, the role may
  11353. * still be able to write it if a parent role has read access.
  11354. *
  11355. * @param role The name of the role, or a AV.Role object.
  11356. * @return {Boolean} true if the role has read access. false otherwise.
  11357. * @throws {String} If role is neither a AV.Role nor a String.
  11358. */
  11359. AV.ACL.prototype.getRoleReadAccess = function (role) {
  11360. if (role instanceof AV.Role) {
  11361. // Normalize to the String name
  11362. role = role.getName();
  11363. }
  11364. if (_.isString(role)) {
  11365. return this.getReadAccess('role:' + role);
  11366. }
  11367. throw new Error('role must be a AV.Role or a String');
  11368. };
  11369. /**
  11370. * Get whether users belonging to the given role are allowed
  11371. * to write this object. Even if this returns false, the role may
  11372. * still be able to write it if a parent role has write access.
  11373. *
  11374. * @param role The name of the role, or a AV.Role object.
  11375. * @return {Boolean} true if the role has write access. false otherwise.
  11376. * @throws {String} If role is neither a AV.Role nor a String.
  11377. */
  11378. AV.ACL.prototype.getRoleWriteAccess = function (role) {
  11379. if (role instanceof AV.Role) {
  11380. // Normalize to the String name
  11381. role = role.getName();
  11382. }
  11383. if (_.isString(role)) {
  11384. return this.getWriteAccess('role:' + role);
  11385. }
  11386. throw new Error('role must be a AV.Role or a String');
  11387. };
  11388. /**
  11389. * Set whether users belonging to the given role are allowed
  11390. * to read this object.
  11391. *
  11392. * @param role The name of the role, or a AV.Role object.
  11393. * @param {Boolean} allowed Whether the given role can read this object.
  11394. * @throws {String} If role is neither a AV.Role nor a String.
  11395. */
  11396. AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
  11397. if (role instanceof AV.Role) {
  11398. // Normalize to the String name
  11399. role = role.getName();
  11400. }
  11401. if (_.isString(role)) {
  11402. this.setReadAccess('role:' + role, allowed);
  11403. return;
  11404. }
  11405. throw new Error('role must be a AV.Role or a String');
  11406. };
  11407. /**
  11408. * Set whether users belonging to the given role are allowed
  11409. * to write this object.
  11410. *
  11411. * @param role The name of the role, or a AV.Role object.
  11412. * @param {Boolean} allowed Whether the given role can write this object.
  11413. * @throws {String} If role is neither a AV.Role nor a String.
  11414. */
  11415. AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
  11416. if (role instanceof AV.Role) {
  11417. // Normalize to the String name
  11418. role = role.getName();
  11419. }
  11420. if (_.isString(role)) {
  11421. this.setWriteAccess('role:' + role, allowed);
  11422. return;
  11423. }
  11424. throw new Error('role must be a AV.Role or a String');
  11425. };
  11426. };
  11427. /***/ }),
  11428. /* 471 */
  11429. /***/ (function(module, exports, __webpack_require__) {
  11430. "use strict";
  11431. var _interopRequireDefault = __webpack_require__(1);
  11432. var _concat = _interopRequireDefault(__webpack_require__(22));
  11433. var _find = _interopRequireDefault(__webpack_require__(93));
  11434. var _indexOf = _interopRequireDefault(__webpack_require__(71));
  11435. var _map = _interopRequireDefault(__webpack_require__(35));
  11436. var _ = __webpack_require__(3);
  11437. module.exports = function (AV) {
  11438. /**
  11439. * @private
  11440. * @class
  11441. * A AV.Op is an atomic operation that can be applied to a field in a
  11442. * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
  11443. * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
  11444. * is a AV.Op.Unset. These operations are stored in a AV.Object and
  11445. * sent to the server as part of <code>object.save()</code> operations.
  11446. * Instances of AV.Op should be immutable.
  11447. *
  11448. * You should not create subclasses of AV.Op or instantiate AV.Op
  11449. * directly.
  11450. */
  11451. AV.Op = function () {
  11452. this._initialize.apply(this, arguments);
  11453. };
  11454. _.extend(AV.Op.prototype,
  11455. /** @lends AV.Op.prototype */
  11456. {
  11457. _initialize: function _initialize() {}
  11458. });
  11459. _.extend(AV.Op, {
  11460. /**
  11461. * To create a new Op, call AV.Op._extend();
  11462. * @private
  11463. */
  11464. _extend: AV._extend,
  11465. // A map of __op string to decoder function.
  11466. _opDecoderMap: {},
  11467. /**
  11468. * Registers a function to convert a json object with an __op field into an
  11469. * instance of a subclass of AV.Op.
  11470. * @private
  11471. */
  11472. _registerDecoder: function _registerDecoder(opName, decoder) {
  11473. AV.Op._opDecoderMap[opName] = decoder;
  11474. },
  11475. /**
  11476. * Converts a json object into an instance of a subclass of AV.Op.
  11477. * @private
  11478. */
  11479. _decode: function _decode(json) {
  11480. var decoder = AV.Op._opDecoderMap[json.__op];
  11481. if (decoder) {
  11482. return decoder(json);
  11483. } else {
  11484. return undefined;
  11485. }
  11486. }
  11487. });
  11488. /*
  11489. * Add a handler for Batch ops.
  11490. */
  11491. AV.Op._registerDecoder('Batch', function (json) {
  11492. var op = null;
  11493. AV._arrayEach(json.ops, function (nextOp) {
  11494. nextOp = AV.Op._decode(nextOp);
  11495. op = nextOp._mergeWithPrevious(op);
  11496. });
  11497. return op;
  11498. });
  11499. /**
  11500. * @private
  11501. * @class
  11502. * A Set operation indicates that either the field was changed using
  11503. * AV.Object.set, or it is a mutable container that was detected as being
  11504. * changed.
  11505. */
  11506. AV.Op.Set = AV.Op._extend(
  11507. /** @lends AV.Op.Set.prototype */
  11508. {
  11509. _initialize: function _initialize(value) {
  11510. this._value = value;
  11511. },
  11512. /**
  11513. * Returns the new value of this field after the set.
  11514. */
  11515. value: function value() {
  11516. return this._value;
  11517. },
  11518. /**
  11519. * Returns a JSON version of the operation suitable for sending to AV.
  11520. * @return {Object}
  11521. */
  11522. toJSON: function toJSON() {
  11523. return AV._encode(this.value());
  11524. },
  11525. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11526. return this;
  11527. },
  11528. _estimate: function _estimate(oldValue) {
  11529. return this.value();
  11530. }
  11531. });
  11532. /**
  11533. * A sentinel value that is returned by AV.Op.Unset._estimate to
  11534. * indicate the field should be deleted. Basically, if you find _UNSET as a
  11535. * value in your object, you should remove that key.
  11536. */
  11537. AV.Op._UNSET = {};
  11538. /**
  11539. * @private
  11540. * @class
  11541. * An Unset operation indicates that this field has been deleted from the
  11542. * object.
  11543. */
  11544. AV.Op.Unset = AV.Op._extend(
  11545. /** @lends AV.Op.Unset.prototype */
  11546. {
  11547. /**
  11548. * Returns a JSON version of the operation suitable for sending to AV.
  11549. * @return {Object}
  11550. */
  11551. toJSON: function toJSON() {
  11552. return {
  11553. __op: 'Delete'
  11554. };
  11555. },
  11556. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11557. return this;
  11558. },
  11559. _estimate: function _estimate(oldValue) {
  11560. return AV.Op._UNSET;
  11561. }
  11562. });
  11563. AV.Op._registerDecoder('Delete', function (json) {
  11564. return new AV.Op.Unset();
  11565. });
  11566. /**
  11567. * @private
  11568. * @class
  11569. * An Increment is an atomic operation where the numeric value for the field
  11570. * will be increased by a given amount.
  11571. */
  11572. AV.Op.Increment = AV.Op._extend(
  11573. /** @lends AV.Op.Increment.prototype */
  11574. {
  11575. _initialize: function _initialize(amount) {
  11576. this._amount = amount;
  11577. },
  11578. /**
  11579. * Returns the amount to increment by.
  11580. * @return {Number} the amount to increment by.
  11581. */
  11582. amount: function amount() {
  11583. return this._amount;
  11584. },
  11585. /**
  11586. * Returns a JSON version of the operation suitable for sending to AV.
  11587. * @return {Object}
  11588. */
  11589. toJSON: function toJSON() {
  11590. return {
  11591. __op: 'Increment',
  11592. amount: this._amount
  11593. };
  11594. },
  11595. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11596. if (!previous) {
  11597. return this;
  11598. } else if (previous instanceof AV.Op.Unset) {
  11599. return new AV.Op.Set(this.amount());
  11600. } else if (previous instanceof AV.Op.Set) {
  11601. return new AV.Op.Set(previous.value() + this.amount());
  11602. } else if (previous instanceof AV.Op.Increment) {
  11603. return new AV.Op.Increment(this.amount() + previous.amount());
  11604. } else {
  11605. throw new Error('Op is invalid after previous op.');
  11606. }
  11607. },
  11608. _estimate: function _estimate(oldValue) {
  11609. if (!oldValue) {
  11610. return this.amount();
  11611. }
  11612. return oldValue + this.amount();
  11613. }
  11614. });
  11615. AV.Op._registerDecoder('Increment', function (json) {
  11616. return new AV.Op.Increment(json.amount);
  11617. });
  11618. /**
  11619. * @private
  11620. * @class
  11621. * BitAnd is an atomic operation where the given value will be bit and to the
  11622. * value than is stored in this field.
  11623. */
  11624. AV.Op.BitAnd = AV.Op._extend(
  11625. /** @lends AV.Op.BitAnd.prototype */
  11626. {
  11627. _initialize: function _initialize(value) {
  11628. this._value = value;
  11629. },
  11630. value: function value() {
  11631. return this._value;
  11632. },
  11633. /**
  11634. * Returns a JSON version of the operation suitable for sending to AV.
  11635. * @return {Object}
  11636. */
  11637. toJSON: function toJSON() {
  11638. return {
  11639. __op: 'BitAnd',
  11640. value: this.value()
  11641. };
  11642. },
  11643. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11644. if (!previous) {
  11645. return this;
  11646. } else if (previous instanceof AV.Op.Unset) {
  11647. return new AV.Op.Set(0);
  11648. } else if (previous instanceof AV.Op.Set) {
  11649. return new AV.Op.Set(previous.value() & this.value());
  11650. } else {
  11651. throw new Error('Op is invalid after previous op.');
  11652. }
  11653. },
  11654. _estimate: function _estimate(oldValue) {
  11655. return oldValue & this.value();
  11656. }
  11657. });
  11658. AV.Op._registerDecoder('BitAnd', function (json) {
  11659. return new AV.Op.BitAnd(json.value);
  11660. });
  11661. /**
  11662. * @private
  11663. * @class
  11664. * BitOr is an atomic operation where the given value will be bit and to the
  11665. * value than is stored in this field.
  11666. */
  11667. AV.Op.BitOr = AV.Op._extend(
  11668. /** @lends AV.Op.BitOr.prototype */
  11669. {
  11670. _initialize: function _initialize(value) {
  11671. this._value = value;
  11672. },
  11673. value: function value() {
  11674. return this._value;
  11675. },
  11676. /**
  11677. * Returns a JSON version of the operation suitable for sending to AV.
  11678. * @return {Object}
  11679. */
  11680. toJSON: function toJSON() {
  11681. return {
  11682. __op: 'BitOr',
  11683. value: this.value()
  11684. };
  11685. },
  11686. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11687. if (!previous) {
  11688. return this;
  11689. } else if (previous instanceof AV.Op.Unset) {
  11690. return new AV.Op.Set(this.value());
  11691. } else if (previous instanceof AV.Op.Set) {
  11692. return new AV.Op.Set(previous.value() | this.value());
  11693. } else {
  11694. throw new Error('Op is invalid after previous op.');
  11695. }
  11696. },
  11697. _estimate: function _estimate(oldValue) {
  11698. return oldValue | this.value();
  11699. }
  11700. });
  11701. AV.Op._registerDecoder('BitOr', function (json) {
  11702. return new AV.Op.BitOr(json.value);
  11703. });
  11704. /**
  11705. * @private
  11706. * @class
  11707. * BitXor is an atomic operation where the given value will be bit and to the
  11708. * value than is stored in this field.
  11709. */
  11710. AV.Op.BitXor = AV.Op._extend(
  11711. /** @lends AV.Op.BitXor.prototype */
  11712. {
  11713. _initialize: function _initialize(value) {
  11714. this._value = value;
  11715. },
  11716. value: function value() {
  11717. return this._value;
  11718. },
  11719. /**
  11720. * Returns a JSON version of the operation suitable for sending to AV.
  11721. * @return {Object}
  11722. */
  11723. toJSON: function toJSON() {
  11724. return {
  11725. __op: 'BitXor',
  11726. value: this.value()
  11727. };
  11728. },
  11729. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11730. if (!previous) {
  11731. return this;
  11732. } else if (previous instanceof AV.Op.Unset) {
  11733. return new AV.Op.Set(this.value());
  11734. } else if (previous instanceof AV.Op.Set) {
  11735. return new AV.Op.Set(previous.value() ^ this.value());
  11736. } else {
  11737. throw new Error('Op is invalid after previous op.');
  11738. }
  11739. },
  11740. _estimate: function _estimate(oldValue) {
  11741. return oldValue ^ this.value();
  11742. }
  11743. });
  11744. AV.Op._registerDecoder('BitXor', function (json) {
  11745. return new AV.Op.BitXor(json.value);
  11746. });
  11747. /**
  11748. * @private
  11749. * @class
  11750. * Add is an atomic operation where the given objects will be appended to the
  11751. * array that is stored in this field.
  11752. */
  11753. AV.Op.Add = AV.Op._extend(
  11754. /** @lends AV.Op.Add.prototype */
  11755. {
  11756. _initialize: function _initialize(objects) {
  11757. this._objects = objects;
  11758. },
  11759. /**
  11760. * Returns the objects to be added to the array.
  11761. * @return {Array} The objects to be added to the array.
  11762. */
  11763. objects: function objects() {
  11764. return this._objects;
  11765. },
  11766. /**
  11767. * Returns a JSON version of the operation suitable for sending to AV.
  11768. * @return {Object}
  11769. */
  11770. toJSON: function toJSON() {
  11771. return {
  11772. __op: 'Add',
  11773. objects: AV._encode(this.objects())
  11774. };
  11775. },
  11776. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11777. if (!previous) {
  11778. return this;
  11779. } else if (previous instanceof AV.Op.Unset) {
  11780. return new AV.Op.Set(this.objects());
  11781. } else if (previous instanceof AV.Op.Set) {
  11782. return new AV.Op.Set(this._estimate(previous.value()));
  11783. } else if (previous instanceof AV.Op.Add) {
  11784. var _context;
  11785. return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
  11786. } else {
  11787. throw new Error('Op is invalid after previous op.');
  11788. }
  11789. },
  11790. _estimate: function _estimate(oldValue) {
  11791. if (!oldValue) {
  11792. return _.clone(this.objects());
  11793. } else {
  11794. return (0, _concat.default)(oldValue).call(oldValue, this.objects());
  11795. }
  11796. }
  11797. });
  11798. AV.Op._registerDecoder('Add', function (json) {
  11799. return new AV.Op.Add(AV._decode(json.objects));
  11800. });
  11801. /**
  11802. * @private
  11803. * @class
  11804. * AddUnique is an atomic operation where the given items will be appended to
  11805. * the array that is stored in this field only if they were not already
  11806. * present in the array.
  11807. */
  11808. AV.Op.AddUnique = AV.Op._extend(
  11809. /** @lends AV.Op.AddUnique.prototype */
  11810. {
  11811. _initialize: function _initialize(objects) {
  11812. this._objects = _.uniq(objects);
  11813. },
  11814. /**
  11815. * Returns the objects to be added to the array.
  11816. * @return {Array} The objects to be added to the array.
  11817. */
  11818. objects: function objects() {
  11819. return this._objects;
  11820. },
  11821. /**
  11822. * Returns a JSON version of the operation suitable for sending to AV.
  11823. * @return {Object}
  11824. */
  11825. toJSON: function toJSON() {
  11826. return {
  11827. __op: 'AddUnique',
  11828. objects: AV._encode(this.objects())
  11829. };
  11830. },
  11831. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11832. if (!previous) {
  11833. return this;
  11834. } else if (previous instanceof AV.Op.Unset) {
  11835. return new AV.Op.Set(this.objects());
  11836. } else if (previous instanceof AV.Op.Set) {
  11837. return new AV.Op.Set(this._estimate(previous.value()));
  11838. } else if (previous instanceof AV.Op.AddUnique) {
  11839. return new AV.Op.AddUnique(this._estimate(previous.objects()));
  11840. } else {
  11841. throw new Error('Op is invalid after previous op.');
  11842. }
  11843. },
  11844. _estimate: function _estimate(oldValue) {
  11845. if (!oldValue) {
  11846. return _.clone(this.objects());
  11847. } else {
  11848. // We can't just take the _.uniq(_.union(...)) of oldValue and
  11849. // this.objects, because the uniqueness may not apply to oldValue
  11850. // (especially if the oldValue was set via .set())
  11851. var newValue = _.clone(oldValue);
  11852. AV._arrayEach(this.objects(), function (obj) {
  11853. if (obj instanceof AV.Object && obj.id) {
  11854. var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
  11855. return anObj instanceof AV.Object && anObj.id === obj.id;
  11856. });
  11857. if (!matchingObj) {
  11858. newValue.push(obj);
  11859. } else {
  11860. var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
  11861. newValue[index] = obj;
  11862. }
  11863. } else if (!_.contains(newValue, obj)) {
  11864. newValue.push(obj);
  11865. }
  11866. });
  11867. return newValue;
  11868. }
  11869. }
  11870. });
  11871. AV.Op._registerDecoder('AddUnique', function (json) {
  11872. return new AV.Op.AddUnique(AV._decode(json.objects));
  11873. });
  11874. /**
  11875. * @private
  11876. * @class
  11877. * Remove is an atomic operation where the given objects will be removed from
  11878. * the array that is stored in this field.
  11879. */
  11880. AV.Op.Remove = AV.Op._extend(
  11881. /** @lends AV.Op.Remove.prototype */
  11882. {
  11883. _initialize: function _initialize(objects) {
  11884. this._objects = _.uniq(objects);
  11885. },
  11886. /**
  11887. * Returns the objects to be removed from the array.
  11888. * @return {Array} The objects to be removed from the array.
  11889. */
  11890. objects: function objects() {
  11891. return this._objects;
  11892. },
  11893. /**
  11894. * Returns a JSON version of the operation suitable for sending to AV.
  11895. * @return {Object}
  11896. */
  11897. toJSON: function toJSON() {
  11898. return {
  11899. __op: 'Remove',
  11900. objects: AV._encode(this.objects())
  11901. };
  11902. },
  11903. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  11904. if (!previous) {
  11905. return this;
  11906. } else if (previous instanceof AV.Op.Unset) {
  11907. return previous;
  11908. } else if (previous instanceof AV.Op.Set) {
  11909. return new AV.Op.Set(this._estimate(previous.value()));
  11910. } else if (previous instanceof AV.Op.Remove) {
  11911. return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
  11912. } else {
  11913. throw new Error('Op is invalid after previous op.');
  11914. }
  11915. },
  11916. _estimate: function _estimate(oldValue) {
  11917. if (!oldValue) {
  11918. return [];
  11919. } else {
  11920. var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
  11921. AV._arrayEach(this.objects(), function (obj) {
  11922. if (obj instanceof AV.Object && obj.id) {
  11923. newValue = _.reject(newValue, function (other) {
  11924. return other instanceof AV.Object && other.id === obj.id;
  11925. });
  11926. }
  11927. });
  11928. return newValue;
  11929. }
  11930. }
  11931. });
  11932. AV.Op._registerDecoder('Remove', function (json) {
  11933. return new AV.Op.Remove(AV._decode(json.objects));
  11934. });
  11935. /**
  11936. * @private
  11937. * @class
  11938. * A Relation operation indicates that the field is an instance of
  11939. * AV.Relation, and objects are being added to, or removed from, that
  11940. * relation.
  11941. */
  11942. AV.Op.Relation = AV.Op._extend(
  11943. /** @lends AV.Op.Relation.prototype */
  11944. {
  11945. _initialize: function _initialize(adds, removes) {
  11946. this._targetClassName = null;
  11947. var self = this;
  11948. var pointerToId = function pointerToId(object) {
  11949. if (object instanceof AV.Object) {
  11950. if (!object.id) {
  11951. throw new Error("You can't add an unsaved AV.Object to a relation.");
  11952. }
  11953. if (!self._targetClassName) {
  11954. self._targetClassName = object.className;
  11955. }
  11956. if (self._targetClassName !== object.className) {
  11957. throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
  11958. }
  11959. return object.id;
  11960. }
  11961. return object;
  11962. };
  11963. this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
  11964. this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
  11965. },
  11966. /**
  11967. * Returns an array of unfetched AV.Object that are being added to the
  11968. * relation.
  11969. * @return {Array}
  11970. */
  11971. added: function added() {
  11972. var self = this;
  11973. return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
  11974. var object = AV.Object._create(self._targetClassName);
  11975. object.id = objectId;
  11976. return object;
  11977. });
  11978. },
  11979. /**
  11980. * Returns an array of unfetched AV.Object that are being removed from
  11981. * the relation.
  11982. * @return {Array}
  11983. */
  11984. removed: function removed() {
  11985. var self = this;
  11986. return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
  11987. var object = AV.Object._create(self._targetClassName);
  11988. object.id = objectId;
  11989. return object;
  11990. });
  11991. },
  11992. /**
  11993. * Returns a JSON version of the operation suitable for sending to AV.
  11994. * @return {Object}
  11995. */
  11996. toJSON: function toJSON() {
  11997. var adds = null;
  11998. var removes = null;
  11999. var self = this;
  12000. var idToPointer = function idToPointer(id) {
  12001. return {
  12002. __type: 'Pointer',
  12003. className: self._targetClassName,
  12004. objectId: id
  12005. };
  12006. };
  12007. var pointers = null;
  12008. if (this.relationsToAdd.length > 0) {
  12009. pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
  12010. adds = {
  12011. __op: 'AddRelation',
  12012. objects: pointers
  12013. };
  12014. }
  12015. if (this.relationsToRemove.length > 0) {
  12016. pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
  12017. removes = {
  12018. __op: 'RemoveRelation',
  12019. objects: pointers
  12020. };
  12021. }
  12022. if (adds && removes) {
  12023. return {
  12024. __op: 'Batch',
  12025. ops: [adds, removes]
  12026. };
  12027. }
  12028. return adds || removes || {};
  12029. },
  12030. _mergeWithPrevious: function _mergeWithPrevious(previous) {
  12031. if (!previous) {
  12032. return this;
  12033. } else if (previous instanceof AV.Op.Unset) {
  12034. throw new Error("You can't modify a relation after deleting it.");
  12035. } else if (previous instanceof AV.Op.Relation) {
  12036. if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
  12037. throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
  12038. }
  12039. var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
  12040. var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
  12041. var newRelation = new AV.Op.Relation(newAdd, newRemove);
  12042. newRelation._targetClassName = this._targetClassName;
  12043. return newRelation;
  12044. } else {
  12045. throw new Error('Op is invalid after previous op.');
  12046. }
  12047. },
  12048. _estimate: function _estimate(oldValue, object, key) {
  12049. if (!oldValue) {
  12050. var relation = new AV.Relation(object, key);
  12051. relation.targetClassName = this._targetClassName;
  12052. } else if (oldValue instanceof AV.Relation) {
  12053. if (this._targetClassName) {
  12054. if (oldValue.targetClassName) {
  12055. if (oldValue.targetClassName !== this._targetClassName) {
  12056. throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
  12057. }
  12058. } else {
  12059. oldValue.targetClassName = this._targetClassName;
  12060. }
  12061. }
  12062. return oldValue;
  12063. } else {
  12064. throw new Error('Op is invalid after previous op.');
  12065. }
  12066. }
  12067. });
  12068. AV.Op._registerDecoder('AddRelation', function (json) {
  12069. return new AV.Op.Relation(AV._decode(json.objects), []);
  12070. });
  12071. AV.Op._registerDecoder('RemoveRelation', function (json) {
  12072. return new AV.Op.Relation([], AV._decode(json.objects));
  12073. });
  12074. };
  12075. /***/ }),
  12076. /* 472 */
  12077. /***/ (function(module, exports, __webpack_require__) {
  12078. var parent = __webpack_require__(473);
  12079. module.exports = parent;
  12080. /***/ }),
  12081. /* 473 */
  12082. /***/ (function(module, exports, __webpack_require__) {
  12083. var isPrototypeOf = __webpack_require__(19);
  12084. var method = __webpack_require__(474);
  12085. var ArrayPrototype = Array.prototype;
  12086. module.exports = function (it) {
  12087. var own = it.find;
  12088. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
  12089. };
  12090. /***/ }),
  12091. /* 474 */
  12092. /***/ (function(module, exports, __webpack_require__) {
  12093. __webpack_require__(475);
  12094. var entryVirtual = __webpack_require__(40);
  12095. module.exports = entryVirtual('Array').find;
  12096. /***/ }),
  12097. /* 475 */
  12098. /***/ (function(module, exports, __webpack_require__) {
  12099. "use strict";
  12100. var $ = __webpack_require__(0);
  12101. var $find = __webpack_require__(70).find;
  12102. var addToUnscopables = __webpack_require__(169);
  12103. var FIND = 'find';
  12104. var SKIPS_HOLES = true;
  12105. // Shouldn't skip holes
  12106. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  12107. // `Array.prototype.find` method
  12108. // https://tc39.es/ecma262/#sec-array.prototype.find
  12109. $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  12110. find: function find(callbackfn /* , that = undefined */) {
  12111. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  12112. }
  12113. });
  12114. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  12115. addToUnscopables(FIND);
  12116. /***/ }),
  12117. /* 476 */
  12118. /***/ (function(module, exports, __webpack_require__) {
  12119. "use strict";
  12120. var _ = __webpack_require__(3);
  12121. module.exports = function (AV) {
  12122. /**
  12123. * Creates a new Relation for the given parent object and key. This
  12124. * constructor should rarely be used directly, but rather created by
  12125. * {@link AV.Object#relation}.
  12126. * @param {AV.Object} parent The parent of this relation.
  12127. * @param {String} key The key for this relation on the parent.
  12128. * @see AV.Object#relation
  12129. * @class
  12130. *
  12131. * <p>
  12132. * A class that is used to access all of the children of a many-to-many
  12133. * relationship. Each instance of AV.Relation is associated with a
  12134. * particular parent object and key.
  12135. * </p>
  12136. */
  12137. AV.Relation = function (parent, key) {
  12138. if (!_.isString(key)) {
  12139. throw new TypeError('key must be a string');
  12140. }
  12141. this.parent = parent;
  12142. this.key = key;
  12143. this.targetClassName = null;
  12144. };
  12145. /**
  12146. * Creates a query that can be used to query the parent objects in this relation.
  12147. * @param {String} parentClass The parent class or name.
  12148. * @param {String} relationKey The relation field key in parent.
  12149. * @param {AV.Object} child The child object.
  12150. * @return {AV.Query}
  12151. */
  12152. AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
  12153. var query = new AV.Query(parentClass);
  12154. query.equalTo(relationKey, child._toPointer());
  12155. return query;
  12156. };
  12157. _.extend(AV.Relation.prototype,
  12158. /** @lends AV.Relation.prototype */
  12159. {
  12160. /**
  12161. * Makes sure that this relation has the right parent and key.
  12162. * @private
  12163. */
  12164. _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
  12165. this.parent = this.parent || parent;
  12166. this.key = this.key || key;
  12167. if (this.parent !== parent) {
  12168. throw new Error('Internal Error. Relation retrieved from two different Objects.');
  12169. }
  12170. if (this.key !== key) {
  12171. throw new Error('Internal Error. Relation retrieved from two different keys.');
  12172. }
  12173. },
  12174. /**
  12175. * Adds a AV.Object or an array of AV.Objects to the relation.
  12176. * @param {AV.Object|AV.Object[]} objects The item or items to add.
  12177. */
  12178. add: function add(objects) {
  12179. if (!_.isArray(objects)) {
  12180. objects = [objects];
  12181. }
  12182. var change = new AV.Op.Relation(objects, []);
  12183. this.parent.set(this.key, change);
  12184. this.targetClassName = change._targetClassName;
  12185. },
  12186. /**
  12187. * Removes a AV.Object or an array of AV.Objects from this relation.
  12188. * @param {AV.Object|AV.Object[]} objects The item or items to remove.
  12189. */
  12190. remove: function remove(objects) {
  12191. if (!_.isArray(objects)) {
  12192. objects = [objects];
  12193. }
  12194. var change = new AV.Op.Relation([], objects);
  12195. this.parent.set(this.key, change);
  12196. this.targetClassName = change._targetClassName;
  12197. },
  12198. /**
  12199. * Returns a JSON version of the object suitable for saving to disk.
  12200. * @return {Object}
  12201. */
  12202. toJSON: function toJSON() {
  12203. return {
  12204. __type: 'Relation',
  12205. className: this.targetClassName
  12206. };
  12207. },
  12208. /**
  12209. * Returns a AV.Query that is limited to objects in this
  12210. * relation.
  12211. * @return {AV.Query}
  12212. */
  12213. query: function query() {
  12214. var targetClass;
  12215. var query;
  12216. if (!this.targetClassName) {
  12217. targetClass = AV.Object._getSubclass(this.parent.className);
  12218. query = new AV.Query(targetClass);
  12219. query._defaultParams.redirectClassNameForKey = this.key;
  12220. } else {
  12221. targetClass = AV.Object._getSubclass(this.targetClassName);
  12222. query = new AV.Query(targetClass);
  12223. }
  12224. query._addCondition('$relatedTo', 'object', this.parent._toPointer());
  12225. query._addCondition('$relatedTo', 'key', this.key);
  12226. return query;
  12227. }
  12228. });
  12229. };
  12230. /***/ }),
  12231. /* 477 */
  12232. /***/ (function(module, exports, __webpack_require__) {
  12233. "use strict";
  12234. var _interopRequireDefault = __webpack_require__(1);
  12235. var _promise = _interopRequireDefault(__webpack_require__(12));
  12236. var _ = __webpack_require__(3);
  12237. var cos = __webpack_require__(478);
  12238. var qiniu = __webpack_require__(479);
  12239. var s3 = __webpack_require__(525);
  12240. var AVError = __webpack_require__(46);
  12241. var _require = __webpack_require__(27),
  12242. request = _require.request,
  12243. AVRequest = _require._request;
  12244. var _require2 = __webpack_require__(30),
  12245. tap = _require2.tap,
  12246. transformFetchOptions = _require2.transformFetchOptions;
  12247. var debug = __webpack_require__(60)('leancloud:file');
  12248. var parseBase64 = __webpack_require__(529);
  12249. module.exports = function (AV) {
  12250. // port from browserify path module
  12251. // since react-native packager won't shim node modules.
  12252. var extname = function extname(path) {
  12253. if (!_.isString(path)) return '';
  12254. return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
  12255. };
  12256. var b64Digit = function b64Digit(number) {
  12257. if (number < 26) {
  12258. return String.fromCharCode(65 + number);
  12259. }
  12260. if (number < 52) {
  12261. return String.fromCharCode(97 + (number - 26));
  12262. }
  12263. if (number < 62) {
  12264. return String.fromCharCode(48 + (number - 52));
  12265. }
  12266. if (number === 62) {
  12267. return '+';
  12268. }
  12269. if (number === 63) {
  12270. return '/';
  12271. }
  12272. throw new Error('Tried to encode large digit ' + number + ' in base64.');
  12273. };
  12274. var encodeBase64 = function encodeBase64(array) {
  12275. var chunks = [];
  12276. chunks.length = Math.ceil(array.length / 3);
  12277. _.times(chunks.length, function (i) {
  12278. var b1 = array[i * 3];
  12279. var b2 = array[i * 3 + 1] || 0;
  12280. var b3 = array[i * 3 + 2] || 0;
  12281. var has2 = i * 3 + 1 < array.length;
  12282. var has3 = i * 3 + 2 < array.length;
  12283. chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');
  12284. });
  12285. return chunks.join('');
  12286. };
  12287. /**
  12288. * An AV.File is a local representation of a file that is saved to the AV
  12289. * cloud.
  12290. * @param name {String} The file's name. This will change to a unique value
  12291. * once the file has finished saving.
  12292. * @param data {Array} The data for the file, as either:
  12293. * 1. an Array of byte value Numbers, or
  12294. * 2. an Object like { base64: "..." } with a base64-encoded String.
  12295. * 3. a Blob(File) selected with a file upload control in a browser.
  12296. * 4. an Object like { blob: {uri: "..."} } that mimics Blob
  12297. * in some non-browser environments such as React Native.
  12298. * 5. a Buffer in Node.js runtime.
  12299. * 6. a Stream in Node.js runtime.
  12300. *
  12301. * For example:<pre>
  12302. * var fileUploadControl = $("#profilePhotoFileUpload")[0];
  12303. * if (fileUploadControl.files.length > 0) {
  12304. * var file = fileUploadControl.files[0];
  12305. * var name = "photo.jpg";
  12306. * var file = new AV.File(name, file);
  12307. * file.save().then(function() {
  12308. * // The file has been saved to AV.
  12309. * }, function(error) {
  12310. * // The file either could not be read, or could not be saved to AV.
  12311. * });
  12312. * }</pre>
  12313. *
  12314. * @class
  12315. * @param [mimeType] {String} Content-Type header to use for the file. If
  12316. * this is omitted, the content type will be inferred from the name's
  12317. * extension.
  12318. */
  12319. AV.File = function (name, data, mimeType) {
  12320. this.attributes = {
  12321. name: name,
  12322. url: '',
  12323. metaData: {},
  12324. // 用来存储转换后要上传的 base64 String
  12325. base64: ''
  12326. };
  12327. if (_.isString(data)) {
  12328. throw new TypeError('Creating an AV.File from a String is not yet supported.');
  12329. }
  12330. if (_.isArray(data)) {
  12331. this.attributes.metaData.size = data.length;
  12332. data = {
  12333. base64: encodeBase64(data)
  12334. };
  12335. }
  12336. this._extName = '';
  12337. this._data = data;
  12338. this._uploadHeaders = {};
  12339. if (data && data.blob && typeof data.blob.uri === 'string') {
  12340. this._extName = extname(data.blob.uri);
  12341. }
  12342. if (typeof Blob !== 'undefined' && data instanceof Blob) {
  12343. if (data.size) {
  12344. this.attributes.metaData.size = data.size;
  12345. }
  12346. if (data.name) {
  12347. this._extName = extname(data.name);
  12348. }
  12349. }
  12350. var owner;
  12351. if (data && data.owner) {
  12352. owner = data.owner;
  12353. } else if (!AV._config.disableCurrentUser) {
  12354. try {
  12355. owner = AV.User.current();
  12356. } catch (error) {
  12357. if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
  12358. throw error;
  12359. }
  12360. }
  12361. }
  12362. this.attributes.metaData.owner = owner ? owner.id : 'unknown';
  12363. this.set('mime_type', mimeType);
  12364. };
  12365. /**
  12366. * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
  12367. * @param {String} name the file name
  12368. * @param {String} url the file url.
  12369. * @param {Object} [metaData] the file metadata object.
  12370. * @param {String} [type] Content-Type header to use for the file. If
  12371. * this is omitted, the content type will be inferred from the name's
  12372. * extension.
  12373. * @return {AV.File} the file object
  12374. */
  12375. AV.File.withURL = function (name, url, metaData, type) {
  12376. if (!name || !url) {
  12377. throw new Error('Please provide file name and url');
  12378. }
  12379. var file = new AV.File(name, null, type); //copy metaData properties to file.
  12380. if (metaData) {
  12381. for (var prop in metaData) {
  12382. if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
  12383. }
  12384. }
  12385. file.attributes.url = url; //Mark the file is from external source.
  12386. file.attributes.metaData.__source = 'external';
  12387. file.attributes.metaData.size = 0;
  12388. return file;
  12389. };
  12390. /**
  12391. * Creates a file object with exists objectId.
  12392. * @param {String} objectId The objectId string
  12393. * @return {AV.File} the file object
  12394. */
  12395. AV.File.createWithoutData = function (objectId) {
  12396. if (!objectId) {
  12397. throw new TypeError('The objectId must be provided');
  12398. }
  12399. var file = new AV.File();
  12400. file.id = objectId;
  12401. return file;
  12402. };
  12403. /**
  12404. * Request file censor.
  12405. * @since 4.13.0
  12406. * @param {String} objectId
  12407. * @return {Promise.<string>}
  12408. */
  12409. AV.File.censor = function (objectId) {
  12410. if (!AV._config.masterKey) {
  12411. throw new Error('Cannot censor a file without masterKey');
  12412. }
  12413. return request({
  12414. method: 'POST',
  12415. path: "/files/".concat(objectId, "/censor"),
  12416. authOptions: {
  12417. useMasterKey: true
  12418. }
  12419. }).then(function (res) {
  12420. return res.censorResult;
  12421. });
  12422. };
  12423. _.extend(AV.File.prototype,
  12424. /** @lends AV.File.prototype */
  12425. {
  12426. className: '_File',
  12427. _toFullJSON: function _toFullJSON(seenObjects) {
  12428. var _this = this;
  12429. var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  12430. var json = _.clone(this.attributes);
  12431. AV._objectEach(json, function (val, key) {
  12432. json[key] = AV._encode(val, seenObjects, undefined, full);
  12433. });
  12434. AV._objectEach(this._operations, function (val, key) {
  12435. json[key] = val;
  12436. });
  12437. if (_.has(this, 'id')) {
  12438. json.objectId = this.id;
  12439. }
  12440. ['createdAt', 'updatedAt'].forEach(function (key) {
  12441. if (_.has(_this, key)) {
  12442. var val = _this[key];
  12443. json[key] = _.isDate(val) ? val.toJSON() : val;
  12444. }
  12445. });
  12446. if (full) {
  12447. json.__type = 'File';
  12448. }
  12449. return json;
  12450. },
  12451. /**
  12452. * Returns a JSON version of the file with meta data.
  12453. * Inverse to {@link AV.parseJSON}
  12454. * @since 3.0.0
  12455. * @return {Object}
  12456. */
  12457. toFullJSON: function toFullJSON() {
  12458. var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  12459. return this._toFullJSON(seenObjects);
  12460. },
  12461. /**
  12462. * Returns a JSON version of the object.
  12463. * @return {Object}
  12464. */
  12465. toJSON: function toJSON(key, holder) {
  12466. var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
  12467. return this._toFullJSON(seenObjects, false);
  12468. },
  12469. /**
  12470. * Gets a Pointer referencing this file.
  12471. * @private
  12472. */
  12473. _toPointer: function _toPointer() {
  12474. return {
  12475. __type: 'Pointer',
  12476. className: this.className,
  12477. objectId: this.id
  12478. };
  12479. },
  12480. /**
  12481. * Returns the ACL for this file.
  12482. * @returns {AV.ACL} An instance of AV.ACL.
  12483. */
  12484. getACL: function getACL() {
  12485. return this._acl;
  12486. },
  12487. /**
  12488. * Sets the ACL to be used for this file.
  12489. * @param {AV.ACL} acl An instance of AV.ACL.
  12490. */
  12491. setACL: function setACL(acl) {
  12492. if (!(acl instanceof AV.ACL)) {
  12493. return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
  12494. }
  12495. this._acl = acl;
  12496. return this;
  12497. },
  12498. /**
  12499. * Gets the name of the file. Before save is called, this is the filename
  12500. * given by the user. After save is called, that name gets prefixed with a
  12501. * unique identifier.
  12502. */
  12503. name: function name() {
  12504. return this.get('name');
  12505. },
  12506. /**
  12507. * Gets the url of the file. It is only available after you save the file or
  12508. * after you get the file from a AV.Object.
  12509. * @return {String}
  12510. */
  12511. url: function url() {
  12512. return this.get('url');
  12513. },
  12514. /**
  12515. * Gets the attributs of the file object.
  12516. * @param {String} The attribute name which want to get.
  12517. * @returns {Any}
  12518. */
  12519. get: function get(attrName) {
  12520. switch (attrName) {
  12521. case 'objectId':
  12522. return this.id;
  12523. case 'url':
  12524. case 'name':
  12525. case 'mime_type':
  12526. case 'metaData':
  12527. case 'createdAt':
  12528. case 'updatedAt':
  12529. return this.attributes[attrName];
  12530. default:
  12531. return this.attributes.metaData[attrName];
  12532. }
  12533. },
  12534. /**
  12535. * Set the metaData of the file object.
  12536. * @param {Object} Object is an key value Object for setting metaData.
  12537. * @param {String} attr is an optional metadata key.
  12538. * @param {Object} value is an optional metadata value.
  12539. * @returns {String|Number|Array|Object}
  12540. */
  12541. set: function set() {
  12542. var _this2 = this;
  12543. var set = function set(attrName, value) {
  12544. switch (attrName) {
  12545. case 'name':
  12546. case 'url':
  12547. case 'mime_type':
  12548. case 'base64':
  12549. case 'metaData':
  12550. _this2.attributes[attrName] = value;
  12551. break;
  12552. default:
  12553. // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
  12554. _this2.attributes.metaData[attrName] = value;
  12555. break;
  12556. }
  12557. };
  12558. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  12559. args[_key] = arguments[_key];
  12560. }
  12561. switch (args.length) {
  12562. case 1:
  12563. // 传入一个 Object
  12564. for (var k in args[0]) {
  12565. set(k, args[0][k]);
  12566. }
  12567. break;
  12568. case 2:
  12569. set(args[0], args[1]);
  12570. break;
  12571. }
  12572. return this;
  12573. },
  12574. /**
  12575. * Set a header for the upload request.
  12576. * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
  12577. *
  12578. * @param {String} key header key
  12579. * @param {String} value header value
  12580. * @return {AV.File} this
  12581. */
  12582. setUploadHeader: function setUploadHeader(key, value) {
  12583. this._uploadHeaders[key] = value;
  12584. return this;
  12585. },
  12586. /**
  12587. * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
  12588. * metadata value if a key is given.Set metadata value if key and value are both given.</p>
  12589. * <p><pre>
  12590. * var metadata = file.metaData(); //Get metadata JSON object.
  12591. * var size = file.metaData('size'); // Get the size metadata value.
  12592. * file.metaData('format', 'jpeg'); //set metadata attribute and value.
  12593. *</pre></p>
  12594. * @return {Object} The file's metadata JSON object.
  12595. * @param {String} attr an optional metadata key.
  12596. * @param {Object} value an optional metadata value.
  12597. **/
  12598. metaData: function metaData(attr, value) {
  12599. if (attr && value) {
  12600. this.attributes.metaData[attr] = value;
  12601. return this;
  12602. } else if (attr && !value) {
  12603. return this.attributes.metaData[attr];
  12604. } else {
  12605. return this.attributes.metaData;
  12606. }
  12607. },
  12608. /**
  12609. * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
  12610. * @return {String} 缩略图URL
  12611. * @param {Number} width 宽度,单位:像素
  12612. * @param {Number} heigth 高度,单位:像素
  12613. * @param {Number} quality 质量,1-100的数字,默认100
  12614. * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
  12615. * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
  12616. */
  12617. thumbnailURL: function thumbnailURL(width, height) {
  12618. var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
  12619. var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  12620. var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
  12621. var url = this.attributes.url;
  12622. if (!url) {
  12623. throw new Error('Invalid url.');
  12624. }
  12625. if (!width || !height || width <= 0 || height <= 0) {
  12626. throw new Error('Invalid width or height value.');
  12627. }
  12628. if (quality <= 0 || quality > 100) {
  12629. throw new Error('Invalid quality value.');
  12630. }
  12631. var mode = scaleToFit ? 2 : 1;
  12632. return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
  12633. },
  12634. /**
  12635. * Returns the file's size.
  12636. * @return {Number} The file's size in bytes.
  12637. **/
  12638. size: function size() {
  12639. return this.metaData().size;
  12640. },
  12641. /**
  12642. * Returns the file's owner.
  12643. * @return {String} The file's owner id.
  12644. */
  12645. ownerId: function ownerId() {
  12646. return this.metaData().owner;
  12647. },
  12648. /**
  12649. * Destroy the file.
  12650. * @param {AuthOptions} options
  12651. * @return {Promise} A promise that is fulfilled when the destroy
  12652. * completes.
  12653. */
  12654. destroy: function destroy(options) {
  12655. if (!this.id) {
  12656. return _promise.default.reject(new Error('The file id does not eixst.'));
  12657. }
  12658. var request = AVRequest('files', null, this.id, 'DELETE', null, options);
  12659. return request;
  12660. },
  12661. /**
  12662. * Request Qiniu upload token
  12663. * @param {string} type
  12664. * @return {Promise} Resolved with the response
  12665. * @private
  12666. */
  12667. _fileToken: function _fileToken(type, authOptions) {
  12668. var name = this.attributes.name;
  12669. var extName = extname(name);
  12670. if (!extName && this._extName) {
  12671. name += this._extName;
  12672. extName = this._extName;
  12673. }
  12674. var data = {
  12675. name: name,
  12676. keep_file_name: authOptions.keepFileName,
  12677. key: authOptions.key,
  12678. ACL: this._acl,
  12679. mime_type: type,
  12680. metaData: this.attributes.metaData
  12681. };
  12682. return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
  12683. },
  12684. /**
  12685. * @callback UploadProgressCallback
  12686. * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
  12687. */
  12688. /**
  12689. * Saves the file to the AV cloud.
  12690. * @param {AuthOptions} [options] AuthOptions plus:
  12691. * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
  12692. * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
  12693. * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
  12694. * @return {Promise} Promise that is resolved when the save finishes.
  12695. */
  12696. save: function save() {
  12697. var _this3 = this;
  12698. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  12699. if (this.id) {
  12700. throw new Error('File is already saved.');
  12701. }
  12702. if (!this._previousSave) {
  12703. if (this._data) {
  12704. var mimeType = this.get('mime_type');
  12705. this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
  12706. if (uploadInfo.mime_type) {
  12707. mimeType = uploadInfo.mime_type;
  12708. _this3.set('mime_type', mimeType);
  12709. }
  12710. _this3._token = uploadInfo.token;
  12711. return _promise.default.resolve().then(function () {
  12712. var data = _this3._data;
  12713. if (data && data.base64) {
  12714. return parseBase64(data.base64, mimeType);
  12715. }
  12716. if (data && data.blob) {
  12717. if (!data.blob.type && mimeType) {
  12718. data.blob.type = mimeType;
  12719. }
  12720. if (!data.blob.name) {
  12721. data.blob.name = _this3.get('name');
  12722. }
  12723. return data.blob;
  12724. }
  12725. if (typeof Blob !== 'undefined' && data instanceof Blob) {
  12726. return data;
  12727. }
  12728. throw new TypeError('malformed file data');
  12729. }).then(function (data) {
  12730. var _options = _.extend({}, options); // filter out download progress events
  12731. if (options.onprogress) {
  12732. _options.onprogress = function (event) {
  12733. if (event.direction === 'download') return;
  12734. return options.onprogress(event);
  12735. };
  12736. }
  12737. switch (uploadInfo.provider) {
  12738. case 's3':
  12739. return s3(uploadInfo, data, _this3, _options);
  12740. case 'qcloud':
  12741. return cos(uploadInfo, data, _this3, _options);
  12742. case 'qiniu':
  12743. default:
  12744. return qiniu(uploadInfo, data, _this3, _options);
  12745. }
  12746. }).then(tap(function () {
  12747. return _this3._callback(true);
  12748. }), function (error) {
  12749. _this3._callback(false);
  12750. throw error;
  12751. });
  12752. });
  12753. } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
  12754. // external link file.
  12755. var data = {
  12756. name: this.attributes.name,
  12757. ACL: this._acl,
  12758. metaData: this.attributes.metaData,
  12759. mime_type: this.mimeType,
  12760. url: this.attributes.url
  12761. };
  12762. this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
  12763. _this3.id = response.objectId;
  12764. return _this3;
  12765. });
  12766. }
  12767. }
  12768. return this._previousSave;
  12769. },
  12770. _callback: function _callback(success) {
  12771. AVRequest('fileCallback', null, null, 'post', {
  12772. token: this._token,
  12773. result: success
  12774. }).catch(debug);
  12775. delete this._token;
  12776. delete this._data;
  12777. },
  12778. /**
  12779. * fetch the file from server. If the server's representation of the
  12780. * model differs from its current attributes, they will be overriden,
  12781. * @param {Object} fetchOptions Optional options to set 'keys',
  12782. * 'include' and 'includeACL' option.
  12783. * @param {AuthOptions} options
  12784. * @return {Promise} A promise that is fulfilled when the fetch
  12785. * completes.
  12786. */
  12787. fetch: function fetch(fetchOptions, options) {
  12788. if (!this.id) {
  12789. throw new Error('Cannot fetch unsaved file');
  12790. }
  12791. var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
  12792. return request.then(this._finishFetch.bind(this));
  12793. },
  12794. _finishFetch: function _finishFetch(response) {
  12795. var value = AV.Object.prototype.parse(response);
  12796. value.attributes = {
  12797. name: value.name,
  12798. url: value.url,
  12799. mime_type: value.mime_type,
  12800. bucket: value.bucket
  12801. };
  12802. value.attributes.metaData = value.metaData || {};
  12803. value.id = value.objectId; // clean
  12804. delete value.objectId;
  12805. delete value.metaData;
  12806. delete value.url;
  12807. delete value.name;
  12808. delete value.mime_type;
  12809. delete value.bucket;
  12810. _.extend(this, value);
  12811. return this;
  12812. },
  12813. /**
  12814. * Request file censor
  12815. * @since 4.13.0
  12816. * @return {Promise.<string>}
  12817. */
  12818. censor: function censor() {
  12819. if (!this.id) {
  12820. throw new Error('Cannot censor an unsaved file');
  12821. }
  12822. return AV.File.censor(this.id);
  12823. }
  12824. });
  12825. };
  12826. /***/ }),
  12827. /* 478 */
  12828. /***/ (function(module, exports, __webpack_require__) {
  12829. "use strict";
  12830. var _require = __webpack_require__(72),
  12831. getAdapter = _require.getAdapter;
  12832. var debug = __webpack_require__(60)('cos');
  12833. module.exports = function (uploadInfo, data, file) {
  12834. var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  12835. var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
  12836. var fileFormData = {
  12837. field: 'fileContent',
  12838. data: data,
  12839. name: file.attributes.name
  12840. };
  12841. var options = {
  12842. headers: file._uploadHeaders,
  12843. data: {
  12844. op: 'upload'
  12845. },
  12846. onprogress: saveOptions.onprogress
  12847. };
  12848. debug('url: %s, file: %o, options: %o', url, fileFormData, options);
  12849. var upload = getAdapter('upload');
  12850. return upload(url, fileFormData, options).then(function (response) {
  12851. debug(response.status, response.data);
  12852. if (response.ok === false) {
  12853. var error = new Error(response.status);
  12854. error.response = response;
  12855. throw error;
  12856. }
  12857. file.attributes.url = uploadInfo.url;
  12858. file._bucket = uploadInfo.bucket;
  12859. file.id = uploadInfo.objectId;
  12860. return file;
  12861. }, function (error) {
  12862. var response = error.response;
  12863. if (response) {
  12864. debug(response.status, response.data);
  12865. error.statusCode = response.status;
  12866. error.response = response.data;
  12867. }
  12868. throw error;
  12869. });
  12870. };
  12871. /***/ }),
  12872. /* 479 */
  12873. /***/ (function(module, exports, __webpack_require__) {
  12874. "use strict";
  12875. var _sliceInstanceProperty2 = __webpack_require__(61);
  12876. var _Array$from = __webpack_require__(252);
  12877. var _Symbol = __webpack_require__(149);
  12878. var _getIteratorMethod = __webpack_require__(254);
  12879. var _Reflect$construct = __webpack_require__(489);
  12880. var _interopRequireDefault = __webpack_require__(1);
  12881. var _inherits2 = _interopRequireDefault(__webpack_require__(493));
  12882. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(515));
  12883. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(517));
  12884. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(522));
  12885. var _createClass2 = _interopRequireDefault(__webpack_require__(523));
  12886. var _stringify = _interopRequireDefault(__webpack_require__(36));
  12887. var _concat = _interopRequireDefault(__webpack_require__(22));
  12888. var _promise = _interopRequireDefault(__webpack_require__(12));
  12889. var _slice = _interopRequireDefault(__webpack_require__(61));
  12890. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
  12891. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  12892. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
  12893. function _unsupportedIterableToArray(o, minLen) { var _context8; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context8 = Object.prototype.toString.call(o)).call(_context8, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  12894. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  12895. var _require = __webpack_require__(72),
  12896. getAdapter = _require.getAdapter;
  12897. var debug = __webpack_require__(60)('leancloud:qiniu');
  12898. var ajax = __webpack_require__(116);
  12899. var btoa = __webpack_require__(524);
  12900. var SHARD_THRESHOLD = 1024 * 1024 * 64;
  12901. var CHUNK_SIZE = 1024 * 1024 * 16;
  12902. function upload(uploadInfo, data, file) {
  12903. var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  12904. // Get the uptoken to upload files to qiniu.
  12905. var uptoken = uploadInfo.token;
  12906. var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
  12907. var fileFormData = {
  12908. field: 'file',
  12909. data: data,
  12910. name: file.attributes.name
  12911. };
  12912. var options = {
  12913. headers: file._uploadHeaders,
  12914. data: {
  12915. name: file.attributes.name,
  12916. key: uploadInfo.key,
  12917. token: uptoken
  12918. },
  12919. onprogress: saveOptions.onprogress
  12920. };
  12921. debug('url: %s, file: %o, options: %o', url, fileFormData, options);
  12922. var upload = getAdapter('upload');
  12923. return upload(url, fileFormData, options).then(function (response) {
  12924. debug(response.status, response.data);
  12925. if (response.ok === false) {
  12926. var message = response.status;
  12927. if (response.data) {
  12928. if (response.data.error) {
  12929. message = response.data.error;
  12930. } else {
  12931. message = (0, _stringify.default)(response.data);
  12932. }
  12933. }
  12934. var error = new Error(message);
  12935. error.response = response;
  12936. throw error;
  12937. }
  12938. file.attributes.url = uploadInfo.url;
  12939. file._bucket = uploadInfo.bucket;
  12940. file.id = uploadInfo.objectId;
  12941. return file;
  12942. }, function (error) {
  12943. var response = error.response;
  12944. if (response) {
  12945. debug(response.status, response.data);
  12946. error.statusCode = response.status;
  12947. error.response = response.data;
  12948. }
  12949. throw error;
  12950. });
  12951. }
  12952. function urlSafeBase64(string) {
  12953. var base64 = btoa(unescape(encodeURIComponent(string)));
  12954. var result = '';
  12955. var _iterator = _createForOfIteratorHelper(base64),
  12956. _step;
  12957. try {
  12958. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  12959. var ch = _step.value;
  12960. switch (ch) {
  12961. case '+':
  12962. result += '-';
  12963. break;
  12964. case '/':
  12965. result += '_';
  12966. break;
  12967. default:
  12968. result += ch;
  12969. }
  12970. }
  12971. } catch (err) {
  12972. _iterator.e(err);
  12973. } finally {
  12974. _iterator.f();
  12975. }
  12976. return result;
  12977. }
  12978. var ShardUploader = /*#__PURE__*/function () {
  12979. function ShardUploader(uploadInfo, data, file, saveOptions) {
  12980. var _context,
  12981. _context2,
  12982. _this = this;
  12983. (0, _classCallCheck2.default)(this, ShardUploader);
  12984. this.uploadInfo = uploadInfo;
  12985. this.data = data;
  12986. this.file = file;
  12987. this.size = undefined;
  12988. this.offset = 0;
  12989. this.uploadedChunks = 0;
  12990. var key = urlSafeBase64(uploadInfo.key);
  12991. var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
  12992. this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
  12993. this.upToken = 'UpToken ' + uploadInfo.token;
  12994. this.uploaded = 0;
  12995. if (saveOptions && saveOptions.onprogress) {
  12996. this.onProgress = function (_ref) {
  12997. var loaded = _ref.loaded;
  12998. loaded += _this.uploadedChunks * CHUNK_SIZE;
  12999. if (loaded <= _this.uploaded) {
  13000. return;
  13001. }
  13002. if (_this.size) {
  13003. saveOptions.onprogress({
  13004. loaded: loaded,
  13005. total: _this.size,
  13006. percent: loaded / _this.size * 100
  13007. });
  13008. } else {
  13009. saveOptions.onprogress({
  13010. loaded: loaded
  13011. });
  13012. }
  13013. _this.uploaded = loaded;
  13014. };
  13015. }
  13016. }
  13017. /**
  13018. * @returns {Promise<string>}
  13019. */
  13020. (0, _createClass2.default)(ShardUploader, [{
  13021. key: "getUploadId",
  13022. value: function getUploadId() {
  13023. return ajax({
  13024. method: 'POST',
  13025. url: this.baseURL,
  13026. headers: {
  13027. Authorization: this.upToken
  13028. }
  13029. }).then(function (res) {
  13030. return res.uploadId;
  13031. });
  13032. }
  13033. }, {
  13034. key: "getChunk",
  13035. value: function getChunk() {
  13036. throw new Error('Not implemented');
  13037. }
  13038. /**
  13039. * @param {string} uploadId
  13040. * @param {number} partNumber
  13041. * @param {any} data
  13042. * @returns {Promise<{ partNumber: number, etag: string }>}
  13043. */
  13044. }, {
  13045. key: "uploadPart",
  13046. value: function uploadPart(uploadId, partNumber, data) {
  13047. var _context3, _context4;
  13048. return ajax({
  13049. method: 'PUT',
  13050. url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
  13051. headers: {
  13052. Authorization: this.upToken
  13053. },
  13054. data: data,
  13055. onprogress: this.onProgress
  13056. }).then(function (_ref2) {
  13057. var etag = _ref2.etag;
  13058. return {
  13059. partNumber: partNumber,
  13060. etag: etag
  13061. };
  13062. });
  13063. }
  13064. }, {
  13065. key: "stopUpload",
  13066. value: function stopUpload(uploadId) {
  13067. var _context5;
  13068. return ajax({
  13069. method: 'DELETE',
  13070. url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
  13071. headers: {
  13072. Authorization: this.upToken
  13073. }
  13074. });
  13075. }
  13076. }, {
  13077. key: "upload",
  13078. value: function upload() {
  13079. var _this2 = this;
  13080. var parts = [];
  13081. return this.getUploadId().then(function (uploadId) {
  13082. var uploadPart = function uploadPart() {
  13083. return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
  13084. if (!chunk) {
  13085. return;
  13086. }
  13087. var partNumber = parts.length + 1;
  13088. return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
  13089. parts.push(part);
  13090. _this2.uploadedChunks++;
  13091. return uploadPart();
  13092. });
  13093. }).catch(function (error) {
  13094. return _this2.stopUpload(uploadId).then(function () {
  13095. return _promise.default.reject(error);
  13096. });
  13097. });
  13098. };
  13099. return uploadPart().then(function () {
  13100. var _context6;
  13101. return ajax({
  13102. method: 'POST',
  13103. url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
  13104. headers: {
  13105. Authorization: _this2.upToken
  13106. },
  13107. data: {
  13108. parts: parts,
  13109. fname: _this2.file.attributes.name,
  13110. mimeType: _this2.file.attributes.mime_type
  13111. }
  13112. });
  13113. });
  13114. }).then(function () {
  13115. _this2.file.attributes.url = _this2.uploadInfo.url;
  13116. _this2.file._bucket = _this2.uploadInfo.bucket;
  13117. _this2.file.id = _this2.uploadInfo.objectId;
  13118. return _this2.file;
  13119. });
  13120. }
  13121. }]);
  13122. return ShardUploader;
  13123. }();
  13124. var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
  13125. (0, _inherits2.default)(BlobUploader, _ShardUploader);
  13126. var _super = _createSuper(BlobUploader);
  13127. function BlobUploader(uploadInfo, data, file, saveOptions) {
  13128. var _this3;
  13129. (0, _classCallCheck2.default)(this, BlobUploader);
  13130. _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
  13131. _this3.size = data.size;
  13132. return _this3;
  13133. }
  13134. /**
  13135. * @returns {Blob | null}
  13136. */
  13137. (0, _createClass2.default)(BlobUploader, [{
  13138. key: "getChunk",
  13139. value: function getChunk() {
  13140. var _context7;
  13141. if (this.offset >= this.size) {
  13142. return null;
  13143. }
  13144. var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
  13145. this.offset += chunk.size;
  13146. return chunk;
  13147. }
  13148. }]);
  13149. return BlobUploader;
  13150. }(ShardUploader);
  13151. function isBlob(data) {
  13152. return typeof Blob !== 'undefined' && data instanceof Blob;
  13153. }
  13154. module.exports = function (uploadInfo, data, file) {
  13155. var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  13156. if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
  13157. return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
  13158. }
  13159. return upload(uploadInfo, data, file, saveOptions);
  13160. };
  13161. /***/ }),
  13162. /* 480 */
  13163. /***/ (function(module, exports, __webpack_require__) {
  13164. __webpack_require__(55);
  13165. __webpack_require__(481);
  13166. var path = __webpack_require__(5);
  13167. module.exports = path.Array.from;
  13168. /***/ }),
  13169. /* 481 */
  13170. /***/ (function(module, exports, __webpack_require__) {
  13171. var $ = __webpack_require__(0);
  13172. var from = __webpack_require__(482);
  13173. var checkCorrectnessOfIteration = __webpack_require__(178);
  13174. var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
  13175. // eslint-disable-next-line es-x/no-array-from -- required for testing
  13176. Array.from(iterable);
  13177. });
  13178. // `Array.from` method
  13179. // https://tc39.es/ecma262/#sec-array.from
  13180. $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
  13181. from: from
  13182. });
  13183. /***/ }),
  13184. /* 482 */
  13185. /***/ (function(module, exports, __webpack_require__) {
  13186. "use strict";
  13187. var bind = __webpack_require__(48);
  13188. var call = __webpack_require__(15);
  13189. var toObject = __webpack_require__(34);
  13190. var callWithSafeIterationClosing = __webpack_require__(483);
  13191. var isArrayIteratorMethod = __webpack_require__(166);
  13192. var isConstructor = __webpack_require__(109);
  13193. var lengthOfArrayLike = __webpack_require__(41);
  13194. var createProperty = __webpack_require__(91);
  13195. var getIterator = __webpack_require__(167);
  13196. var getIteratorMethod = __webpack_require__(106);
  13197. var $Array = Array;
  13198. // `Array.from` method implementation
  13199. // https://tc39.es/ecma262/#sec-array.from
  13200. module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  13201. var O = toObject(arrayLike);
  13202. var IS_CONSTRUCTOR = isConstructor(this);
  13203. var argumentsLength = arguments.length;
  13204. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  13205. var mapping = mapfn !== undefined;
  13206. if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
  13207. var iteratorMethod = getIteratorMethod(O);
  13208. var index = 0;
  13209. var length, result, step, iterator, next, value;
  13210. // if the target is not iterable or it's an array with the default iterator - use a simple case
  13211. if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
  13212. iterator = getIterator(O, iteratorMethod);
  13213. next = iterator.next;
  13214. result = IS_CONSTRUCTOR ? new this() : [];
  13215. for (;!(step = call(next, iterator)).done; index++) {
  13216. value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
  13217. createProperty(result, index, value);
  13218. }
  13219. } else {
  13220. length = lengthOfArrayLike(O);
  13221. result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
  13222. for (;length > index; index++) {
  13223. value = mapping ? mapfn(O[index], index) : O[index];
  13224. createProperty(result, index, value);
  13225. }
  13226. }
  13227. result.length = index;
  13228. return result;
  13229. };
  13230. /***/ }),
  13231. /* 483 */
  13232. /***/ (function(module, exports, __webpack_require__) {
  13233. var anObject = __webpack_require__(20);
  13234. var iteratorClose = __webpack_require__(168);
  13235. // call something on iterator step with safe closing on error
  13236. module.exports = function (iterator, fn, value, ENTRIES) {
  13237. try {
  13238. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  13239. } catch (error) {
  13240. iteratorClose(iterator, 'throw', error);
  13241. }
  13242. };
  13243. /***/ }),
  13244. /* 484 */
  13245. /***/ (function(module, exports, __webpack_require__) {
  13246. module.exports = __webpack_require__(485);
  13247. /***/ }),
  13248. /* 485 */
  13249. /***/ (function(module, exports, __webpack_require__) {
  13250. var parent = __webpack_require__(486);
  13251. module.exports = parent;
  13252. /***/ }),
  13253. /* 486 */
  13254. /***/ (function(module, exports, __webpack_require__) {
  13255. var parent = __webpack_require__(487);
  13256. module.exports = parent;
  13257. /***/ }),
  13258. /* 487 */
  13259. /***/ (function(module, exports, __webpack_require__) {
  13260. var parent = __webpack_require__(488);
  13261. __webpack_require__(39);
  13262. module.exports = parent;
  13263. /***/ }),
  13264. /* 488 */
  13265. /***/ (function(module, exports, __webpack_require__) {
  13266. __webpack_require__(38);
  13267. __webpack_require__(55);
  13268. var getIteratorMethod = __webpack_require__(106);
  13269. module.exports = getIteratorMethod;
  13270. /***/ }),
  13271. /* 489 */
  13272. /***/ (function(module, exports, __webpack_require__) {
  13273. module.exports = __webpack_require__(490);
  13274. /***/ }),
  13275. /* 490 */
  13276. /***/ (function(module, exports, __webpack_require__) {
  13277. var parent = __webpack_require__(491);
  13278. module.exports = parent;
  13279. /***/ }),
  13280. /* 491 */
  13281. /***/ (function(module, exports, __webpack_require__) {
  13282. __webpack_require__(492);
  13283. var path = __webpack_require__(5);
  13284. module.exports = path.Reflect.construct;
  13285. /***/ }),
  13286. /* 492 */
  13287. /***/ (function(module, exports, __webpack_require__) {
  13288. var $ = __webpack_require__(0);
  13289. var getBuiltIn = __webpack_require__(18);
  13290. var apply = __webpack_require__(75);
  13291. var bind = __webpack_require__(255);
  13292. var aConstructor = __webpack_require__(174);
  13293. var anObject = __webpack_require__(20);
  13294. var isObject = __webpack_require__(11);
  13295. var create = __webpack_require__(49);
  13296. var fails = __webpack_require__(2);
  13297. var nativeConstruct = getBuiltIn('Reflect', 'construct');
  13298. var ObjectPrototype = Object.prototype;
  13299. var push = [].push;
  13300. // `Reflect.construct` method
  13301. // https://tc39.es/ecma262/#sec-reflect.construct
  13302. // MS Edge supports only 2 arguments and argumentsList argument is optional
  13303. // FF Nightly sets third argument as `new.target`, but does not create `this` from it
  13304. var NEW_TARGET_BUG = fails(function () {
  13305. function F() { /* empty */ }
  13306. return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
  13307. });
  13308. var ARGS_BUG = !fails(function () {
  13309. nativeConstruct(function () { /* empty */ });
  13310. });
  13311. var FORCED = NEW_TARGET_BUG || ARGS_BUG;
  13312. $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
  13313. construct: function construct(Target, args /* , newTarget */) {
  13314. aConstructor(Target);
  13315. anObject(args);
  13316. var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
  13317. if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
  13318. if (Target == newTarget) {
  13319. // w/o altered newTarget, optimization for 0-4 arguments
  13320. switch (args.length) {
  13321. case 0: return new Target();
  13322. case 1: return new Target(args[0]);
  13323. case 2: return new Target(args[0], args[1]);
  13324. case 3: return new Target(args[0], args[1], args[2]);
  13325. case 4: return new Target(args[0], args[1], args[2], args[3]);
  13326. }
  13327. // w/o altered newTarget, lot of arguments case
  13328. var $args = [null];
  13329. apply(push, $args, args);
  13330. return new (apply(bind, Target, $args))();
  13331. }
  13332. // with altered newTarget, not support built-in constructors
  13333. var proto = newTarget.prototype;
  13334. var instance = create(isObject(proto) ? proto : ObjectPrototype);
  13335. var result = apply(Target, instance, args);
  13336. return isObject(result) ? result : instance;
  13337. }
  13338. });
  13339. /***/ }),
  13340. /* 493 */
  13341. /***/ (function(module, exports, __webpack_require__) {
  13342. var _Object$create = __webpack_require__(494);
  13343. var _Object$defineProperty = __webpack_require__(150);
  13344. var setPrototypeOf = __webpack_require__(504);
  13345. function _inherits(subClass, superClass) {
  13346. if (typeof superClass !== "function" && superClass !== null) {
  13347. throw new TypeError("Super expression must either be null or a function");
  13348. }
  13349. subClass.prototype = _Object$create(superClass && superClass.prototype, {
  13350. constructor: {
  13351. value: subClass,
  13352. writable: true,
  13353. configurable: true
  13354. }
  13355. });
  13356. _Object$defineProperty(subClass, "prototype", {
  13357. writable: false
  13358. });
  13359. if (superClass) setPrototypeOf(subClass, superClass);
  13360. }
  13361. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13362. /***/ }),
  13363. /* 494 */
  13364. /***/ (function(module, exports, __webpack_require__) {
  13365. module.exports = __webpack_require__(495);
  13366. /***/ }),
  13367. /* 495 */
  13368. /***/ (function(module, exports, __webpack_require__) {
  13369. module.exports = __webpack_require__(496);
  13370. /***/ }),
  13371. /* 496 */
  13372. /***/ (function(module, exports, __webpack_require__) {
  13373. var parent = __webpack_require__(497);
  13374. module.exports = parent;
  13375. /***/ }),
  13376. /* 497 */
  13377. /***/ (function(module, exports, __webpack_require__) {
  13378. var parent = __webpack_require__(498);
  13379. module.exports = parent;
  13380. /***/ }),
  13381. /* 498 */
  13382. /***/ (function(module, exports, __webpack_require__) {
  13383. var parent = __webpack_require__(499);
  13384. module.exports = parent;
  13385. /***/ }),
  13386. /* 499 */
  13387. /***/ (function(module, exports, __webpack_require__) {
  13388. __webpack_require__(500);
  13389. var path = __webpack_require__(5);
  13390. var Object = path.Object;
  13391. module.exports = function create(P, D) {
  13392. return Object.create(P, D);
  13393. };
  13394. /***/ }),
  13395. /* 500 */
  13396. /***/ (function(module, exports, __webpack_require__) {
  13397. // TODO: Remove from `core-js@4`
  13398. var $ = __webpack_require__(0);
  13399. var DESCRIPTORS = __webpack_require__(14);
  13400. var create = __webpack_require__(49);
  13401. // `Object.create` method
  13402. // https://tc39.es/ecma262/#sec-object.create
  13403. $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
  13404. create: create
  13405. });
  13406. /***/ }),
  13407. /* 501 */
  13408. /***/ (function(module, exports, __webpack_require__) {
  13409. module.exports = __webpack_require__(502);
  13410. /***/ }),
  13411. /* 502 */
  13412. /***/ (function(module, exports, __webpack_require__) {
  13413. var parent = __webpack_require__(503);
  13414. module.exports = parent;
  13415. /***/ }),
  13416. /* 503 */
  13417. /***/ (function(module, exports, __webpack_require__) {
  13418. var parent = __webpack_require__(241);
  13419. module.exports = parent;
  13420. /***/ }),
  13421. /* 504 */
  13422. /***/ (function(module, exports, __webpack_require__) {
  13423. var _Object$setPrototypeOf = __webpack_require__(256);
  13424. var _bindInstanceProperty = __webpack_require__(257);
  13425. function _setPrototypeOf(o, p) {
  13426. var _context;
  13427. module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
  13428. o.__proto__ = p;
  13429. return o;
  13430. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13431. return _setPrototypeOf(o, p);
  13432. }
  13433. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13434. /***/ }),
  13435. /* 505 */
  13436. /***/ (function(module, exports, __webpack_require__) {
  13437. module.exports = __webpack_require__(506);
  13438. /***/ }),
  13439. /* 506 */
  13440. /***/ (function(module, exports, __webpack_require__) {
  13441. var parent = __webpack_require__(507);
  13442. module.exports = parent;
  13443. /***/ }),
  13444. /* 507 */
  13445. /***/ (function(module, exports, __webpack_require__) {
  13446. var parent = __webpack_require__(239);
  13447. module.exports = parent;
  13448. /***/ }),
  13449. /* 508 */
  13450. /***/ (function(module, exports, __webpack_require__) {
  13451. module.exports = __webpack_require__(509);
  13452. /***/ }),
  13453. /* 509 */
  13454. /***/ (function(module, exports, __webpack_require__) {
  13455. var parent = __webpack_require__(510);
  13456. module.exports = parent;
  13457. /***/ }),
  13458. /* 510 */
  13459. /***/ (function(module, exports, __webpack_require__) {
  13460. var parent = __webpack_require__(511);
  13461. module.exports = parent;
  13462. /***/ }),
  13463. /* 511 */
  13464. /***/ (function(module, exports, __webpack_require__) {
  13465. var parent = __webpack_require__(512);
  13466. module.exports = parent;
  13467. /***/ }),
  13468. /* 512 */
  13469. /***/ (function(module, exports, __webpack_require__) {
  13470. var isPrototypeOf = __webpack_require__(19);
  13471. var method = __webpack_require__(513);
  13472. var FunctionPrototype = Function.prototype;
  13473. module.exports = function (it) {
  13474. var own = it.bind;
  13475. return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
  13476. };
  13477. /***/ }),
  13478. /* 513 */
  13479. /***/ (function(module, exports, __webpack_require__) {
  13480. __webpack_require__(514);
  13481. var entryVirtual = __webpack_require__(40);
  13482. module.exports = entryVirtual('Function').bind;
  13483. /***/ }),
  13484. /* 514 */
  13485. /***/ (function(module, exports, __webpack_require__) {
  13486. // TODO: Remove from `core-js@4`
  13487. var $ = __webpack_require__(0);
  13488. var bind = __webpack_require__(255);
  13489. // `Function.prototype.bind` method
  13490. // https://tc39.es/ecma262/#sec-function.prototype.bind
  13491. $({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
  13492. bind: bind
  13493. });
  13494. /***/ }),
  13495. /* 515 */
  13496. /***/ (function(module, exports, __webpack_require__) {
  13497. var _typeof = __webpack_require__(73)["default"];
  13498. var assertThisInitialized = __webpack_require__(516);
  13499. function _possibleConstructorReturn(self, call) {
  13500. if (call && (_typeof(call) === "object" || typeof call === "function")) {
  13501. return call;
  13502. } else if (call !== void 0) {
  13503. throw new TypeError("Derived constructors may only return object or undefined");
  13504. }
  13505. return assertThisInitialized(self);
  13506. }
  13507. module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13508. /***/ }),
  13509. /* 516 */
  13510. /***/ (function(module, exports) {
  13511. function _assertThisInitialized(self) {
  13512. if (self === void 0) {
  13513. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  13514. }
  13515. return self;
  13516. }
  13517. module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13518. /***/ }),
  13519. /* 517 */
  13520. /***/ (function(module, exports, __webpack_require__) {
  13521. var _Object$setPrototypeOf = __webpack_require__(256);
  13522. var _bindInstanceProperty = __webpack_require__(257);
  13523. var _Object$getPrototypeOf = __webpack_require__(518);
  13524. function _getPrototypeOf(o) {
  13525. var _context;
  13526. module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
  13527. return o.__proto__ || _Object$getPrototypeOf(o);
  13528. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13529. return _getPrototypeOf(o);
  13530. }
  13531. module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13532. /***/ }),
  13533. /* 518 */
  13534. /***/ (function(module, exports, __webpack_require__) {
  13535. module.exports = __webpack_require__(519);
  13536. /***/ }),
  13537. /* 519 */
  13538. /***/ (function(module, exports, __webpack_require__) {
  13539. module.exports = __webpack_require__(520);
  13540. /***/ }),
  13541. /* 520 */
  13542. /***/ (function(module, exports, __webpack_require__) {
  13543. var parent = __webpack_require__(521);
  13544. module.exports = parent;
  13545. /***/ }),
  13546. /* 521 */
  13547. /***/ (function(module, exports, __webpack_require__) {
  13548. var parent = __webpack_require__(233);
  13549. module.exports = parent;
  13550. /***/ }),
  13551. /* 522 */
  13552. /***/ (function(module, exports) {
  13553. function _classCallCheck(instance, Constructor) {
  13554. if (!(instance instanceof Constructor)) {
  13555. throw new TypeError("Cannot call a class as a function");
  13556. }
  13557. }
  13558. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13559. /***/ }),
  13560. /* 523 */
  13561. /***/ (function(module, exports, __webpack_require__) {
  13562. var _Object$defineProperty = __webpack_require__(150);
  13563. function _defineProperties(target, props) {
  13564. for (var i = 0; i < props.length; i++) {
  13565. var descriptor = props[i];
  13566. descriptor.enumerable = descriptor.enumerable || false;
  13567. descriptor.configurable = true;
  13568. if ("value" in descriptor) descriptor.writable = true;
  13569. _Object$defineProperty(target, descriptor.key, descriptor);
  13570. }
  13571. }
  13572. function _createClass(Constructor, protoProps, staticProps) {
  13573. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  13574. if (staticProps) _defineProperties(Constructor, staticProps);
  13575. _Object$defineProperty(Constructor, "prototype", {
  13576. writable: false
  13577. });
  13578. return Constructor;
  13579. }
  13580. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13581. /***/ }),
  13582. /* 524 */
  13583. /***/ (function(module, exports, __webpack_require__) {
  13584. "use strict";
  13585. var _interopRequireDefault = __webpack_require__(1);
  13586. var _slice = _interopRequireDefault(__webpack_require__(61));
  13587. // base64 character set, plus padding character (=)
  13588. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  13589. module.exports = function (string) {
  13590. var result = '';
  13591. for (var i = 0; i < string.length;) {
  13592. var a = string.charCodeAt(i++);
  13593. var b = string.charCodeAt(i++);
  13594. var c = string.charCodeAt(i++);
  13595. if (a > 255 || b > 255 || c > 255) {
  13596. throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
  13597. }
  13598. var bitmap = a << 16 | b << 8 | c;
  13599. result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
  13600. } // To determine the final padding
  13601. var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
  13602. return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
  13603. };
  13604. /***/ }),
  13605. /* 525 */
  13606. /***/ (function(module, exports, __webpack_require__) {
  13607. "use strict";
  13608. var _ = __webpack_require__(3);
  13609. var ajax = __webpack_require__(116);
  13610. module.exports = function upload(uploadInfo, data, file) {
  13611. var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  13612. return ajax({
  13613. url: uploadInfo.upload_url,
  13614. method: 'PUT',
  13615. data: data,
  13616. headers: _.extend({
  13617. 'Content-Type': file.get('mime_type'),
  13618. 'Cache-Control': 'public, max-age=31536000'
  13619. }, file._uploadHeaders),
  13620. onprogress: saveOptions.onprogress
  13621. }).then(function () {
  13622. file.attributes.url = uploadInfo.url;
  13623. file._bucket = uploadInfo.bucket;
  13624. file.id = uploadInfo.objectId;
  13625. return file;
  13626. });
  13627. };
  13628. /***/ }),
  13629. /* 526 */
  13630. /***/ (function(module, exports, __webpack_require__) {
  13631. (function(){
  13632. var crypt = __webpack_require__(527),
  13633. utf8 = __webpack_require__(258).utf8,
  13634. isBuffer = __webpack_require__(528),
  13635. bin = __webpack_require__(258).bin,
  13636. // The core
  13637. md5 = function (message, options) {
  13638. // Convert to byte array
  13639. if (message.constructor == String)
  13640. if (options && options.encoding === 'binary')
  13641. message = bin.stringToBytes(message);
  13642. else
  13643. message = utf8.stringToBytes(message);
  13644. else if (isBuffer(message))
  13645. message = Array.prototype.slice.call(message, 0);
  13646. else if (!Array.isArray(message))
  13647. message = message.toString();
  13648. // else, assume byte array already
  13649. var m = crypt.bytesToWords(message),
  13650. l = message.length * 8,
  13651. a = 1732584193,
  13652. b = -271733879,
  13653. c = -1732584194,
  13654. d = 271733878;
  13655. // Swap endian
  13656. for (var i = 0; i < m.length; i++) {
  13657. m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
  13658. ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
  13659. }
  13660. // Padding
  13661. m[l >>> 5] |= 0x80 << (l % 32);
  13662. m[(((l + 64) >>> 9) << 4) + 14] = l;
  13663. // Method shortcuts
  13664. var FF = md5._ff,
  13665. GG = md5._gg,
  13666. HH = md5._hh,
  13667. II = md5._ii;
  13668. for (var i = 0; i < m.length; i += 16) {
  13669. var aa = a,
  13670. bb = b,
  13671. cc = c,
  13672. dd = d;
  13673. a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
  13674. d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
  13675. c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
  13676. b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
  13677. a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
  13678. d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
  13679. c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
  13680. b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
  13681. a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
  13682. d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
  13683. c = FF(c, d, a, b, m[i+10], 17, -42063);
  13684. b = FF(b, c, d, a, m[i+11], 22, -1990404162);
  13685. a = FF(a, b, c, d, m[i+12], 7, 1804603682);
  13686. d = FF(d, a, b, c, m[i+13], 12, -40341101);
  13687. c = FF(c, d, a, b, m[i+14], 17, -1502002290);
  13688. b = FF(b, c, d, a, m[i+15], 22, 1236535329);
  13689. a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
  13690. d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
  13691. c = GG(c, d, a, b, m[i+11], 14, 643717713);
  13692. b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
  13693. a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
  13694. d = GG(d, a, b, c, m[i+10], 9, 38016083);
  13695. c = GG(c, d, a, b, m[i+15], 14, -660478335);
  13696. b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
  13697. a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
  13698. d = GG(d, a, b, c, m[i+14], 9, -1019803690);
  13699. c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
  13700. b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
  13701. a = GG(a, b, c, d, m[i+13], 5, -1444681467);
  13702. d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
  13703. c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
  13704. b = GG(b, c, d, a, m[i+12], 20, -1926607734);
  13705. a = HH(a, b, c, d, m[i+ 5], 4, -378558);
  13706. d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
  13707. c = HH(c, d, a, b, m[i+11], 16, 1839030562);
  13708. b = HH(b, c, d, a, m[i+14], 23, -35309556);
  13709. a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
  13710. d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
  13711. c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
  13712. b = HH(b, c, d, a, m[i+10], 23, -1094730640);
  13713. a = HH(a, b, c, d, m[i+13], 4, 681279174);
  13714. d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
  13715. c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
  13716. b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
  13717. a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
  13718. d = HH(d, a, b, c, m[i+12], 11, -421815835);
  13719. c = HH(c, d, a, b, m[i+15], 16, 530742520);
  13720. b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
  13721. a = II(a, b, c, d, m[i+ 0], 6, -198630844);
  13722. d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
  13723. c = II(c, d, a, b, m[i+14], 15, -1416354905);
  13724. b = II(b, c, d, a, m[i+ 5], 21, -57434055);
  13725. a = II(a, b, c, d, m[i+12], 6, 1700485571);
  13726. d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
  13727. c = II(c, d, a, b, m[i+10], 15, -1051523);
  13728. b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
  13729. a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
  13730. d = II(d, a, b, c, m[i+15], 10, -30611744);
  13731. c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
  13732. b = II(b, c, d, a, m[i+13], 21, 1309151649);
  13733. a = II(a, b, c, d, m[i+ 4], 6, -145523070);
  13734. d = II(d, a, b, c, m[i+11], 10, -1120210379);
  13735. c = II(c, d, a, b, m[i+ 2], 15, 718787259);
  13736. b = II(b, c, d, a, m[i+ 9], 21, -343485551);
  13737. a = (a + aa) >>> 0;
  13738. b = (b + bb) >>> 0;
  13739. c = (c + cc) >>> 0;
  13740. d = (d + dd) >>> 0;
  13741. }
  13742. return crypt.endian([a, b, c, d]);
  13743. };
  13744. // Auxiliary functions
  13745. md5._ff = function (a, b, c, d, x, s, t) {
  13746. var n = a + (b & c | ~b & d) + (x >>> 0) + t;
  13747. return ((n << s) | (n >>> (32 - s))) + b;
  13748. };
  13749. md5._gg = function (a, b, c, d, x, s, t) {
  13750. var n = a + (b & d | c & ~d) + (x >>> 0) + t;
  13751. return ((n << s) | (n >>> (32 - s))) + b;
  13752. };
  13753. md5._hh = function (a, b, c, d, x, s, t) {
  13754. var n = a + (b ^ c ^ d) + (x >>> 0) + t;
  13755. return ((n << s) | (n >>> (32 - s))) + b;
  13756. };
  13757. md5._ii = function (a, b, c, d, x, s, t) {
  13758. var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
  13759. return ((n << s) | (n >>> (32 - s))) + b;
  13760. };
  13761. // Package private blocksize
  13762. md5._blocksize = 16;
  13763. md5._digestsize = 16;
  13764. module.exports = function (message, options) {
  13765. if (message === undefined || message === null)
  13766. throw new Error('Illegal argument ' + message);
  13767. var digestbytes = crypt.wordsToBytes(md5(message, options));
  13768. return options && options.asBytes ? digestbytes :
  13769. options && options.asString ? bin.bytesToString(digestbytes) :
  13770. crypt.bytesToHex(digestbytes);
  13771. };
  13772. })();
  13773. /***/ }),
  13774. /* 527 */
  13775. /***/ (function(module, exports) {
  13776. (function() {
  13777. var base64map
  13778. = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
  13779. crypt = {
  13780. // Bit-wise rotation left
  13781. rotl: function(n, b) {
  13782. return (n << b) | (n >>> (32 - b));
  13783. },
  13784. // Bit-wise rotation right
  13785. rotr: function(n, b) {
  13786. return (n << (32 - b)) | (n >>> b);
  13787. },
  13788. // Swap big-endian to little-endian and vice versa
  13789. endian: function(n) {
  13790. // If number given, swap endian
  13791. if (n.constructor == Number) {
  13792. return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
  13793. }
  13794. // Else, assume array and swap all items
  13795. for (var i = 0; i < n.length; i++)
  13796. n[i] = crypt.endian(n[i]);
  13797. return n;
  13798. },
  13799. // Generate an array of any length of random bytes
  13800. randomBytes: function(n) {
  13801. for (var bytes = []; n > 0; n--)
  13802. bytes.push(Math.floor(Math.random() * 256));
  13803. return bytes;
  13804. },
  13805. // Convert a byte array to big-endian 32-bit words
  13806. bytesToWords: function(bytes) {
  13807. for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
  13808. words[b >>> 5] |= bytes[i] << (24 - b % 32);
  13809. return words;
  13810. },
  13811. // Convert big-endian 32-bit words to a byte array
  13812. wordsToBytes: function(words) {
  13813. for (var bytes = [], b = 0; b < words.length * 32; b += 8)
  13814. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
  13815. return bytes;
  13816. },
  13817. // Convert a byte array to a hex string
  13818. bytesToHex: function(bytes) {
  13819. for (var hex = [], i = 0; i < bytes.length; i++) {
  13820. hex.push((bytes[i] >>> 4).toString(16));
  13821. hex.push((bytes[i] & 0xF).toString(16));
  13822. }
  13823. return hex.join('');
  13824. },
  13825. // Convert a hex string to a byte array
  13826. hexToBytes: function(hex) {
  13827. for (var bytes = [], c = 0; c < hex.length; c += 2)
  13828. bytes.push(parseInt(hex.substr(c, 2), 16));
  13829. return bytes;
  13830. },
  13831. // Convert a byte array to a base-64 string
  13832. bytesToBase64: function(bytes) {
  13833. for (var base64 = [], i = 0; i < bytes.length; i += 3) {
  13834. var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
  13835. for (var j = 0; j < 4; j++)
  13836. if (i * 8 + j * 6 <= bytes.length * 8)
  13837. base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
  13838. else
  13839. base64.push('=');
  13840. }
  13841. return base64.join('');
  13842. },
  13843. // Convert a base-64 string to a byte array
  13844. base64ToBytes: function(base64) {
  13845. // Remove non-base-64 characters
  13846. base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
  13847. for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
  13848. imod4 = ++i % 4) {
  13849. if (imod4 == 0) continue;
  13850. bytes.push(((base64map.indexOf(base64.charAt(i - 1))
  13851. & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
  13852. | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
  13853. }
  13854. return bytes;
  13855. }
  13856. };
  13857. module.exports = crypt;
  13858. })();
  13859. /***/ }),
  13860. /* 528 */
  13861. /***/ (function(module, exports) {
  13862. /*!
  13863. * Determine if an object is a Buffer
  13864. *
  13865. * @author Feross Aboukhadijeh <https://feross.org>
  13866. * @license MIT
  13867. */
  13868. // The _isBuffer check is for Safari 5-7 support, because it's missing
  13869. // Object.prototype.constructor. Remove this eventually
  13870. module.exports = function (obj) {
  13871. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  13872. }
  13873. function isBuffer (obj) {
  13874. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  13875. }
  13876. // For Node v0.10 support. Remove this eventually.
  13877. function isSlowBuffer (obj) {
  13878. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  13879. }
  13880. /***/ }),
  13881. /* 529 */
  13882. /***/ (function(module, exports, __webpack_require__) {
  13883. "use strict";
  13884. var _interopRequireDefault = __webpack_require__(1);
  13885. var _indexOf = _interopRequireDefault(__webpack_require__(71));
  13886. var dataURItoBlob = function dataURItoBlob(dataURI, type) {
  13887. var _context;
  13888. var byteString; // 传入的 base64,不是 dataURL
  13889. if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
  13890. byteString = atob(dataURI);
  13891. } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
  13892. type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
  13893. byteString = atob(dataURI.split(',')[1]);
  13894. } else {
  13895. byteString = unescape(dataURI.split(',')[1]);
  13896. }
  13897. var ia = new Uint8Array(byteString.length);
  13898. for (var i = 0; i < byteString.length; i++) {
  13899. ia[i] = byteString.charCodeAt(i);
  13900. }
  13901. return new Blob([ia], {
  13902. type: type
  13903. });
  13904. };
  13905. module.exports = dataURItoBlob;
  13906. /***/ }),
  13907. /* 530 */
  13908. /***/ (function(module, exports, __webpack_require__) {
  13909. "use strict";
  13910. var _interopRequireDefault = __webpack_require__(1);
  13911. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(531));
  13912. var _map = _interopRequireDefault(__webpack_require__(35));
  13913. var _indexOf = _interopRequireDefault(__webpack_require__(71));
  13914. var _find = _interopRequireDefault(__webpack_require__(93));
  13915. var _promise = _interopRequireDefault(__webpack_require__(12));
  13916. var _concat = _interopRequireDefault(__webpack_require__(22));
  13917. var _keys2 = _interopRequireDefault(__webpack_require__(59));
  13918. var _stringify = _interopRequireDefault(__webpack_require__(36));
  13919. var _defineProperty = _interopRequireDefault(__webpack_require__(92));
  13920. var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
  13921. var _ = __webpack_require__(3);
  13922. var AVError = __webpack_require__(46);
  13923. var _require = __webpack_require__(27),
  13924. _request = _require._request;
  13925. var _require2 = __webpack_require__(30),
  13926. isNullOrUndefined = _require2.isNullOrUndefined,
  13927. ensureArray = _require2.ensureArray,
  13928. transformFetchOptions = _require2.transformFetchOptions,
  13929. setValue = _require2.setValue,
  13930. findValue = _require2.findValue,
  13931. isPlainObject = _require2.isPlainObject,
  13932. continueWhile = _require2.continueWhile;
  13933. var recursiveToPointer = function recursiveToPointer(value) {
  13934. if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
  13935. if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
  13936. if (_.isObject(value) && value._toPointer) return value._toPointer();
  13937. return value;
  13938. };
  13939. var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
  13940. var checkReservedKey = function checkReservedKey(key) {
  13941. if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
  13942. throw new Error("key[".concat(key, "] is reserved"));
  13943. }
  13944. };
  13945. var handleBatchResults = function handleBatchResults(results) {
  13946. var firstError = (0, _find.default)(_).call(_, results, function (result) {
  13947. return result instanceof Error;
  13948. });
  13949. if (!firstError) {
  13950. return results;
  13951. }
  13952. var error = new AVError(firstError.code, firstError.message);
  13953. error.results = results;
  13954. throw error;
  13955. }; // Helper function to get a value from a Backbone object as a property
  13956. // or as a function.
  13957. function getValue(object, prop) {
  13958. if (!(object && object[prop])) {
  13959. return null;
  13960. }
  13961. return _.isFunction(object[prop]) ? object[prop]() : object[prop];
  13962. } // AV.Object is analogous to the Java AVObject.
  13963. // It also implements the same interface as a Backbone model.
  13964. module.exports = function (AV) {
  13965. /**
  13966. * Creates a new model with defined attributes. A client id (cid) is
  13967. * automatically generated and assigned for you.
  13968. *
  13969. * <p>You won't normally call this method directly. It is recommended that
  13970. * you use a subclass of <code>AV.Object</code> instead, created by calling
  13971. * <code>extend</code>.</p>
  13972. *
  13973. * <p>However, if you don't want to use a subclass, or aren't sure which
  13974. * subclass is appropriate, you can use this form:<pre>
  13975. * var object = new AV.Object("ClassName");
  13976. * </pre>
  13977. * That is basically equivalent to:<pre>
  13978. * var MyClass = AV.Object.extend("ClassName");
  13979. * var object = new MyClass();
  13980. * </pre></p>
  13981. *
  13982. * @param {Object} attributes The initial set of data to store in the object.
  13983. * @param {Object} options A set of Backbone-like options for creating the
  13984. * object. The only option currently supported is "collection".
  13985. * @see AV.Object.extend
  13986. *
  13987. * @class
  13988. *
  13989. * <p>The fundamental unit of AV data, which implements the Backbone Model
  13990. * interface.</p>
  13991. */
  13992. AV.Object = function (attributes, options) {
  13993. // Allow new AV.Object("ClassName") as a shortcut to _create.
  13994. if (_.isString(attributes)) {
  13995. return AV.Object._create.apply(this, arguments);
  13996. }
  13997. attributes = attributes || {};
  13998. if (options && options.parse) {
  13999. attributes = this.parse(attributes);
  14000. attributes = this._mergeMagicFields(attributes);
  14001. }
  14002. var defaults = getValue(this, 'defaults');
  14003. if (defaults) {
  14004. attributes = _.extend({}, defaults, attributes);
  14005. }
  14006. if (options && options.collection) {
  14007. this.collection = options.collection;
  14008. }
  14009. this._serverData = {}; // The last known data for this object from cloud.
  14010. this._opSetQueue = [{}]; // List of sets of changes to the data.
  14011. this._flags = {};
  14012. this.attributes = {}; // The best estimate of this's current data.
  14013. this._hashedJSON = {}; // Hash of values of containers at last save.
  14014. this._escapedAttributes = {};
  14015. this.cid = _.uniqueId('c');
  14016. this.changed = {};
  14017. this._silent = {};
  14018. this._pending = {};
  14019. this.set(attributes, {
  14020. silent: true
  14021. });
  14022. this.changed = {};
  14023. this._silent = {};
  14024. this._pending = {};
  14025. this._hasData = true;
  14026. this._previousAttributes = _.clone(this.attributes);
  14027. this.initialize.apply(this, arguments);
  14028. };
  14029. /**
  14030. * @lends AV.Object.prototype
  14031. * @property {String} id The objectId of the AV Object.
  14032. */
  14033. /**
  14034. * Saves the given list of AV.Object.
  14035. * If any error is encountered, stops and calls the error handler.
  14036. *
  14037. * @example
  14038. * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
  14039. * // All the objects were saved.
  14040. * }, function(error) {
  14041. * // An error occurred while saving one of the objects.
  14042. * });
  14043. *
  14044. * @param {Array} list A list of <code>AV.Object</code>.
  14045. */
  14046. AV.Object.saveAll = function (list, options) {
  14047. return AV.Object._deepSaveAsync(list, null, options);
  14048. };
  14049. /**
  14050. * Fetch the given list of AV.Object.
  14051. *
  14052. * @param {AV.Object[]} objects A list of <code>AV.Object</code>
  14053. * @param {AuthOptions} options
  14054. * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
  14055. */
  14056. AV.Object.fetchAll = function (objects, options) {
  14057. return _promise.default.resolve().then(function () {
  14058. return _request('batch', null, null, 'POST', {
  14059. requests: (0, _map.default)(_).call(_, objects, function (object) {
  14060. var _context;
  14061. if (!object.className) throw new Error('object must have className to fetch');
  14062. if (!object.id) throw new Error('object must have id to fetch');
  14063. if (object.dirty()) throw new Error('object is modified but not saved');
  14064. return {
  14065. method: 'GET',
  14066. path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
  14067. };
  14068. })
  14069. }, options);
  14070. }).then(function (response) {
  14071. var results = (0, _map.default)(_).call(_, objects, function (object, i) {
  14072. if (response[i].success) {
  14073. var fetchedAttrs = object.parse(response[i].success);
  14074. object._cleanupUnsetKeys(fetchedAttrs);
  14075. object._finishFetch(fetchedAttrs);
  14076. return object;
  14077. }
  14078. if (response[i].success === null) {
  14079. return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
  14080. }
  14081. return new AVError(response[i].error.code, response[i].error.error);
  14082. });
  14083. return handleBatchResults(results);
  14084. });
  14085. }; // Attach all inheritable methods to the AV.Object prototype.
  14086. _.extend(AV.Object.prototype, AV.Events,
  14087. /** @lends AV.Object.prototype */
  14088. {
  14089. _fetchWhenSave: false,
  14090. /**
  14091. * Initialize is an empty function by default. Override it with your own
  14092. * initialization logic.
  14093. */
  14094. initialize: function initialize() {},
  14095. /**
  14096. * Set whether to enable fetchWhenSave option when updating object.
  14097. * When set true, SDK would fetch the latest object after saving.
  14098. * Default is false.
  14099. *
  14100. * @deprecated use AV.Object#save with options.fetchWhenSave instead
  14101. * @param {boolean} enable true to enable fetchWhenSave option.
  14102. */
  14103. fetchWhenSave: function fetchWhenSave(enable) {
  14104. console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
  14105. if (!_.isBoolean(enable)) {
  14106. throw new Error('Expect boolean value for fetchWhenSave');
  14107. }
  14108. this._fetchWhenSave = enable;
  14109. },
  14110. /**
  14111. * Returns the object's objectId.
  14112. * @return {String} the objectId.
  14113. */
  14114. getObjectId: function getObjectId() {
  14115. return this.id;
  14116. },
  14117. /**
  14118. * Returns the object's createdAt attribute.
  14119. * @return {Date}
  14120. */
  14121. getCreatedAt: function getCreatedAt() {
  14122. return this.createdAt;
  14123. },
  14124. /**
  14125. * Returns the object's updatedAt attribute.
  14126. * @return {Date}
  14127. */
  14128. getUpdatedAt: function getUpdatedAt() {
  14129. return this.updatedAt;
  14130. },
  14131. /**
  14132. * Returns a JSON version of the object.
  14133. * @return {Object}
  14134. */
  14135. toJSON: function toJSON(key, holder) {
  14136. var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  14137. return this._toFullJSON(seenObjects, false);
  14138. },
  14139. /**
  14140. * Returns a JSON version of the object with meta data.
  14141. * Inverse to {@link AV.parseJSON}
  14142. * @since 3.0.0
  14143. * @return {Object}
  14144. */
  14145. toFullJSON: function toFullJSON() {
  14146. var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  14147. return this._toFullJSON(seenObjects);
  14148. },
  14149. _toFullJSON: function _toFullJSON(seenObjects) {
  14150. var _this = this;
  14151. var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  14152. var json = _.clone(this.attributes);
  14153. if (_.isArray(seenObjects)) {
  14154. var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
  14155. }
  14156. AV._objectEach(json, function (val, key) {
  14157. json[key] = AV._encode(val, newSeenObjects, undefined, full);
  14158. });
  14159. AV._objectEach(this._operations, function (val, key) {
  14160. json[key] = val;
  14161. });
  14162. if (_.has(this, 'id')) {
  14163. json.objectId = this.id;
  14164. }
  14165. ['createdAt', 'updatedAt'].forEach(function (key) {
  14166. if (_.has(_this, key)) {
  14167. var val = _this[key];
  14168. json[key] = _.isDate(val) ? val.toJSON() : val;
  14169. }
  14170. });
  14171. if (full) {
  14172. json.__type = 'Object';
  14173. if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
  14174. json.className = this.className;
  14175. }
  14176. return json;
  14177. },
  14178. /**
  14179. * Updates _hashedJSON to reflect the current state of this object.
  14180. * Adds any changed hash values to the set of pending changes.
  14181. * @private
  14182. */
  14183. _refreshCache: function _refreshCache() {
  14184. var self = this;
  14185. if (self._refreshingCache) {
  14186. return;
  14187. }
  14188. self._refreshingCache = true;
  14189. AV._objectEach(this.attributes, function (value, key) {
  14190. if (value instanceof AV.Object) {
  14191. value._refreshCache();
  14192. } else if (_.isObject(value)) {
  14193. if (self._resetCacheForKey(key)) {
  14194. self.set(key, new AV.Op.Set(value), {
  14195. silent: true
  14196. });
  14197. }
  14198. }
  14199. });
  14200. delete self._refreshingCache;
  14201. },
  14202. /**
  14203. * Returns true if this object has been modified since its last
  14204. * save/refresh. If an attribute is specified, it returns true only if that
  14205. * particular attribute has been modified since the last save/refresh.
  14206. * @param {String} attr An attribute name (optional).
  14207. * @return {Boolean}
  14208. */
  14209. dirty: function dirty(attr) {
  14210. this._refreshCache();
  14211. var currentChanges = _.last(this._opSetQueue);
  14212. if (attr) {
  14213. return currentChanges[attr] ? true : false;
  14214. }
  14215. if (!this.id) {
  14216. return true;
  14217. }
  14218. if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
  14219. return true;
  14220. }
  14221. return false;
  14222. },
  14223. /**
  14224. * Returns the keys of the modified attribute since its last save/refresh.
  14225. * @return {String[]}
  14226. */
  14227. dirtyKeys: function dirtyKeys() {
  14228. this._refreshCache();
  14229. var currentChanges = _.last(this._opSetQueue);
  14230. return (0, _keys2.default)(_).call(_, currentChanges);
  14231. },
  14232. /**
  14233. * Gets a Pointer referencing this Object.
  14234. * @private
  14235. */
  14236. _toPointer: function _toPointer() {
  14237. // if (!this.id) {
  14238. // throw new Error("Can't serialize an unsaved AV.Object");
  14239. // }
  14240. return {
  14241. __type: 'Pointer',
  14242. className: this.className,
  14243. objectId: this.id
  14244. };
  14245. },
  14246. /**
  14247. * Gets the value of an attribute.
  14248. * @param {String} attr The string name of an attribute.
  14249. */
  14250. get: function get(attr) {
  14251. switch (attr) {
  14252. case 'objectId':
  14253. return this.id;
  14254. case 'createdAt':
  14255. case 'updatedAt':
  14256. return this[attr];
  14257. default:
  14258. return this.attributes[attr];
  14259. }
  14260. },
  14261. /**
  14262. * Gets a relation on the given class for the attribute.
  14263. * @param {String} attr The attribute to get the relation for.
  14264. * @return {AV.Relation}
  14265. */
  14266. relation: function relation(attr) {
  14267. var value = this.get(attr);
  14268. if (value) {
  14269. if (!(value instanceof AV.Relation)) {
  14270. throw new Error('Called relation() on non-relation field ' + attr);
  14271. }
  14272. value._ensureParentAndKey(this, attr);
  14273. return value;
  14274. } else {
  14275. return new AV.Relation(this, attr);
  14276. }
  14277. },
  14278. /**
  14279. * Gets the HTML-escaped value of an attribute.
  14280. */
  14281. escape: function escape(attr) {
  14282. var html = this._escapedAttributes[attr];
  14283. if (html) {
  14284. return html;
  14285. }
  14286. var val = this.attributes[attr];
  14287. var escaped;
  14288. if (isNullOrUndefined(val)) {
  14289. escaped = '';
  14290. } else {
  14291. escaped = _.escape(val.toString());
  14292. }
  14293. this._escapedAttributes[attr] = escaped;
  14294. return escaped;
  14295. },
  14296. /**
  14297. * Returns <code>true</code> if the attribute contains a value that is not
  14298. * null or undefined.
  14299. * @param {String} attr The string name of the attribute.
  14300. * @return {Boolean}
  14301. */
  14302. has: function has(attr) {
  14303. return !isNullOrUndefined(this.attributes[attr]);
  14304. },
  14305. /**
  14306. * Pulls "special" fields like objectId, createdAt, etc. out of attrs
  14307. * and puts them on "this" directly. Removes them from attrs.
  14308. * @param attrs - A dictionary with the data for this AV.Object.
  14309. * @private
  14310. */
  14311. _mergeMagicFields: function _mergeMagicFields(attrs) {
  14312. // Check for changes of magic fields.
  14313. var model = this;
  14314. var specialFields = ['objectId', 'createdAt', 'updatedAt'];
  14315. AV._arrayEach(specialFields, function (attr) {
  14316. if (attrs[attr]) {
  14317. if (attr === 'objectId') {
  14318. model.id = attrs[attr];
  14319. } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
  14320. model[attr] = AV._parseDate(attrs[attr]);
  14321. } else {
  14322. model[attr] = attrs[attr];
  14323. }
  14324. delete attrs[attr];
  14325. }
  14326. });
  14327. return attrs;
  14328. },
  14329. /**
  14330. * Returns the json to be sent to the server.
  14331. * @private
  14332. */
  14333. _startSave: function _startSave() {
  14334. this._opSetQueue.push({});
  14335. },
  14336. /**
  14337. * Called when a save fails because of an error. Any changes that were part
  14338. * of the save need to be merged with changes made after the save. This
  14339. * might throw an exception is you do conflicting operations. For example,
  14340. * if you do:
  14341. * object.set("foo", "bar");
  14342. * object.set("invalid field name", "baz");
  14343. * object.save();
  14344. * object.increment("foo");
  14345. * then this will throw when the save fails and the client tries to merge
  14346. * "bar" with the +1.
  14347. * @private
  14348. */
  14349. _cancelSave: function _cancelSave() {
  14350. var failedChanges = _.first(this._opSetQueue);
  14351. this._opSetQueue = _.rest(this._opSetQueue);
  14352. var nextChanges = _.first(this._opSetQueue);
  14353. AV._objectEach(failedChanges, function (op, key) {
  14354. var op1 = failedChanges[key];
  14355. var op2 = nextChanges[key];
  14356. if (op1 && op2) {
  14357. nextChanges[key] = op2._mergeWithPrevious(op1);
  14358. } else if (op1) {
  14359. nextChanges[key] = op1;
  14360. }
  14361. });
  14362. this._saving = this._saving - 1;
  14363. },
  14364. /**
  14365. * Called when a save completes successfully. This merges the changes that
  14366. * were saved into the known server data, and overrides it with any data
  14367. * sent directly from the server.
  14368. * @private
  14369. */
  14370. _finishSave: function _finishSave(serverData) {
  14371. var _context2;
  14372. // Grab a copy of any object referenced by this object. These instances
  14373. // may have already been fetched, and we don't want to lose their data.
  14374. // Note that doing it like this means we will unify separate copies of the
  14375. // same object, but that's a risk we have to take.
  14376. var fetchedObjects = {};
  14377. AV._traverse(this.attributes, function (object) {
  14378. if (object instanceof AV.Object && object.id && object._hasData) {
  14379. fetchedObjects[object.id] = object;
  14380. }
  14381. });
  14382. var savedChanges = _.first(this._opSetQueue);
  14383. this._opSetQueue = _.rest(this._opSetQueue);
  14384. this._applyOpSet(savedChanges, this._serverData);
  14385. this._mergeMagicFields(serverData);
  14386. var self = this;
  14387. AV._objectEach(serverData, function (value, key) {
  14388. self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
  14389. // by replacing their values with the previously observed values.
  14390. var fetched = AV._traverse(self._serverData[key], function (object) {
  14391. if (object instanceof AV.Object && fetchedObjects[object.id]) {
  14392. return fetchedObjects[object.id];
  14393. }
  14394. });
  14395. if (fetched) {
  14396. self._serverData[key] = fetched;
  14397. }
  14398. });
  14399. this._rebuildAllEstimatedData();
  14400. var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
  14401. this._refreshCache();
  14402. this._opSetQueue = opSetQueue;
  14403. this._saving = this._saving - 1;
  14404. },
  14405. /**
  14406. * Called when a fetch or login is complete to set the known server data to
  14407. * the given object.
  14408. * @private
  14409. */
  14410. _finishFetch: function _finishFetch(serverData, hasData) {
  14411. // Clear out any changes the user might have made previously.
  14412. this._opSetQueue = [{}]; // Bring in all the new server data.
  14413. this._mergeMagicFields(serverData);
  14414. var self = this;
  14415. AV._objectEach(serverData, function (value, key) {
  14416. self._serverData[key] = AV._decode(value, key);
  14417. }); // Refresh the attributes.
  14418. this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
  14419. this._refreshCache();
  14420. this._opSetQueue = [{}];
  14421. this._hasData = hasData;
  14422. },
  14423. /**
  14424. * Applies the set of AV.Op in opSet to the object target.
  14425. * @private
  14426. */
  14427. _applyOpSet: function _applyOpSet(opSet, target) {
  14428. var self = this;
  14429. AV._objectEach(opSet, function (change, key) {
  14430. var _findValue = findValue(target, key),
  14431. _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
  14432. value = _findValue2[0],
  14433. actualTarget = _findValue2[1],
  14434. actualKey = _findValue2[2];
  14435. setValue(target, key, change._estimate(value, self, key));
  14436. if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
  14437. delete actualTarget[actualKey];
  14438. }
  14439. });
  14440. },
  14441. /**
  14442. * Replaces the cached value for key with the current value.
  14443. * Returns true if the new value is different than the old value.
  14444. * @private
  14445. */
  14446. _resetCacheForKey: function _resetCacheForKey(key) {
  14447. var value = this.attributes[key];
  14448. if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
  14449. var json = (0, _stringify.default)(recursiveToPointer(value));
  14450. if (this._hashedJSON[key] !== json) {
  14451. var wasSet = !!this._hashedJSON[key];
  14452. this._hashedJSON[key] = json;
  14453. return wasSet;
  14454. }
  14455. }
  14456. return false;
  14457. },
  14458. /**
  14459. * Populates attributes[key] by starting with the last known data from the
  14460. * server, and applying all of the local changes that have been made to that
  14461. * key since then.
  14462. * @private
  14463. */
  14464. _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
  14465. var self = this;
  14466. delete this.attributes[key];
  14467. if (this._serverData[key]) {
  14468. this.attributes[key] = this._serverData[key];
  14469. }
  14470. AV._arrayEach(this._opSetQueue, function (opSet) {
  14471. var op = opSet[key];
  14472. if (op) {
  14473. var _findValue3 = findValue(self.attributes, key),
  14474. _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
  14475. value = _findValue4[0],
  14476. actualTarget = _findValue4[1],
  14477. actualKey = _findValue4[2],
  14478. firstKey = _findValue4[3];
  14479. setValue(self.attributes, key, op._estimate(value, self, key));
  14480. if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
  14481. delete actualTarget[actualKey];
  14482. }
  14483. self._resetCacheForKey(firstKey);
  14484. }
  14485. });
  14486. },
  14487. /**
  14488. * Populates attributes by starting with the last known data from the
  14489. * server, and applying all of the local changes that have been made since
  14490. * then.
  14491. * @private
  14492. */
  14493. _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
  14494. var self = this;
  14495. var previousAttributes = _.clone(this.attributes);
  14496. this.attributes = _.clone(this._serverData);
  14497. AV._arrayEach(this._opSetQueue, function (opSet) {
  14498. self._applyOpSet(opSet, self.attributes);
  14499. AV._objectEach(opSet, function (op, key) {
  14500. self._resetCacheForKey(key);
  14501. });
  14502. }); // Trigger change events for anything that changed because of the fetch.
  14503. AV._objectEach(previousAttributes, function (oldValue, key) {
  14504. if (self.attributes[key] !== oldValue) {
  14505. self.trigger('change:' + key, self, self.attributes[key], {});
  14506. }
  14507. });
  14508. AV._objectEach(this.attributes, function (newValue, key) {
  14509. if (!_.has(previousAttributes, key)) {
  14510. self.trigger('change:' + key, self, newValue, {});
  14511. }
  14512. });
  14513. },
  14514. /**
  14515. * Sets a hash of model attributes on the object, firing
  14516. * <code>"change"</code> unless you choose to silence it.
  14517. *
  14518. * <p>You can call it with an object containing keys and values, or with one
  14519. * key and value. For example:</p>
  14520. *
  14521. * @example
  14522. * gameTurn.set({
  14523. * player: player1,
  14524. * diceRoll: 2
  14525. * });
  14526. *
  14527. * game.set("currentPlayer", player2);
  14528. *
  14529. * game.set("finished", true);
  14530. *
  14531. * @param {String} key The key to set.
  14532. * @param {Any} value The value to give it.
  14533. * @param {Object} [options]
  14534. * @param {Boolean} [options.silent]
  14535. * @return {AV.Object} self if succeeded, throws if the value is not valid.
  14536. * @see AV.Object#validate
  14537. */
  14538. set: function set(key, value, options) {
  14539. var attrs;
  14540. if (_.isObject(key) || isNullOrUndefined(key)) {
  14541. attrs = _.mapObject(key, function (v, k) {
  14542. checkReservedKey(k);
  14543. return AV._decode(v, k);
  14544. });
  14545. options = value;
  14546. } else {
  14547. attrs = {};
  14548. checkReservedKey(key);
  14549. attrs[key] = AV._decode(value, key);
  14550. } // Extract attributes and options.
  14551. options = options || {};
  14552. if (!attrs) {
  14553. return this;
  14554. }
  14555. if (attrs instanceof AV.Object) {
  14556. attrs = attrs.attributes;
  14557. } // If the unset option is used, every attribute should be a Unset.
  14558. if (options.unset) {
  14559. AV._objectEach(attrs, function (unused_value, key) {
  14560. attrs[key] = new AV.Op.Unset();
  14561. });
  14562. } // Apply all the attributes to get the estimated values.
  14563. var dataToValidate = _.clone(attrs);
  14564. var self = this;
  14565. AV._objectEach(dataToValidate, function (value, key) {
  14566. if (value instanceof AV.Op) {
  14567. dataToValidate[key] = value._estimate(self.attributes[key], self, key);
  14568. if (dataToValidate[key] === AV.Op._UNSET) {
  14569. delete dataToValidate[key];
  14570. }
  14571. }
  14572. }); // Run validation.
  14573. this._validate(attrs, options);
  14574. options.changes = {};
  14575. var escaped = this._escapedAttributes; // Update attributes.
  14576. AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
  14577. var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
  14578. // since the location where it was parsed does not have access to
  14579. // this object.
  14580. if (val instanceof AV.Relation) {
  14581. val.parent = self;
  14582. }
  14583. if (!(val instanceof AV.Op)) {
  14584. val = new AV.Op.Set(val);
  14585. } // See if this change will actually have any effect.
  14586. var isRealChange = true;
  14587. if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
  14588. isRealChange = false;
  14589. }
  14590. if (isRealChange) {
  14591. delete escaped[attr];
  14592. if (options.silent) {
  14593. self._silent[attr] = true;
  14594. } else {
  14595. options.changes[attr] = true;
  14596. }
  14597. }
  14598. var currentChanges = _.last(self._opSetQueue);
  14599. currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
  14600. self._rebuildEstimatedDataForKey(attr);
  14601. if (isRealChange) {
  14602. self.changed[attr] = self.attributes[attr];
  14603. if (!options.silent) {
  14604. self._pending[attr] = true;
  14605. }
  14606. } else {
  14607. delete self.changed[attr];
  14608. delete self._pending[attr];
  14609. }
  14610. });
  14611. if (!options.silent) {
  14612. this.change(options);
  14613. }
  14614. return this;
  14615. },
  14616. /**
  14617. * Remove an attribute from the model, firing <code>"change"</code> unless
  14618. * you choose to silence it. This is a noop if the attribute doesn't
  14619. * exist.
  14620. * @param key {String} The key.
  14621. */
  14622. unset: function unset(attr, options) {
  14623. options = options || {};
  14624. options.unset = true;
  14625. return this.set(attr, null, options);
  14626. },
  14627. /**
  14628. * Atomically increments the value of the given attribute the next time the
  14629. * object is saved. If no amount is specified, 1 is used by default.
  14630. *
  14631. * @param key {String} The key.
  14632. * @param amount {Number} The amount to increment by.
  14633. */
  14634. increment: function increment(attr, amount) {
  14635. if (_.isUndefined(amount) || _.isNull(amount)) {
  14636. amount = 1;
  14637. }
  14638. return this.set(attr, new AV.Op.Increment(amount));
  14639. },
  14640. /**
  14641. * Atomically add an object to the end of the array associated with a given
  14642. * key.
  14643. * @param key {String} The key.
  14644. * @param item {} The item to add.
  14645. */
  14646. add: function add(attr, item) {
  14647. return this.set(attr, new AV.Op.Add(ensureArray(item)));
  14648. },
  14649. /**
  14650. * Atomically add an object to the array associated with a given key, only
  14651. * if it is not already present in the array. The position of the insert is
  14652. * not guaranteed.
  14653. *
  14654. * @param key {String} The key.
  14655. * @param item {} The object to add.
  14656. */
  14657. addUnique: function addUnique(attr, item) {
  14658. return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
  14659. },
  14660. /**
  14661. * Atomically remove all instances of an object from the array associated
  14662. * with a given key.
  14663. *
  14664. * @param key {String} The key.
  14665. * @param item {} The object to remove.
  14666. */
  14667. remove: function remove(attr, item) {
  14668. return this.set(attr, new AV.Op.Remove(ensureArray(item)));
  14669. },
  14670. /**
  14671. * Atomically apply a "bit and" operation on the value associated with a
  14672. * given key.
  14673. *
  14674. * @param key {String} The key.
  14675. * @param value {Number} The value to apply.
  14676. */
  14677. bitAnd: function bitAnd(attr, value) {
  14678. return this.set(attr, new AV.Op.BitAnd(value));
  14679. },
  14680. /**
  14681. * Atomically apply a "bit or" operation on the value associated with a
  14682. * given key.
  14683. *
  14684. * @param key {String} The key.
  14685. * @param value {Number} The value to apply.
  14686. */
  14687. bitOr: function bitOr(attr, value) {
  14688. return this.set(attr, new AV.Op.BitOr(value));
  14689. },
  14690. /**
  14691. * Atomically apply a "bit xor" operation on the value associated with a
  14692. * given key.
  14693. *
  14694. * @param key {String} The key.
  14695. * @param value {Number} The value to apply.
  14696. */
  14697. bitXor: function bitXor(attr, value) {
  14698. return this.set(attr, new AV.Op.BitXor(value));
  14699. },
  14700. /**
  14701. * Returns an instance of a subclass of AV.Op describing what kind of
  14702. * modification has been performed on this field since the last time it was
  14703. * saved. For example, after calling object.increment("x"), calling
  14704. * object.op("x") would return an instance of AV.Op.Increment.
  14705. *
  14706. * @param key {String} The key.
  14707. * @returns {AV.Op} The operation, or undefined if none.
  14708. */
  14709. op: function op(attr) {
  14710. return _.last(this._opSetQueue)[attr];
  14711. },
  14712. /**
  14713. * Clear all attributes on the model, firing <code>"change"</code> unless
  14714. * you choose to silence it.
  14715. */
  14716. clear: function clear(options) {
  14717. options = options || {};
  14718. options.unset = true;
  14719. var keysToClear = _.extend(this.attributes, this._operations);
  14720. return this.set(keysToClear, options);
  14721. },
  14722. /**
  14723. * Clears any (or specific) changes to the model made since the last save.
  14724. * @param {string|string[]} [keys] specify keys to revert.
  14725. */
  14726. revert: function revert(keys) {
  14727. var lastOp = _.last(this._opSetQueue);
  14728. var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
  14729. _keys.forEach(function (key) {
  14730. delete lastOp[key];
  14731. });
  14732. this._rebuildAllEstimatedData();
  14733. return this;
  14734. },
  14735. /**
  14736. * Returns a JSON-encoded set of operations to be sent with the next save
  14737. * request.
  14738. * @private
  14739. */
  14740. _getSaveJSON: function _getSaveJSON() {
  14741. var json = _.clone(_.first(this._opSetQueue));
  14742. AV._objectEach(json, function (op, key) {
  14743. json[key] = op.toJSON();
  14744. });
  14745. return json;
  14746. },
  14747. /**
  14748. * Returns true if this object can be serialized for saving.
  14749. * @private
  14750. */
  14751. _canBeSerialized: function _canBeSerialized() {
  14752. return AV.Object._canBeSerializedAsValue(this.attributes);
  14753. },
  14754. /**
  14755. * Fetch the model from the server. If the server's representation of the
  14756. * model differs from its current attributes, they will be overriden,
  14757. * triggering a <code>"change"</code> event.
  14758. * @param {Object} fetchOptions Optional options to set 'keys',
  14759. * 'include' and 'includeACL' option.
  14760. * @param {AuthOptions} options
  14761. * @return {Promise} A promise that is fulfilled when the fetch
  14762. * completes.
  14763. */
  14764. fetch: function fetch() {
  14765. var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  14766. var options = arguments.length > 1 ? arguments[1] : undefined;
  14767. if (!this.id) {
  14768. throw new Error('Cannot fetch unsaved object');
  14769. }
  14770. var self = this;
  14771. var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
  14772. return request.then(function (response) {
  14773. var fetchedAttrs = self.parse(response);
  14774. self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
  14775. self._finishFetch(fetchedAttrs, true);
  14776. return self;
  14777. });
  14778. },
  14779. _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
  14780. var _this2 = this;
  14781. var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
  14782. _.forEach(fetchedKeys, function (key) {
  14783. if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
  14784. });
  14785. },
  14786. /**
  14787. * Set a hash of model attributes, and save the model to the server.
  14788. * updatedAt will be updated when the request returns.
  14789. * You can either call it as:<pre>
  14790. * object.save();</pre>
  14791. * or<pre>
  14792. * object.save(null, options);</pre>
  14793. * or<pre>
  14794. * object.save(attrs, options);</pre>
  14795. * or<pre>
  14796. * object.save(key, value, options);</pre>
  14797. *
  14798. * @example
  14799. * gameTurn.save({
  14800. * player: "Jake Cutter",
  14801. * diceRoll: 2
  14802. * }).then(function(gameTurnAgain) {
  14803. * // The save was successful.
  14804. * }, function(error) {
  14805. * // The save failed. Error is an instance of AVError.
  14806. * });
  14807. *
  14808. * @param {AuthOptions} options AuthOptions plus:
  14809. * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
  14810. * @param {AV.Query} options.query Save object only when it matches the query
  14811. * @return {Promise} A promise that is fulfilled when the save
  14812. * completes.
  14813. * @see AVError
  14814. */
  14815. save: function save(arg1, arg2, arg3) {
  14816. var attrs, current, options;
  14817. if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
  14818. attrs = arg1;
  14819. options = arg2;
  14820. } else {
  14821. attrs = {};
  14822. attrs[arg1] = arg2;
  14823. options = arg3;
  14824. }
  14825. options = _.clone(options) || {};
  14826. if (options.wait) {
  14827. current = _.clone(this.attributes);
  14828. }
  14829. var setOptions = _.clone(options) || {};
  14830. if (setOptions.wait) {
  14831. setOptions.silent = true;
  14832. }
  14833. if (attrs) {
  14834. this.set(attrs, setOptions);
  14835. }
  14836. var model = this;
  14837. var unsavedChildren = [];
  14838. var unsavedFiles = [];
  14839. AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
  14840. if (unsavedChildren.length + unsavedFiles.length > 1) {
  14841. return AV.Object._deepSaveAsync(this, model, options);
  14842. }
  14843. this._startSave();
  14844. this._saving = (this._saving || 0) + 1;
  14845. this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
  14846. this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
  14847. var method = model.id ? 'PUT' : 'POST';
  14848. var json = model._getSaveJSON();
  14849. var query = {};
  14850. if (model._fetchWhenSave || options.fetchWhenSave) {
  14851. query['new'] = 'true';
  14852. } // user login option
  14853. if (options._failOnNotExist) {
  14854. query.failOnNotExist = 'true';
  14855. }
  14856. if (options.query) {
  14857. var queryParams;
  14858. if (typeof options.query._getParams === 'function') {
  14859. queryParams = options.query._getParams();
  14860. if (queryParams) {
  14861. query.where = queryParams.where;
  14862. }
  14863. }
  14864. if (!query.where) {
  14865. var error = new Error('options.query is not an AV.Query');
  14866. throw error;
  14867. }
  14868. }
  14869. _.extend(json, model._flags);
  14870. var route = 'classes';
  14871. var className = model.className;
  14872. if (model.className === '_User' && !model.id) {
  14873. // Special-case user sign-up.
  14874. route = 'users';
  14875. className = null;
  14876. } //hook makeRequest in options.
  14877. var makeRequest = options._makeRequest || _request;
  14878. var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
  14879. requestPromise = requestPromise.then(function (resp) {
  14880. var serverAttrs = model.parse(resp);
  14881. if (options.wait) {
  14882. serverAttrs = _.extend(attrs || {}, serverAttrs);
  14883. }
  14884. model._finishSave(serverAttrs);
  14885. if (options.wait) {
  14886. model.set(current, setOptions);
  14887. }
  14888. return model;
  14889. }, function (error) {
  14890. model._cancelSave();
  14891. throw error;
  14892. });
  14893. return requestPromise;
  14894. });
  14895. return this._allPreviousSaves;
  14896. },
  14897. /**
  14898. * Destroy this model on the server if it was already persisted.
  14899. * Optimistically removes the model from its collection, if it has one.
  14900. * @param {AuthOptions} options AuthOptions plus:
  14901. * @param {Boolean} [options.wait] wait for the server to respond
  14902. * before removal.
  14903. *
  14904. * @return {Promise} A promise that is fulfilled when the destroy
  14905. * completes.
  14906. */
  14907. destroy: function destroy(options) {
  14908. options = options || {};
  14909. var model = this;
  14910. var triggerDestroy = function triggerDestroy() {
  14911. model.trigger('destroy', model, model.collection, options);
  14912. };
  14913. if (!this.id) {
  14914. return triggerDestroy();
  14915. }
  14916. if (!options.wait) {
  14917. triggerDestroy();
  14918. }
  14919. var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
  14920. return request.then(function () {
  14921. if (options.wait) {
  14922. triggerDestroy();
  14923. }
  14924. return model;
  14925. });
  14926. },
  14927. /**
  14928. * Converts a response into the hash of attributes to be set on the model.
  14929. * @ignore
  14930. */
  14931. parse: function parse(resp) {
  14932. var output = _.clone(resp);
  14933. ['createdAt', 'updatedAt'].forEach(function (key) {
  14934. if (output[key]) {
  14935. output[key] = AV._parseDate(output[key]);
  14936. }
  14937. });
  14938. if (output.createdAt && !output.updatedAt) {
  14939. output.updatedAt = output.createdAt;
  14940. }
  14941. return output;
  14942. },
  14943. /**
  14944. * Creates a new model with identical attributes to this one.
  14945. * @return {AV.Object}
  14946. */
  14947. clone: function clone() {
  14948. return new this.constructor(this.attributes);
  14949. },
  14950. /**
  14951. * Returns true if this object has never been saved to AV.
  14952. * @return {Boolean}
  14953. */
  14954. isNew: function isNew() {
  14955. return !this.id;
  14956. },
  14957. /**
  14958. * Call this method to manually fire a `"change"` event for this model and
  14959. * a `"change:attribute"` event for each changed attribute.
  14960. * Calling this will cause all objects observing the model to update.
  14961. */
  14962. change: function change(options) {
  14963. options = options || {};
  14964. var changing = this._changing;
  14965. this._changing = true; // Silent changes become pending changes.
  14966. var self = this;
  14967. AV._objectEach(this._silent, function (attr) {
  14968. self._pending[attr] = true;
  14969. }); // Silent changes are triggered.
  14970. var changes = _.extend({}, options.changes, this._silent);
  14971. this._silent = {};
  14972. AV._objectEach(changes, function (unused_value, attr) {
  14973. self.trigger('change:' + attr, self, self.get(attr), options);
  14974. });
  14975. if (changing) {
  14976. return this;
  14977. } // This is to get around lint not letting us make a function in a loop.
  14978. var deleteChanged = function deleteChanged(value, attr) {
  14979. if (!self._pending[attr] && !self._silent[attr]) {
  14980. delete self.changed[attr];
  14981. }
  14982. }; // Continue firing `"change"` events while there are pending changes.
  14983. while (!_.isEmpty(this._pending)) {
  14984. this._pending = {};
  14985. this.trigger('change', this, options); // Pending and silent changes still remain.
  14986. AV._objectEach(this.changed, deleteChanged);
  14987. self._previousAttributes = _.clone(this.attributes);
  14988. }
  14989. this._changing = false;
  14990. return this;
  14991. },
  14992. /**
  14993. * Gets the previous value of an attribute, recorded at the time the last
  14994. * <code>"change"</code> event was fired.
  14995. * @param {String} attr Name of the attribute to get.
  14996. */
  14997. previous: function previous(attr) {
  14998. if (!arguments.length || !this._previousAttributes) {
  14999. return null;
  15000. }
  15001. return this._previousAttributes[attr];
  15002. },
  15003. /**
  15004. * Gets all of the attributes of the model at the time of the previous
  15005. * <code>"change"</code> event.
  15006. * @return {Object}
  15007. */
  15008. previousAttributes: function previousAttributes() {
  15009. return _.clone(this._previousAttributes);
  15010. },
  15011. /**
  15012. * Checks if the model is currently in a valid state. It's only possible to
  15013. * get into an *invalid* state if you're using silent changes.
  15014. * @return {Boolean}
  15015. */
  15016. isValid: function isValid() {
  15017. try {
  15018. this.validate(this.attributes);
  15019. } catch (error) {
  15020. return false;
  15021. }
  15022. return true;
  15023. },
  15024. /**
  15025. * You should not call this function directly unless you subclass
  15026. * <code>AV.Object</code>, in which case you can override this method
  15027. * to provide additional validation on <code>set</code> and
  15028. * <code>save</code>. Your implementation should throw an Error if
  15029. * the attrs is invalid
  15030. *
  15031. * @param {Object} attrs The current data to validate.
  15032. * @see AV.Object#set
  15033. */
  15034. validate: function validate(attrs) {
  15035. if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
  15036. throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
  15037. }
  15038. },
  15039. /**
  15040. * Run validation against a set of incoming attributes, returning `true`
  15041. * if all is well. If a specific `error` callback has been passed,
  15042. * call that instead of firing the general `"error"` event.
  15043. * @private
  15044. */
  15045. _validate: function _validate(attrs, options) {
  15046. if (options.silent || !this.validate) {
  15047. return;
  15048. }
  15049. attrs = _.extend({}, this.attributes, attrs);
  15050. this.validate(attrs);
  15051. },
  15052. /**
  15053. * Returns the ACL for this object.
  15054. * @returns {AV.ACL} An instance of AV.ACL.
  15055. * @see AV.Object#get
  15056. */
  15057. getACL: function getACL() {
  15058. return this.get('ACL');
  15059. },
  15060. /**
  15061. * Sets the ACL to be used for this object.
  15062. * @param {AV.ACL} acl An instance of AV.ACL.
  15063. * @param {Object} options Optional Backbone-like options object to be
  15064. * passed in to set.
  15065. * @return {AV.Object} self
  15066. * @see AV.Object#set
  15067. */
  15068. setACL: function setACL(acl, options) {
  15069. return this.set('ACL', acl, options);
  15070. },
  15071. disableBeforeHook: function disableBeforeHook() {
  15072. this.ignoreHook('beforeSave');
  15073. this.ignoreHook('beforeUpdate');
  15074. this.ignoreHook('beforeDelete');
  15075. },
  15076. disableAfterHook: function disableAfterHook() {
  15077. this.ignoreHook('afterSave');
  15078. this.ignoreHook('afterUpdate');
  15079. this.ignoreHook('afterDelete');
  15080. },
  15081. ignoreHook: function ignoreHook(hookName) {
  15082. if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
  15083. throw new Error('Unsupported hookName: ' + hookName);
  15084. }
  15085. if (!AV.hookKey) {
  15086. throw new Error('ignoreHook required hookKey');
  15087. }
  15088. if (!this._flags.__ignore_hooks) {
  15089. this._flags.__ignore_hooks = [];
  15090. }
  15091. this._flags.__ignore_hooks.push(hookName);
  15092. }
  15093. });
  15094. /**
  15095. * Creates an instance of a subclass of AV.Object for the give classname
  15096. * and id.
  15097. * @param {String|Function} class the className or a subclass of AV.Object.
  15098. * @param {String} id The object id of this model.
  15099. * @return {AV.Object} A new subclass instance of AV.Object.
  15100. */
  15101. AV.Object.createWithoutData = function (klass, id, hasData) {
  15102. var _klass;
  15103. if (_.isString(klass)) {
  15104. _klass = AV.Object._getSubclass(klass);
  15105. } else if (klass.prototype && klass.prototype instanceof AV.Object) {
  15106. _klass = klass;
  15107. } else {
  15108. throw new Error('class must be a string or a subclass of AV.Object.');
  15109. }
  15110. if (!id) {
  15111. throw new TypeError('The objectId must be provided');
  15112. }
  15113. var object = new _klass();
  15114. object.id = id;
  15115. object._hasData = hasData;
  15116. return object;
  15117. };
  15118. /**
  15119. * Delete objects in batch.
  15120. * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
  15121. * @param {AuthOptions} options
  15122. * @return {Promise} A promise that is fulfilled when the save
  15123. * completes.
  15124. */
  15125. AV.Object.destroyAll = function (objects) {
  15126. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  15127. if (!objects || objects.length === 0) {
  15128. return _promise.default.resolve();
  15129. }
  15130. var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
  15131. return (0, _stringify.default)({
  15132. className: object.className,
  15133. flags: object._flags
  15134. });
  15135. });
  15136. var body = {
  15137. requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
  15138. var _context3;
  15139. var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
  15140. return {
  15141. method: 'DELETE',
  15142. path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
  15143. body: objects[0]._flags
  15144. };
  15145. })
  15146. };
  15147. return _request('batch', null, null, 'POST', body, options).then(function (response) {
  15148. var firstError = (0, _find.default)(_).call(_, response, function (result) {
  15149. return !result.success;
  15150. });
  15151. if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
  15152. return undefined;
  15153. });
  15154. };
  15155. /**
  15156. * Returns the appropriate subclass for making new instances of the given
  15157. * className string.
  15158. * @private
  15159. */
  15160. AV.Object._getSubclass = function (className) {
  15161. if (!_.isString(className)) {
  15162. throw new Error('AV.Object._getSubclass requires a string argument.');
  15163. }
  15164. var ObjectClass = AV.Object._classMap[className];
  15165. if (!ObjectClass) {
  15166. ObjectClass = AV.Object.extend(className);
  15167. AV.Object._classMap[className] = ObjectClass;
  15168. }
  15169. return ObjectClass;
  15170. };
  15171. /**
  15172. * Creates an instance of a subclass of AV.Object for the given classname.
  15173. * @private
  15174. */
  15175. AV.Object._create = function (className, attributes, options) {
  15176. var ObjectClass = AV.Object._getSubclass(className);
  15177. return new ObjectClass(attributes, options);
  15178. }; // Set up a map of className to class so that we can create new instances of
  15179. // AV Objects from JSON automatically.
  15180. AV.Object._classMap = {};
  15181. AV.Object._extend = AV._extend;
  15182. /**
  15183. * Creates a new model with defined attributes,
  15184. * It's the same with
  15185. * <pre>
  15186. * new AV.Object(attributes, options);
  15187. * </pre>
  15188. * @param {Object} attributes The initial set of data to store in the object.
  15189. * @param {Object} options A set of Backbone-like options for creating the
  15190. * object. The only option currently supported is "collection".
  15191. * @return {AV.Object}
  15192. * @since v0.4.4
  15193. * @see AV.Object
  15194. * @see AV.Object.extend
  15195. */
  15196. AV.Object['new'] = function (attributes, options) {
  15197. return new AV.Object(attributes, options);
  15198. };
  15199. /**
  15200. * Creates a new subclass of AV.Object for the given AV class name.
  15201. *
  15202. * <p>Every extension of a AV class will inherit from the most recent
  15203. * previous extension of that class. When a AV.Object is automatically
  15204. * created by parsing JSON, it will use the most recent extension of that
  15205. * class.</p>
  15206. *
  15207. * @example
  15208. * var MyClass = AV.Object.extend("MyClass", {
  15209. * // Instance properties
  15210. * }, {
  15211. * // Class properties
  15212. * });
  15213. *
  15214. * @param {String} className The name of the AV class backing this model.
  15215. * @param {Object} protoProps Instance properties to add to instances of the
  15216. * class returned from this method.
  15217. * @param {Object} classProps Class properties to add the class returned from
  15218. * this method.
  15219. * @return {Class} A new subclass of AV.Object.
  15220. */
  15221. AV.Object.extend = function (className, protoProps, classProps) {
  15222. // Handle the case with only two args.
  15223. if (!_.isString(className)) {
  15224. if (className && _.has(className, 'className')) {
  15225. return AV.Object.extend(className.className, className, protoProps);
  15226. } else {
  15227. throw new Error("AV.Object.extend's first argument should be the className.");
  15228. }
  15229. } // If someone tries to subclass "User", coerce it to the right type.
  15230. if (className === 'User') {
  15231. className = '_User';
  15232. }
  15233. var NewClassObject = null;
  15234. if (_.has(AV.Object._classMap, className)) {
  15235. var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
  15236. // OldClassObject. This is multiple inheritance, which isn't supported.
  15237. // For now, let's just pick one.
  15238. if (protoProps || classProps) {
  15239. NewClassObject = OldClassObject._extend(protoProps, classProps);
  15240. } else {
  15241. return OldClassObject;
  15242. }
  15243. } else {
  15244. protoProps = protoProps || {};
  15245. protoProps._className = className;
  15246. NewClassObject = this._extend(protoProps, classProps);
  15247. } // Extending a subclass should reuse the classname automatically.
  15248. NewClassObject.extend = function (arg0) {
  15249. var _context4;
  15250. if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
  15251. return AV.Object.extend.apply(NewClassObject, arguments);
  15252. }
  15253. var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
  15254. return AV.Object.extend.apply(NewClassObject, newArguments);
  15255. }; // Add the query property descriptor.
  15256. (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
  15257. NewClassObject['new'] = function (attributes, options) {
  15258. return new NewClassObject(attributes, options);
  15259. };
  15260. AV.Object._classMap[className] = NewClassObject;
  15261. return NewClassObject;
  15262. }; // ES6 class syntax support
  15263. (0, _defineProperty.default)(AV.Object.prototype, 'className', {
  15264. get: function get() {
  15265. var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
  15266. if (className === 'User') {
  15267. return '_User';
  15268. }
  15269. return className;
  15270. }
  15271. });
  15272. /**
  15273. * Register a class.
  15274. * If a subclass of <code>AV.Object</code> is defined with your own implement
  15275. * rather then <code>AV.Object.extend</code>, the subclass must be registered.
  15276. * @param {Function} klass A subclass of <code>AV.Object</code>
  15277. * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
  15278. * @example
  15279. * class Person extend AV.Object {}
  15280. * AV.Object.register(Person);
  15281. */
  15282. AV.Object.register = function (klass, name) {
  15283. if (!(klass.prototype instanceof AV.Object)) {
  15284. throw new Error('registered class is not a subclass of AV.Object');
  15285. }
  15286. var className = name || klass.name;
  15287. if (!className.length) {
  15288. throw new Error('registered class must be named');
  15289. }
  15290. if (name) {
  15291. klass._LCClassName = name;
  15292. }
  15293. AV.Object._classMap[className] = klass;
  15294. };
  15295. /**
  15296. * Get a new Query of the current class
  15297. * @name query
  15298. * @memberof AV.Object
  15299. * @type AV.Query
  15300. * @readonly
  15301. * @since v3.1.0
  15302. * @example
  15303. * const Post = AV.Object.extend('Post');
  15304. * Post.query.equalTo('author', 'leancloud').find().then();
  15305. */
  15306. (0, _defineProperty.default)(AV.Object, 'query', {
  15307. get: function get() {
  15308. return new AV.Query(this.prototype.className);
  15309. }
  15310. });
  15311. AV.Object._findUnsavedChildren = function (objects, children, files) {
  15312. AV._traverse(objects, function (object) {
  15313. if (object instanceof AV.Object) {
  15314. if (object.dirty()) {
  15315. children.push(object);
  15316. }
  15317. return;
  15318. }
  15319. if (object instanceof AV.File) {
  15320. if (!object.id) {
  15321. files.push(object);
  15322. }
  15323. return;
  15324. }
  15325. });
  15326. };
  15327. AV.Object._canBeSerializedAsValue = function (object) {
  15328. var canBeSerializedAsValue = true;
  15329. if (object instanceof AV.Object || object instanceof AV.File) {
  15330. canBeSerializedAsValue = !!object.id;
  15331. } else if (_.isArray(object)) {
  15332. AV._arrayEach(object, function (child) {
  15333. if (!AV.Object._canBeSerializedAsValue(child)) {
  15334. canBeSerializedAsValue = false;
  15335. }
  15336. });
  15337. } else if (_.isObject(object)) {
  15338. AV._objectEach(object, function (child) {
  15339. if (!AV.Object._canBeSerializedAsValue(child)) {
  15340. canBeSerializedAsValue = false;
  15341. }
  15342. });
  15343. }
  15344. return canBeSerializedAsValue;
  15345. };
  15346. AV.Object._deepSaveAsync = function (object, model, options) {
  15347. var unsavedChildren = [];
  15348. var unsavedFiles = [];
  15349. AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
  15350. unsavedFiles = _.uniq(unsavedFiles);
  15351. var promise = _promise.default.resolve();
  15352. _.each(unsavedFiles, function (file) {
  15353. promise = promise.then(function () {
  15354. return file.save();
  15355. });
  15356. });
  15357. var objects = _.uniq(unsavedChildren);
  15358. var remaining = _.uniq(objects);
  15359. return promise.then(function () {
  15360. return continueWhile(function () {
  15361. return remaining.length > 0;
  15362. }, function () {
  15363. // Gather up all the objects that can be saved in this batch.
  15364. var batch = [];
  15365. var newRemaining = [];
  15366. AV._arrayEach(remaining, function (object) {
  15367. if (object._canBeSerialized()) {
  15368. batch.push(object);
  15369. } else {
  15370. newRemaining.push(object);
  15371. }
  15372. });
  15373. remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
  15374. if (batch.length === 0) {
  15375. return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
  15376. } // Reserve a spot in every object's save queue.
  15377. var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
  15378. return object._allPreviousSaves || _promise.default.resolve();
  15379. })); // Save a single batch, whether previous saves succeeded or failed.
  15380. var bathSavePromise = readyToStart.then(function () {
  15381. return _request('batch', null, null, 'POST', {
  15382. requests: (0, _map.default)(_).call(_, batch, function (object) {
  15383. var method = object.id ? 'PUT' : 'POST';
  15384. var json = object._getSaveJSON();
  15385. _.extend(json, object._flags);
  15386. var route = 'classes';
  15387. var className = object.className;
  15388. var path = "/".concat(route, "/").concat(className);
  15389. if (object.className === '_User' && !object.id) {
  15390. // Special-case user sign-up.
  15391. path = '/users';
  15392. }
  15393. var path = "/1.1".concat(path);
  15394. if (object.id) {
  15395. path = path + '/' + object.id;
  15396. }
  15397. object._startSave();
  15398. return {
  15399. method: method,
  15400. path: path,
  15401. body: json,
  15402. params: options && options.fetchWhenSave ? {
  15403. fetchWhenSave: true
  15404. } : undefined
  15405. };
  15406. })
  15407. }, options).then(function (response) {
  15408. var results = (0, _map.default)(_).call(_, batch, function (object, i) {
  15409. if (response[i].success) {
  15410. object._finishSave(object.parse(response[i].success));
  15411. return object;
  15412. }
  15413. object._cancelSave();
  15414. return new AVError(response[i].error.code, response[i].error.error);
  15415. });
  15416. return handleBatchResults(results);
  15417. });
  15418. });
  15419. AV._arrayEach(batch, function (object) {
  15420. object._allPreviousSaves = bathSavePromise;
  15421. });
  15422. return bathSavePromise;
  15423. });
  15424. }).then(function () {
  15425. return object;
  15426. });
  15427. };
  15428. };
  15429. /***/ }),
  15430. /* 531 */
  15431. /***/ (function(module, exports, __webpack_require__) {
  15432. var arrayWithHoles = __webpack_require__(532);
  15433. var iterableToArrayLimit = __webpack_require__(540);
  15434. var unsupportedIterableToArray = __webpack_require__(541);
  15435. var nonIterableRest = __webpack_require__(551);
  15436. function _slicedToArray(arr, i) {
  15437. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  15438. }
  15439. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15440. /***/ }),
  15441. /* 532 */
  15442. /***/ (function(module, exports, __webpack_require__) {
  15443. var _Array$isArray = __webpack_require__(533);
  15444. function _arrayWithHoles(arr) {
  15445. if (_Array$isArray(arr)) return arr;
  15446. }
  15447. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15448. /***/ }),
  15449. /* 533 */
  15450. /***/ (function(module, exports, __webpack_require__) {
  15451. module.exports = __webpack_require__(534);
  15452. /***/ }),
  15453. /* 534 */
  15454. /***/ (function(module, exports, __webpack_require__) {
  15455. module.exports = __webpack_require__(535);
  15456. /***/ }),
  15457. /* 535 */
  15458. /***/ (function(module, exports, __webpack_require__) {
  15459. var parent = __webpack_require__(536);
  15460. module.exports = parent;
  15461. /***/ }),
  15462. /* 536 */
  15463. /***/ (function(module, exports, __webpack_require__) {
  15464. var parent = __webpack_require__(537);
  15465. module.exports = parent;
  15466. /***/ }),
  15467. /* 537 */
  15468. /***/ (function(module, exports, __webpack_require__) {
  15469. var parent = __webpack_require__(538);
  15470. module.exports = parent;
  15471. /***/ }),
  15472. /* 538 */
  15473. /***/ (function(module, exports, __webpack_require__) {
  15474. __webpack_require__(539);
  15475. var path = __webpack_require__(5);
  15476. module.exports = path.Array.isArray;
  15477. /***/ }),
  15478. /* 539 */
  15479. /***/ (function(module, exports, __webpack_require__) {
  15480. var $ = __webpack_require__(0);
  15481. var isArray = __webpack_require__(90);
  15482. // `Array.isArray` method
  15483. // https://tc39.es/ecma262/#sec-array.isarray
  15484. $({ target: 'Array', stat: true }, {
  15485. isArray: isArray
  15486. });
  15487. /***/ }),
  15488. /* 540 */
  15489. /***/ (function(module, exports, __webpack_require__) {
  15490. var _Symbol = __webpack_require__(242);
  15491. var _getIteratorMethod = __webpack_require__(254);
  15492. function _iterableToArrayLimit(arr, i) {
  15493. var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
  15494. if (_i == null) return;
  15495. var _arr = [];
  15496. var _n = true;
  15497. var _d = false;
  15498. var _s, _e;
  15499. try {
  15500. for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
  15501. _arr.push(_s.value);
  15502. if (i && _arr.length === i) break;
  15503. }
  15504. } catch (err) {
  15505. _d = true;
  15506. _e = err;
  15507. } finally {
  15508. try {
  15509. if (!_n && _i["return"] != null) _i["return"]();
  15510. } finally {
  15511. if (_d) throw _e;
  15512. }
  15513. }
  15514. return _arr;
  15515. }
  15516. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15517. /***/ }),
  15518. /* 541 */
  15519. /***/ (function(module, exports, __webpack_require__) {
  15520. var _sliceInstanceProperty = __webpack_require__(542);
  15521. var _Array$from = __webpack_require__(546);
  15522. var arrayLikeToArray = __webpack_require__(550);
  15523. function _unsupportedIterableToArray(o, minLen) {
  15524. var _context;
  15525. if (!o) return;
  15526. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  15527. var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
  15528. if (n === "Object" && o.constructor) n = o.constructor.name;
  15529. if (n === "Map" || n === "Set") return _Array$from(o);
  15530. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  15531. }
  15532. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15533. /***/ }),
  15534. /* 542 */
  15535. /***/ (function(module, exports, __webpack_require__) {
  15536. module.exports = __webpack_require__(543);
  15537. /***/ }),
  15538. /* 543 */
  15539. /***/ (function(module, exports, __webpack_require__) {
  15540. module.exports = __webpack_require__(544);
  15541. /***/ }),
  15542. /* 544 */
  15543. /***/ (function(module, exports, __webpack_require__) {
  15544. var parent = __webpack_require__(545);
  15545. module.exports = parent;
  15546. /***/ }),
  15547. /* 545 */
  15548. /***/ (function(module, exports, __webpack_require__) {
  15549. var parent = __webpack_require__(240);
  15550. module.exports = parent;
  15551. /***/ }),
  15552. /* 546 */
  15553. /***/ (function(module, exports, __webpack_require__) {
  15554. module.exports = __webpack_require__(547);
  15555. /***/ }),
  15556. /* 547 */
  15557. /***/ (function(module, exports, __webpack_require__) {
  15558. module.exports = __webpack_require__(548);
  15559. /***/ }),
  15560. /* 548 */
  15561. /***/ (function(module, exports, __webpack_require__) {
  15562. var parent = __webpack_require__(549);
  15563. module.exports = parent;
  15564. /***/ }),
  15565. /* 549 */
  15566. /***/ (function(module, exports, __webpack_require__) {
  15567. var parent = __webpack_require__(253);
  15568. module.exports = parent;
  15569. /***/ }),
  15570. /* 550 */
  15571. /***/ (function(module, exports) {
  15572. function _arrayLikeToArray(arr, len) {
  15573. if (len == null || len > arr.length) len = arr.length;
  15574. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  15575. arr2[i] = arr[i];
  15576. }
  15577. return arr2;
  15578. }
  15579. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15580. /***/ }),
  15581. /* 551 */
  15582. /***/ (function(module, exports) {
  15583. function _nonIterableRest() {
  15584. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  15585. }
  15586. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15587. /***/ }),
  15588. /* 552 */
  15589. /***/ (function(module, exports, __webpack_require__) {
  15590. var parent = __webpack_require__(553);
  15591. module.exports = parent;
  15592. /***/ }),
  15593. /* 553 */
  15594. /***/ (function(module, exports, __webpack_require__) {
  15595. __webpack_require__(554);
  15596. var path = __webpack_require__(5);
  15597. var Object = path.Object;
  15598. var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
  15599. return Object.getOwnPropertyDescriptor(it, key);
  15600. };
  15601. if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
  15602. /***/ }),
  15603. /* 554 */
  15604. /***/ (function(module, exports, __webpack_require__) {
  15605. var $ = __webpack_require__(0);
  15606. var fails = __webpack_require__(2);
  15607. var toIndexedObject = __webpack_require__(32);
  15608. var nativeGetOwnPropertyDescriptor = __webpack_require__(62).f;
  15609. var DESCRIPTORS = __webpack_require__(14);
  15610. var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
  15611. var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
  15612. // `Object.getOwnPropertyDescriptor` method
  15613. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  15614. $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
  15615. getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
  15616. return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
  15617. }
  15618. });
  15619. /***/ }),
  15620. /* 555 */
  15621. /***/ (function(module, exports, __webpack_require__) {
  15622. "use strict";
  15623. var _ = __webpack_require__(3);
  15624. var AVError = __webpack_require__(46);
  15625. module.exports = function (AV) {
  15626. AV.Role = AV.Object.extend('_Role',
  15627. /** @lends AV.Role.prototype */
  15628. {
  15629. // Instance Methods
  15630. /**
  15631. * Represents a Role on the AV server. Roles represent groupings of
  15632. * Users for the purposes of granting permissions (e.g. specifying an ACL
  15633. * for an Object). Roles are specified by their sets of child users and
  15634. * child roles, all of which are granted any permissions that the parent
  15635. * role has.
  15636. *
  15637. * <p>Roles must have a name (which cannot be changed after creation of the
  15638. * role), and must specify an ACL.</p>
  15639. * An AV.Role is a local representation of a role persisted to the AV
  15640. * cloud.
  15641. * @class AV.Role
  15642. * @param {String} name The name of the Role to create.
  15643. * @param {AV.ACL} acl The ACL for this role.
  15644. */
  15645. constructor: function constructor(name, acl) {
  15646. if (_.isString(name)) {
  15647. AV.Object.prototype.constructor.call(this, null, null);
  15648. this.setName(name);
  15649. } else {
  15650. AV.Object.prototype.constructor.call(this, name, acl);
  15651. }
  15652. if (acl) {
  15653. if (!(acl instanceof AV.ACL)) {
  15654. throw new TypeError('acl must be an instance of AV.ACL');
  15655. } else {
  15656. this.setACL(acl);
  15657. }
  15658. }
  15659. },
  15660. /**
  15661. * Gets the name of the role. You can alternatively call role.get("name")
  15662. *
  15663. * @return {String} the name of the role.
  15664. */
  15665. getName: function getName() {
  15666. return this.get('name');
  15667. },
  15668. /**
  15669. * Sets the name for a role. This value must be set before the role has
  15670. * been saved to the server, and cannot be set once the role has been
  15671. * saved.
  15672. *
  15673. * <p>
  15674. * A role's name can only contain alphanumeric characters, _, -, and
  15675. * spaces.
  15676. * </p>
  15677. *
  15678. * <p>This is equivalent to calling role.set("name", name)</p>
  15679. *
  15680. * @param {String} name The name of the role.
  15681. */
  15682. setName: function setName(name, options) {
  15683. return this.set('name', name, options);
  15684. },
  15685. /**
  15686. * Gets the AV.Relation for the AV.Users that are direct
  15687. * children of this role. These users are granted any privileges that this
  15688. * role has been granted (e.g. read or write access through ACLs). You can
  15689. * add or remove users from the role through this relation.
  15690. *
  15691. * <p>This is equivalent to calling role.relation("users")</p>
  15692. *
  15693. * @return {AV.Relation} the relation for the users belonging to this
  15694. * role.
  15695. */
  15696. getUsers: function getUsers() {
  15697. return this.relation('users');
  15698. },
  15699. /**
  15700. * Gets the AV.Relation for the AV.Roles that are direct
  15701. * children of this role. These roles' users are granted any privileges that
  15702. * this role has been granted (e.g. read or write access through ACLs). You
  15703. * can add or remove child roles from this role through this relation.
  15704. *
  15705. * <p>This is equivalent to calling role.relation("roles")</p>
  15706. *
  15707. * @return {AV.Relation} the relation for the roles belonging to this
  15708. * role.
  15709. */
  15710. getRoles: function getRoles() {
  15711. return this.relation('roles');
  15712. },
  15713. /**
  15714. * @ignore
  15715. */
  15716. validate: function validate(attrs, options) {
  15717. if ('name' in attrs && attrs.name !== this.getName()) {
  15718. var newName = attrs.name;
  15719. if (this.id && this.id !== attrs.objectId) {
  15720. // Check to see if the objectId being set matches this.id.
  15721. // This happens during a fetch -- the id is set before calling fetch.
  15722. // Let the name be set in this case.
  15723. return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
  15724. }
  15725. if (!_.isString(newName)) {
  15726. return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
  15727. }
  15728. if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
  15729. return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
  15730. }
  15731. }
  15732. if (AV.Object.prototype.validate) {
  15733. return AV.Object.prototype.validate.call(this, attrs, options);
  15734. }
  15735. return false;
  15736. }
  15737. });
  15738. };
  15739. /***/ }),
  15740. /* 556 */
  15741. /***/ (function(module, exports, __webpack_require__) {
  15742. "use strict";
  15743. var _interopRequireDefault = __webpack_require__(1);
  15744. var _defineProperty2 = _interopRequireDefault(__webpack_require__(557));
  15745. var _promise = _interopRequireDefault(__webpack_require__(12));
  15746. var _map = _interopRequireDefault(__webpack_require__(35));
  15747. var _find = _interopRequireDefault(__webpack_require__(93));
  15748. var _stringify = _interopRequireDefault(__webpack_require__(36));
  15749. var _ = __webpack_require__(3);
  15750. var uuid = __webpack_require__(232);
  15751. var AVError = __webpack_require__(46);
  15752. var _require = __webpack_require__(27),
  15753. AVRequest = _require._request,
  15754. request = _require.request;
  15755. var _require2 = __webpack_require__(72),
  15756. getAdapter = _require2.getAdapter;
  15757. var PLATFORM_ANONYMOUS = 'anonymous';
  15758. var PLATFORM_QQAPP = 'lc_qqapp';
  15759. var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
  15760. var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
  15761. return function (authData, unionId) {
  15762. var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  15763. _ref$unionIdPlatform = _ref.unionIdPlatform,
  15764. unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
  15765. _ref$asMainAccount = _ref.asMainAccount,
  15766. asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
  15767. if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
  15768. if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
  15769. return _.extend({}, authData, {
  15770. platform: unionIdPlatform,
  15771. unionid: unionId,
  15772. main_account: Boolean(asMainAccount)
  15773. });
  15774. };
  15775. };
  15776. module.exports = function (AV) {
  15777. /**
  15778. * @class
  15779. *
  15780. * <p>An AV.User object is a local representation of a user persisted to the
  15781. * LeanCloud server. This class is a subclass of an AV.Object, and retains the
  15782. * same functionality of an AV.Object, but also extends it with various
  15783. * user specific methods, like authentication, signing up, and validation of
  15784. * uniqueness.</p>
  15785. */
  15786. AV.User = AV.Object.extend('_User',
  15787. /** @lends AV.User.prototype */
  15788. {
  15789. // Instance Variables
  15790. _isCurrentUser: false,
  15791. // Instance Methods
  15792. /**
  15793. * Internal method to handle special fields in a _User response.
  15794. * @private
  15795. */
  15796. _mergeMagicFields: function _mergeMagicFields(attrs) {
  15797. if (attrs.sessionToken) {
  15798. this._sessionToken = attrs.sessionToken;
  15799. delete attrs.sessionToken;
  15800. }
  15801. return AV.User.__super__._mergeMagicFields.call(this, attrs);
  15802. },
  15803. /**
  15804. * Removes null values from authData (which exist temporarily for
  15805. * unlinking)
  15806. * @private
  15807. */
  15808. _cleanupAuthData: function _cleanupAuthData() {
  15809. if (!this.isCurrent()) {
  15810. return;
  15811. }
  15812. var authData = this.get('authData');
  15813. if (!authData) {
  15814. return;
  15815. }
  15816. AV._objectEach(this.get('authData'), function (value, key) {
  15817. if (!authData[key]) {
  15818. delete authData[key];
  15819. }
  15820. });
  15821. },
  15822. /**
  15823. * Synchronizes authData for all providers.
  15824. * @private
  15825. */
  15826. _synchronizeAllAuthData: function _synchronizeAllAuthData() {
  15827. var authData = this.get('authData');
  15828. if (!authData) {
  15829. return;
  15830. }
  15831. var self = this;
  15832. AV._objectEach(this.get('authData'), function (value, key) {
  15833. self._synchronizeAuthData(key);
  15834. });
  15835. },
  15836. /**
  15837. * Synchronizes auth data for a provider (e.g. puts the access token in the
  15838. * right place to be used by the Facebook SDK).
  15839. * @private
  15840. */
  15841. _synchronizeAuthData: function _synchronizeAuthData(provider) {
  15842. if (!this.isCurrent()) {
  15843. return;
  15844. }
  15845. var authType;
  15846. if (_.isString(provider)) {
  15847. authType = provider;
  15848. provider = AV.User._authProviders[authType];
  15849. } else {
  15850. authType = provider.getAuthType();
  15851. }
  15852. var authData = this.get('authData');
  15853. if (!authData || !provider) {
  15854. return;
  15855. }
  15856. var success = provider.restoreAuthentication(authData[authType]);
  15857. if (!success) {
  15858. this.dissociateAuthData(provider);
  15859. }
  15860. },
  15861. _handleSaveResult: function _handleSaveResult(makeCurrent) {
  15862. // Clean up and synchronize the authData object, removing any unset values
  15863. if (makeCurrent && !AV._config.disableCurrentUser) {
  15864. this._isCurrentUser = true;
  15865. }
  15866. this._cleanupAuthData();
  15867. this._synchronizeAllAuthData(); // Don't keep the password around.
  15868. delete this._serverData.password;
  15869. this._rebuildEstimatedDataForKey('password');
  15870. this._refreshCache();
  15871. if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
  15872. // Some old version of leanengine-node-sdk will overwrite
  15873. // AV.User._saveCurrentUser which returns no Promise.
  15874. // So we need a Promise wrapper.
  15875. return _promise.default.resolve(AV.User._saveCurrentUser(this));
  15876. } else {
  15877. return _promise.default.resolve();
  15878. }
  15879. },
  15880. /**
  15881. * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
  15882. * call linkWith on the user (even if it doesn't exist yet on the server).
  15883. * @private
  15884. */
  15885. _linkWith: function _linkWith(provider, data) {
  15886. var _this = this;
  15887. var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  15888. _ref2$failOnNotExist = _ref2.failOnNotExist,
  15889. failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist;
  15890. var authType;
  15891. if (_.isString(provider)) {
  15892. authType = provider;
  15893. provider = AV.User._authProviders[provider];
  15894. } else {
  15895. authType = provider.getAuthType();
  15896. }
  15897. if (data) {
  15898. return this.save({
  15899. authData: (0, _defineProperty2.default)({}, authType, data)
  15900. }, {
  15901. fetchWhenSave: !!this.get('authData'),
  15902. _failOnNotExist: failOnNotExist
  15903. }).then(function (model) {
  15904. return model._handleSaveResult(true).then(function () {
  15905. return model;
  15906. });
  15907. });
  15908. } else {
  15909. return provider.authenticate().then(function (result) {
  15910. return _this._linkWith(provider, result);
  15911. });
  15912. }
  15913. },
  15914. /**
  15915. * Associate the user with a third party authData.
  15916. * @since 3.3.0
  15917. * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
  15918. * @param {string} platform Available platform for sign up.
  15919. * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
  15920. * @example user.associateWithAuthData({
  15921. * openid: 'abc123',
  15922. * access_token: '123abc',
  15923. * expires_in: 1382686496
  15924. * }, 'weixin').then(function(user) {
  15925. * //Access user here
  15926. * }).catch(function(error) {
  15927. * //console.error("error: ", error);
  15928. * });
  15929. */
  15930. associateWithAuthData: function associateWithAuthData(authData, platform) {
  15931. return this._linkWith(platform, authData);
  15932. },
  15933. /**
  15934. * Associate the user with a third party authData and unionId.
  15935. * @since 3.5.0
  15936. * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
  15937. * @param {string} platform Available platform for sign up.
  15938. * @param {string} unionId
  15939. * @param {Object} [unionLoginOptions]
  15940. * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
  15941. * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
  15942. * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
  15943. * @example user.associateWithAuthDataAndUnionId({
  15944. * openid: 'abc123',
  15945. * access_token: '123abc',
  15946. * expires_in: 1382686496
  15947. * }, 'weixin', 'union123', {
  15948. * unionIdPlatform: 'weixin',
  15949. * asMainAccount: true,
  15950. * }).then(function(user) {
  15951. * //Access user here
  15952. * }).catch(function(error) {
  15953. * //console.error("error: ", error);
  15954. * });
  15955. */
  15956. associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
  15957. return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
  15958. },
  15959. /**
  15960. * Associate the user with the identity of the current mini-app.
  15961. * @since 4.6.0
  15962. * @param {Object} [authInfo]
  15963. * @param {Object} [option]
  15964. * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
  15965. * @return {Promise<AV.User>}
  15966. */
  15967. associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
  15968. var _this2 = this;
  15969. if (authInfo === undefined) {
  15970. var getAuthInfo = getAdapter('getAuthInfo');
  15971. return getAuthInfo().then(function (authInfo) {
  15972. return _this2._linkWith(authInfo.provider, authInfo.authData, option);
  15973. });
  15974. }
  15975. return this._linkWith(authInfo.provider, authInfo.authData, option);
  15976. },
  15977. /**
  15978. * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
  15979. * 仅在 QQ 小程序中可用。
  15980. *
  15981. * @deprecated Please use {@link AV.User#associateWithMiniApp}
  15982. * @since 4.2.0
  15983. * @param {Object} [options]
  15984. * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
  15985. * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
  15986. * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
  15987. * @return {Promise<AV.User>}
  15988. */
  15989. associateWithQQApp: function associateWithQQApp() {
  15990. var _this3 = this;
  15991. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  15992. _ref3$preferUnionId = _ref3.preferUnionId,
  15993. preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
  15994. _ref3$unionIdPlatform = _ref3.unionIdPlatform,
  15995. unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
  15996. _ref3$asMainAccount = _ref3.asMainAccount,
  15997. asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
  15998. var getAuthInfo = getAdapter('getAuthInfo');
  15999. return getAuthInfo({
  16000. preferUnionId: preferUnionId,
  16001. asMainAccount: asMainAccount,
  16002. platform: unionIdPlatform
  16003. }).then(function (authInfo) {
  16004. authInfo.provider = PLATFORM_QQAPP;
  16005. return _this3.associateWithMiniApp(authInfo);
  16006. });
  16007. },
  16008. /**
  16009. * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
  16010. * 仅在微信小程序中可用。
  16011. *
  16012. * @deprecated Please use {@link AV.User#associateWithMiniApp}
  16013. * @since 3.13.0
  16014. * @param {Object} [options]
  16015. * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
  16016. * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
  16017. * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
  16018. * @return {Promise<AV.User>}
  16019. */
  16020. associateWithWeapp: function associateWithWeapp() {
  16021. var _this4 = this;
  16022. var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  16023. _ref4$preferUnionId = _ref4.preferUnionId,
  16024. preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
  16025. _ref4$unionIdPlatform = _ref4.unionIdPlatform,
  16026. unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
  16027. _ref4$asMainAccount = _ref4.asMainAccount,
  16028. asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
  16029. var getAuthInfo = getAdapter('getAuthInfo');
  16030. return getAuthInfo({
  16031. preferUnionId: preferUnionId,
  16032. asMainAccount: asMainAccount,
  16033. platform: unionIdPlatform
  16034. }).then(function (authInfo) {
  16035. return _this4.associateWithMiniApp(authInfo);
  16036. });
  16037. },
  16038. /**
  16039. * @deprecated renamed to {@link AV.User#associateWithWeapp}
  16040. * @return {Promise<AV.User>}
  16041. */
  16042. linkWithWeapp: function linkWithWeapp(options) {
  16043. console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
  16044. return this.associateWithWeapp(options);
  16045. },
  16046. /**
  16047. * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
  16048. * 仅在 QQ 小程序中可用。
  16049. *
  16050. * @deprecated Please use {@link AV.User#associateWithMiniApp}
  16051. * @since 4.2.0
  16052. * @param {string} unionId
  16053. * @param {Object} [unionOptions]
  16054. * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
  16055. * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
  16056. * @return {Promise<AV.User>}
  16057. */
  16058. associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
  16059. var _this5 = this;
  16060. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  16061. _ref5$unionIdPlatform = _ref5.unionIdPlatform,
  16062. unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
  16063. _ref5$asMainAccount = _ref5.asMainAccount,
  16064. asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
  16065. var getAuthInfo = getAdapter('getAuthInfo');
  16066. return getAuthInfo({
  16067. platform: unionIdPlatform
  16068. }).then(function (authInfo) {
  16069. authInfo = AV.User.mergeUnionId(authInfo, unionId, {
  16070. asMainAccount: asMainAccount
  16071. });
  16072. authInfo.provider = PLATFORM_QQAPP;
  16073. return _this5.associateWithMiniApp(authInfo);
  16074. });
  16075. },
  16076. /**
  16077. * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
  16078. * 仅在微信小程序中可用。
  16079. *
  16080. * @deprecated Please use {@link AV.User#associateWithMiniApp}
  16081. * @since 3.13.0
  16082. * @param {string} unionId
  16083. * @param {Object} [unionOptions]
  16084. * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
  16085. * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
  16086. * @return {Promise<AV.User>}
  16087. */
  16088. associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
  16089. var _this6 = this;
  16090. var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  16091. _ref6$unionIdPlatform = _ref6.unionIdPlatform,
  16092. unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
  16093. _ref6$asMainAccount = _ref6.asMainAccount,
  16094. asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
  16095. var getAuthInfo = getAdapter('getAuthInfo');
  16096. return getAuthInfo({
  16097. platform: unionIdPlatform
  16098. }).then(function (authInfo) {
  16099. authInfo = AV.User.mergeUnionId(authInfo, unionId, {
  16100. asMainAccount: asMainAccount
  16101. });
  16102. return _this6.associateWithMiniApp(authInfo);
  16103. });
  16104. },
  16105. /**
  16106. * Unlinks a user from a service.
  16107. * @param {string} platform
  16108. * @return {Promise<AV.User>}
  16109. * @since 3.3.0
  16110. */
  16111. dissociateAuthData: function dissociateAuthData(provider) {
  16112. this.unset("authData.".concat(provider));
  16113. return this.save().then(function (model) {
  16114. return model._handleSaveResult(true).then(function () {
  16115. return model;
  16116. });
  16117. });
  16118. },
  16119. /**
  16120. * @private
  16121. * @deprecated
  16122. */
  16123. _unlinkFrom: function _unlinkFrom(provider) {
  16124. console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
  16125. return this.dissociateAuthData(provider);
  16126. },
  16127. /**
  16128. * Checks whether a user is linked to a service.
  16129. * @private
  16130. */
  16131. _isLinked: function _isLinked(provider) {
  16132. var authType;
  16133. if (_.isString(provider)) {
  16134. authType = provider;
  16135. } else {
  16136. authType = provider.getAuthType();
  16137. }
  16138. var authData = this.get('authData') || {};
  16139. return !!authData[authType];
  16140. },
  16141. /**
  16142. * Checks whether a user is anonymous.
  16143. * @since 3.9.0
  16144. * @return {boolean}
  16145. */
  16146. isAnonymous: function isAnonymous() {
  16147. return this._isLinked(PLATFORM_ANONYMOUS);
  16148. },
  16149. logOut: function logOut() {
  16150. this._logOutWithAll();
  16151. this._isCurrentUser = false;
  16152. },
  16153. /**
  16154. * Deauthenticates all providers.
  16155. * @private
  16156. */
  16157. _logOutWithAll: function _logOutWithAll() {
  16158. var authData = this.get('authData');
  16159. if (!authData) {
  16160. return;
  16161. }
  16162. var self = this;
  16163. AV._objectEach(this.get('authData'), function (value, key) {
  16164. self._logOutWith(key);
  16165. });
  16166. },
  16167. /**
  16168. * Deauthenticates a single provider (e.g. removing access tokens from the
  16169. * Facebook SDK).
  16170. * @private
  16171. */
  16172. _logOutWith: function _logOutWith(provider) {
  16173. if (!this.isCurrent()) {
  16174. return;
  16175. }
  16176. if (_.isString(provider)) {
  16177. provider = AV.User._authProviders[provider];
  16178. }
  16179. if (provider && provider.deauthenticate) {
  16180. provider.deauthenticate();
  16181. }
  16182. },
  16183. /**
  16184. * Signs up a new user. You should call this instead of save for
  16185. * new AV.Users. This will create a new AV.User on the server, and
  16186. * also persist the session on disk so that you can access the user using
  16187. * <code>current</code>.
  16188. *
  16189. * <p>A username and password must be set before calling signUp.</p>
  16190. *
  16191. * @param {Object} attrs Extra fields to set on the new user, or null.
  16192. * @param {AuthOptions} options
  16193. * @return {Promise} A promise that is fulfilled when the signup
  16194. * finishes.
  16195. * @see AV.User.signUp
  16196. */
  16197. signUp: function signUp(attrs, options) {
  16198. var error;
  16199. var username = attrs && attrs.username || this.get('username');
  16200. if (!username || username === '') {
  16201. error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
  16202. throw error;
  16203. }
  16204. var password = attrs && attrs.password || this.get('password');
  16205. if (!password || password === '') {
  16206. error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
  16207. throw error;
  16208. }
  16209. return this.save(attrs, options).then(function (model) {
  16210. if (model.isAnonymous()) {
  16211. model.unset("authData.".concat(PLATFORM_ANONYMOUS));
  16212. model._opSetQueue = [{}];
  16213. }
  16214. return model._handleSaveResult(true).then(function () {
  16215. return model;
  16216. });
  16217. });
  16218. },
  16219. /**
  16220. * Signs up a new user with mobile phone and sms code.
  16221. * You should call this instead of save for
  16222. * new AV.Users. This will create a new AV.User on the server, and
  16223. * also persist the session on disk so that you can access the user using
  16224. * <code>current</code>.
  16225. *
  16226. * <p>A username and password must be set before calling signUp.</p>
  16227. *
  16228. * @param {Object} attrs Extra fields to set on the new user, or null.
  16229. * @param {AuthOptions} options
  16230. * @return {Promise} A promise that is fulfilled when the signup
  16231. * finishes.
  16232. * @see AV.User.signUpOrlogInWithMobilePhone
  16233. * @see AV.Cloud.requestSmsCode
  16234. */
  16235. signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
  16236. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  16237. var error;
  16238. var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
  16239. if (!mobilePhoneNumber || mobilePhoneNumber === '') {
  16240. error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
  16241. throw error;
  16242. }
  16243. var smsCode = attrs && attrs.smsCode || this.get('smsCode');
  16244. if (!smsCode || smsCode === '') {
  16245. error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
  16246. throw error;
  16247. }
  16248. options._makeRequest = function (route, className, id, method, json) {
  16249. return AVRequest('usersByMobilePhone', null, null, 'POST', json);
  16250. };
  16251. return this.save(attrs, options).then(function (model) {
  16252. delete model.attributes.smsCode;
  16253. delete model._serverData.smsCode;
  16254. return model._handleSaveResult(true).then(function () {
  16255. return model;
  16256. });
  16257. });
  16258. },
  16259. /**
  16260. * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
  16261. * @since 3.7.0
  16262. */
  16263. loginWithAuthData: function loginWithAuthData(authData, platform, options) {
  16264. return this._linkWith(platform, authData, options);
  16265. },
  16266. /**
  16267. * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
  16268. * @since 3.7.0
  16269. */
  16270. loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
  16271. return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
  16272. },
  16273. /**
  16274. * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
  16275. * @deprecated please use {@link AV.User#loginWithMiniApp}
  16276. * @since 3.7.0
  16277. * @param {Object} [options]
  16278. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
  16279. * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
  16280. * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
  16281. * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
  16282. * @return {Promise<AV.User>}
  16283. */
  16284. loginWithWeapp: function loginWithWeapp() {
  16285. var _this7 = this;
  16286. var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  16287. _ref7$preferUnionId = _ref7.preferUnionId,
  16288. preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
  16289. _ref7$unionIdPlatform = _ref7.unionIdPlatform,
  16290. unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
  16291. _ref7$asMainAccount = _ref7.asMainAccount,
  16292. asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
  16293. _ref7$failOnNotExist = _ref7.failOnNotExist,
  16294. failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist;
  16295. var getAuthInfo = getAdapter('getAuthInfo');
  16296. return getAuthInfo({
  16297. preferUnionId: preferUnionId,
  16298. asMainAccount: asMainAccount,
  16299. platform: unionIdPlatform
  16300. }).then(function (authInfo) {
  16301. return _this7.loginWithMiniApp(authInfo, {
  16302. failOnNotExist: failOnNotExist
  16303. });
  16304. });
  16305. },
  16306. /**
  16307. * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
  16308. * @deprecated please use {@link AV.User#loginWithMiniApp}
  16309. * @since 3.13.0
  16310. */
  16311. loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
  16312. var _this8 = this;
  16313. var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  16314. _ref8$unionIdPlatform = _ref8.unionIdPlatform,
  16315. unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
  16316. _ref8$asMainAccount = _ref8.asMainAccount,
  16317. asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
  16318. _ref8$failOnNotExist = _ref8.failOnNotExist,
  16319. failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist;
  16320. var getAuthInfo = getAdapter('getAuthInfo');
  16321. return getAuthInfo({
  16322. platform: unionIdPlatform
  16323. }).then(function (authInfo) {
  16324. authInfo = AV.User.mergeUnionId(authInfo, unionId, {
  16325. asMainAccount: asMainAccount
  16326. });
  16327. return _this8.loginWithMiniApp(authInfo, {
  16328. failOnNotExist: failOnNotExist
  16329. });
  16330. });
  16331. },
  16332. /**
  16333. * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
  16334. * @deprecated please use {@link AV.User#loginWithMiniApp}
  16335. * @since 4.2.0
  16336. * @param {Object} [options]
  16337. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
  16338. * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
  16339. * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
  16340. * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
  16341. */
  16342. loginWithQQApp: function loginWithQQApp() {
  16343. var _this9 = this;
  16344. var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  16345. _ref9$preferUnionId = _ref9.preferUnionId,
  16346. preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
  16347. _ref9$unionIdPlatform = _ref9.unionIdPlatform,
  16348. unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
  16349. _ref9$asMainAccount = _ref9.asMainAccount,
  16350. asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
  16351. _ref9$failOnNotExist = _ref9.failOnNotExist,
  16352. failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist;
  16353. var getAuthInfo = getAdapter('getAuthInfo');
  16354. return getAuthInfo({
  16355. preferUnionId: preferUnionId,
  16356. asMainAccount: asMainAccount,
  16357. platform: unionIdPlatform
  16358. }).then(function (authInfo) {
  16359. authInfo.provider = PLATFORM_QQAPP;
  16360. return _this9.loginWithMiniApp(authInfo, {
  16361. failOnNotExist: failOnNotExist
  16362. });
  16363. });
  16364. },
  16365. /**
  16366. * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
  16367. * @deprecated please use {@link AV.User#loginWithMiniApp}
  16368. * @since 4.2.0
  16369. */
  16370. loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
  16371. var _this10 = this;
  16372. var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  16373. _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
  16374. unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
  16375. _ref10$asMainAccount = _ref10.asMainAccount,
  16376. asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
  16377. _ref10$failOnNotExist = _ref10.failOnNotExist,
  16378. failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist;
  16379. var getAuthInfo = getAdapter('getAuthInfo');
  16380. return getAuthInfo({
  16381. platform: unionIdPlatform
  16382. }).then(function (authInfo) {
  16383. authInfo = AV.User.mergeUnionId(authInfo, unionId, {
  16384. asMainAccount: asMainAccount
  16385. });
  16386. authInfo.provider = PLATFORM_QQAPP;
  16387. return _this10.loginWithMiniApp(authInfo, {
  16388. failOnNotExist: failOnNotExist
  16389. });
  16390. });
  16391. },
  16392. /**
  16393. * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
  16394. * @since 4.6.0
  16395. */
  16396. loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
  16397. var _this11 = this;
  16398. if (authInfo === undefined) {
  16399. var getAuthInfo = getAdapter('getAuthInfo');
  16400. return getAuthInfo().then(function (authInfo) {
  16401. return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
  16402. });
  16403. }
  16404. return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
  16405. },
  16406. /**
  16407. * Logs in a AV.User. On success, this saves the session to localStorage,
  16408. * so you can retrieve the currently logged in user using
  16409. * <code>current</code>.
  16410. *
  16411. * <p>A username and password must be set before calling logIn.</p>
  16412. *
  16413. * @see AV.User.logIn
  16414. * @return {Promise} A promise that is fulfilled with the user when
  16415. * the login is complete.
  16416. */
  16417. logIn: function logIn() {
  16418. var model = this;
  16419. var request = AVRequest('login', null, null, 'POST', this.toJSON());
  16420. return request.then(function (resp) {
  16421. var serverAttrs = model.parse(resp);
  16422. model._finishFetch(serverAttrs);
  16423. return model._handleSaveResult(true).then(function () {
  16424. if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
  16425. return model;
  16426. });
  16427. });
  16428. },
  16429. /**
  16430. * @see AV.Object#save
  16431. */
  16432. save: function save(arg1, arg2, arg3) {
  16433. var attrs, options;
  16434. if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
  16435. attrs = arg1;
  16436. options = arg2;
  16437. } else {
  16438. attrs = {};
  16439. attrs[arg1] = arg2;
  16440. options = arg3;
  16441. }
  16442. options = options || {};
  16443. return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
  16444. return model._handleSaveResult(false).then(function () {
  16445. return model;
  16446. });
  16447. });
  16448. },
  16449. /**
  16450. * Follow a user
  16451. * @since 0.3.0
  16452. * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
  16453. * @param {AV.User | String} options.user The target user or user's objectId to follow.
  16454. * @param {Object} [options.attributes] key-value attributes dictionary to be used as
  16455. * conditions of followerQuery/followeeQuery.
  16456. * @param {AuthOptions} [authOptions]
  16457. */
  16458. follow: function follow(options, authOptions) {
  16459. if (!this.id) {
  16460. throw new Error('Please signin.');
  16461. }
  16462. var user;
  16463. var attributes;
  16464. if (options.user) {
  16465. user = options.user;
  16466. attributes = options.attributes;
  16467. } else {
  16468. user = options;
  16469. }
  16470. var userObjectId = _.isString(user) ? user : user.id;
  16471. if (!userObjectId) {
  16472. throw new Error('Invalid target user.');
  16473. }
  16474. var route = 'users/' + this.id + '/friendship/' + userObjectId;
  16475. var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
  16476. return request;
  16477. },
  16478. /**
  16479. * Unfollow a user.
  16480. * @since 0.3.0
  16481. * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
  16482. * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
  16483. * @param {AuthOptions} [authOptions]
  16484. */
  16485. unfollow: function unfollow(options, authOptions) {
  16486. if (!this.id) {
  16487. throw new Error('Please signin.');
  16488. }
  16489. var user;
  16490. if (options.user) {
  16491. user = options.user;
  16492. } else {
  16493. user = options;
  16494. }
  16495. var userObjectId = _.isString(user) ? user : user.id;
  16496. if (!userObjectId) {
  16497. throw new Error('Invalid target user.');
  16498. }
  16499. var route = 'users/' + this.id + '/friendship/' + userObjectId;
  16500. var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
  16501. return request;
  16502. },
  16503. /**
  16504. * Get the user's followers and followees.
  16505. * @since 4.8.0
  16506. * @param {Object} [options]
  16507. * @param {Number} [options.skip]
  16508. * @param {Number} [options.limit]
  16509. * @param {AuthOptions} [authOptions]
  16510. */
  16511. getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
  16512. if (!this.id) {
  16513. throw new Error('Please signin.');
  16514. }
  16515. return request({
  16516. method: 'GET',
  16517. path: "/users/".concat(this.id, "/followersAndFollowees"),
  16518. query: {
  16519. skip: options && options.skip,
  16520. limit: options && options.limit,
  16521. include: 'follower,followee',
  16522. keys: 'follower,followee'
  16523. },
  16524. authOptions: authOptions
  16525. }).then(function (_ref11) {
  16526. var followers = _ref11.followers,
  16527. followees = _ref11.followees;
  16528. return {
  16529. followers: (0, _map.default)(followers).call(followers, function (_ref12) {
  16530. var follower = _ref12.follower;
  16531. return AV._decode(follower);
  16532. }),
  16533. followees: (0, _map.default)(followees).call(followees, function (_ref13) {
  16534. var followee = _ref13.followee;
  16535. return AV._decode(followee);
  16536. })
  16537. };
  16538. });
  16539. },
  16540. /**
  16541. *Create a follower query to query the user's followers.
  16542. * @since 0.3.0
  16543. * @see AV.User#followerQuery
  16544. */
  16545. followerQuery: function followerQuery() {
  16546. return AV.User.followerQuery(this.id);
  16547. },
  16548. /**
  16549. *Create a followee query to query the user's followees.
  16550. * @since 0.3.0
  16551. * @see AV.User#followeeQuery
  16552. */
  16553. followeeQuery: function followeeQuery() {
  16554. return AV.User.followeeQuery(this.id);
  16555. },
  16556. /**
  16557. * @see AV.Object#fetch
  16558. */
  16559. fetch: function fetch(fetchOptions, options) {
  16560. return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
  16561. return model._handleSaveResult(false).then(function () {
  16562. return model;
  16563. });
  16564. });
  16565. },
  16566. /**
  16567. * Update user's new password safely based on old password.
  16568. * @param {String} oldPassword the old password.
  16569. * @param {String} newPassword the new password.
  16570. * @param {AuthOptions} options
  16571. */
  16572. updatePassword: function updatePassword(oldPassword, newPassword, options) {
  16573. var _this12 = this;
  16574. var route = 'users/' + this.id + '/updatePassword';
  16575. var params = {
  16576. old_password: oldPassword,
  16577. new_password: newPassword
  16578. };
  16579. var request = AVRequest(route, null, null, 'PUT', params, options);
  16580. return request.then(function (resp) {
  16581. _this12._finishFetch(_this12.parse(resp));
  16582. return _this12._handleSaveResult(true).then(function () {
  16583. return resp;
  16584. });
  16585. });
  16586. },
  16587. /**
  16588. * Returns true if <code>current</code> would return this user.
  16589. * @see AV.User#current
  16590. */
  16591. isCurrent: function isCurrent() {
  16592. return this._isCurrentUser;
  16593. },
  16594. /**
  16595. * Returns get("username").
  16596. * @return {String}
  16597. * @see AV.Object#get
  16598. */
  16599. getUsername: function getUsername() {
  16600. return this.get('username');
  16601. },
  16602. /**
  16603. * Returns get("mobilePhoneNumber").
  16604. * @return {String}
  16605. * @see AV.Object#get
  16606. */
  16607. getMobilePhoneNumber: function getMobilePhoneNumber() {
  16608. return this.get('mobilePhoneNumber');
  16609. },
  16610. /**
  16611. * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
  16612. * @param {String} mobilePhoneNumber
  16613. * @return {Boolean}
  16614. * @see AV.Object#set
  16615. */
  16616. setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
  16617. return this.set('mobilePhoneNumber', phone, options);
  16618. },
  16619. /**
  16620. * Calls set("username", username, options) and returns the result.
  16621. * @param {String} username
  16622. * @return {Boolean}
  16623. * @see AV.Object#set
  16624. */
  16625. setUsername: function setUsername(username, options) {
  16626. return this.set('username', username, options);
  16627. },
  16628. /**
  16629. * Calls set("password", password, options) and returns the result.
  16630. * @param {String} password
  16631. * @return {Boolean}
  16632. * @see AV.Object#set
  16633. */
  16634. setPassword: function setPassword(password, options) {
  16635. return this.set('password', password, options);
  16636. },
  16637. /**
  16638. * Returns get("email").
  16639. * @return {String}
  16640. * @see AV.Object#get
  16641. */
  16642. getEmail: function getEmail() {
  16643. return this.get('email');
  16644. },
  16645. /**
  16646. * Calls set("email", email, options) and returns the result.
  16647. * @param {String} email
  16648. * @param {AuthOptions} options
  16649. * @return {Boolean}
  16650. * @see AV.Object#set
  16651. */
  16652. setEmail: function setEmail(email, options) {
  16653. return this.set('email', email, options);
  16654. },
  16655. /**
  16656. * Checks whether this user is the current user and has been authenticated.
  16657. * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
  16658. * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
  16659. * @return (Boolean) whether this user is the current user and is logged in.
  16660. */
  16661. authenticated: function authenticated() {
  16662. console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
  16663. return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
  16664. },
  16665. /**
  16666. * Detects if current sessionToken is valid.
  16667. *
  16668. * @since 2.0.0
  16669. * @return Promise.<Boolean>
  16670. */
  16671. isAuthenticated: function isAuthenticated() {
  16672. var _this13 = this;
  16673. return _promise.default.resolve().then(function () {
  16674. return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
  16675. return true;
  16676. }, function (error) {
  16677. if (error.code === 211) {
  16678. return false;
  16679. }
  16680. throw error;
  16681. });
  16682. });
  16683. },
  16684. /**
  16685. * Get sessionToken of current user.
  16686. * @return {String} sessionToken
  16687. */
  16688. getSessionToken: function getSessionToken() {
  16689. return this._sessionToken;
  16690. },
  16691. /**
  16692. * Refresh sessionToken of current user.
  16693. * @since 2.1.0
  16694. * @param {AuthOptions} [options]
  16695. * @return {Promise.<AV.User>} user with refreshed sessionToken
  16696. */
  16697. refreshSessionToken: function refreshSessionToken(options) {
  16698. var _this14 = this;
  16699. return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
  16700. _this14._finishFetch(response);
  16701. return _this14._handleSaveResult(true).then(function () {
  16702. return _this14;
  16703. });
  16704. });
  16705. },
  16706. /**
  16707. * Get this user's Roles.
  16708. * @param {AuthOptions} [options]
  16709. * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
  16710. * the query is complete.
  16711. */
  16712. getRoles: function getRoles(options) {
  16713. var _context;
  16714. return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
  16715. }
  16716. },
  16717. /** @lends AV.User */
  16718. {
  16719. // Class Variables
  16720. // The currently logged-in user.
  16721. _currentUser: null,
  16722. // Whether currentUser is known to match the serialized version on disk.
  16723. // This is useful for saving a localstorage check if you try to load
  16724. // _currentUser frequently while there is none stored.
  16725. _currentUserMatchesDisk: false,
  16726. // The localStorage key suffix that the current user is stored under.
  16727. _CURRENT_USER_KEY: 'currentUser',
  16728. // The mapping of auth provider names to actual providers
  16729. _authProviders: {},
  16730. // Class Methods
  16731. /**
  16732. * Signs up a new user with a username (or email) and password.
  16733. * This will create a new AV.User on the server, and also persist the
  16734. * session in localStorage so that you can access the user using
  16735. * {@link #current}.
  16736. *
  16737. * @param {String} username The username (or email) to sign up with.
  16738. * @param {String} password The password to sign up with.
  16739. * @param {Object} [attrs] Extra fields to set on the new user.
  16740. * @param {AuthOptions} [options]
  16741. * @return {Promise} A promise that is fulfilled with the user when
  16742. * the signup completes.
  16743. * @see AV.User#signUp
  16744. */
  16745. signUp: function signUp(username, password, attrs, options) {
  16746. attrs = attrs || {};
  16747. attrs.username = username;
  16748. attrs.password = password;
  16749. var user = AV.Object._create('_User');
  16750. return user.signUp(attrs, options);
  16751. },
  16752. /**
  16753. * Logs in a user with a username (or email) and password. On success, this
  16754. * saves the session to disk, so you can retrieve the currently logged in
  16755. * user using <code>current</code>.
  16756. *
  16757. * @param {String} username The username (or email) to log in with.
  16758. * @param {String} password The password to log in with.
  16759. * @return {Promise} A promise that is fulfilled with the user when
  16760. * the login completes.
  16761. * @see AV.User#logIn
  16762. */
  16763. logIn: function logIn(username, password) {
  16764. var user = AV.Object._create('_User');
  16765. user._finishFetch({
  16766. username: username,
  16767. password: password
  16768. });
  16769. return user.logIn();
  16770. },
  16771. /**
  16772. * Logs in a user with a session token. On success, this saves the session
  16773. * to disk, so you can retrieve the currently logged in user using
  16774. * <code>current</code>.
  16775. *
  16776. * @param {String} sessionToken The sessionToken to log in with.
  16777. * @return {Promise} A promise that is fulfilled with the user when
  16778. * the login completes.
  16779. */
  16780. become: function become(sessionToken) {
  16781. return this._fetchUserBySessionToken(sessionToken).then(function (user) {
  16782. return user._handleSaveResult(true).then(function () {
  16783. return user;
  16784. });
  16785. });
  16786. },
  16787. _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
  16788. if (sessionToken === undefined) {
  16789. return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
  16790. }
  16791. var user = AV.Object._create('_User');
  16792. return request({
  16793. method: 'GET',
  16794. path: '/users/me',
  16795. authOptions: {
  16796. sessionToken: sessionToken
  16797. }
  16798. }).then(function (resp) {
  16799. var serverAttrs = user.parse(resp);
  16800. user._finishFetch(serverAttrs);
  16801. return user;
  16802. });
  16803. },
  16804. /**
  16805. * Logs in a user with a mobile phone number and sms code sent by
  16806. * AV.User.requestLoginSmsCode.On success, this
  16807. * saves the session to disk, so you can retrieve the currently logged in
  16808. * user using <code>current</code>.
  16809. *
  16810. * @param {String} mobilePhone The user's mobilePhoneNumber
  16811. * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
  16812. * @return {Promise} A promise that is fulfilled with the user when
  16813. * the login completes.
  16814. * @see AV.User#logIn
  16815. */
  16816. logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
  16817. var user = AV.Object._create('_User');
  16818. user._finishFetch({
  16819. mobilePhoneNumber: mobilePhone,
  16820. smsCode: smsCode
  16821. });
  16822. return user.logIn();
  16823. },
  16824. /**
  16825. * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
  16826. * On success, this saves the session to disk, so you can retrieve the currently
  16827. * logged in user using <code>current</code>.
  16828. *
  16829. * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
  16830. * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
  16831. * @param {Object} attributes The user's other attributes such as username etc.
  16832. * @param {AuthOptions} options
  16833. * @return {Promise} A promise that is fulfilled with the user when
  16834. * the login completes.
  16835. * @see AV.User#signUpOrlogInWithMobilePhone
  16836. * @see AV.Cloud.requestSmsCode
  16837. */
  16838. signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
  16839. attrs = attrs || {};
  16840. attrs.mobilePhoneNumber = mobilePhoneNumber;
  16841. attrs.smsCode = smsCode;
  16842. var user = AV.Object._create('_User');
  16843. return user.signUpOrlogInWithMobilePhone(attrs, options);
  16844. },
  16845. /**
  16846. * Logs in a user with a mobile phone number and password. On success, this
  16847. * saves the session to disk, so you can retrieve the currently logged in
  16848. * user using <code>current</code>.
  16849. *
  16850. * @param {String} mobilePhone The user's mobilePhoneNumber
  16851. * @param {String} password The password to log in with.
  16852. * @return {Promise} A promise that is fulfilled with the user when
  16853. * the login completes.
  16854. * @see AV.User#logIn
  16855. */
  16856. logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
  16857. var user = AV.Object._create('_User');
  16858. user._finishFetch({
  16859. mobilePhoneNumber: mobilePhone,
  16860. password: password
  16861. });
  16862. return user.logIn();
  16863. },
  16864. /**
  16865. * Logs in a user with email and password.
  16866. *
  16867. * @since 3.13.0
  16868. * @param {String} email The user's email.
  16869. * @param {String} password The password to log in with.
  16870. * @return {Promise} A promise that is fulfilled with the user when
  16871. * the login completes.
  16872. */
  16873. loginWithEmail: function loginWithEmail(email, password) {
  16874. var user = AV.Object._create('_User');
  16875. user._finishFetch({
  16876. email: email,
  16877. password: password
  16878. });
  16879. return user.logIn();
  16880. },
  16881. /**
  16882. * Signs up or logs in a user with a third party auth data(AccessToken).
  16883. * On success, this saves the session to disk, so you can retrieve the currently
  16884. * logged in user using <code>current</code>.
  16885. *
  16886. * @since 3.7.0
  16887. * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
  16888. * @param {string} platform Available platform for sign up.
  16889. * @param {Object} [options]
  16890. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
  16891. * @return {Promise} A promise that is fulfilled with the user when
  16892. * the login completes.
  16893. * @example AV.User.loginWithAuthData({
  16894. * openid: 'abc123',
  16895. * access_token: '123abc',
  16896. * expires_in: 1382686496
  16897. * }, 'weixin').then(function(user) {
  16898. * //Access user here
  16899. * }).catch(function(error) {
  16900. * //console.error("error: ", error);
  16901. * });
  16902. * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
  16903. */
  16904. loginWithAuthData: function loginWithAuthData(authData, platform, options) {
  16905. return AV.User._logInWith(platform, authData, options);
  16906. },
  16907. /**
  16908. * @deprecated renamed to {@link AV.User.loginWithAuthData}
  16909. */
  16910. signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
  16911. console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
  16912. return this.loginWithAuthData.apply(this, arguments);
  16913. },
  16914. /**
  16915. * Signs up or logs in a user with a third party authData and unionId.
  16916. * @since 3.7.0
  16917. * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
  16918. * @param {string} platform Available platform for sign up.
  16919. * @param {string} unionId
  16920. * @param {Object} [unionLoginOptions]
  16921. * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
  16922. * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
  16923. * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
  16924. * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
  16925. * @example AV.User.loginWithAuthDataAndUnionId({
  16926. * openid: 'abc123',
  16927. * access_token: '123abc',
  16928. * expires_in: 1382686496
  16929. * }, 'weixin', 'union123', {
  16930. * unionIdPlatform: 'weixin',
  16931. * asMainAccount: true,
  16932. * }).then(function(user) {
  16933. * //Access user here
  16934. * }).catch(function(error) {
  16935. * //console.error("error: ", error);
  16936. * });
  16937. */
  16938. loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
  16939. return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
  16940. },
  16941. /**
  16942. * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
  16943. * @since 3.5.0
  16944. */
  16945. signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
  16946. console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
  16947. return this.loginWithAuthDataAndUnionId.apply(this, arguments);
  16948. },
  16949. /**
  16950. * Merge unionId into authInfo.
  16951. * @since 4.6.0
  16952. * @param {Object} authInfo
  16953. * @param {String} unionId
  16954. * @param {Object} [unionIdOption]
  16955. * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
  16956. */
  16957. mergeUnionId: function mergeUnionId(authInfo, unionId) {
  16958. var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  16959. _ref14$asMainAccount = _ref14.asMainAccount,
  16960. asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
  16961. authInfo = JSON.parse((0, _stringify.default)(authInfo));
  16962. var _authInfo = authInfo,
  16963. authData = _authInfo.authData,
  16964. platform = _authInfo.platform;
  16965. authData.platform = platform;
  16966. authData.main_account = asMainAccount;
  16967. authData.unionid = unionId;
  16968. return authInfo;
  16969. },
  16970. /**
  16971. * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
  16972. * 仅在微信小程序中可用。
  16973. *
  16974. * @deprecated please use {@link AV.User.loginWithMiniApp}
  16975. * @since 2.0.0
  16976. * @param {Object} [options]
  16977. * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
  16978. * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
  16979. * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
  16980. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
  16981. * @return {Promise.<AV.User>}
  16982. */
  16983. loginWithWeapp: function loginWithWeapp() {
  16984. var _this15 = this;
  16985. var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  16986. _ref15$preferUnionId = _ref15.preferUnionId,
  16987. preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
  16988. _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
  16989. unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
  16990. _ref15$asMainAccount = _ref15.asMainAccount,
  16991. asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
  16992. _ref15$failOnNotExist = _ref15.failOnNotExist,
  16993. failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist;
  16994. var getAuthInfo = getAdapter('getAuthInfo');
  16995. return getAuthInfo({
  16996. preferUnionId: preferUnionId,
  16997. asMainAccount: asMainAccount,
  16998. platform: unionIdPlatform
  16999. }).then(function (authInfo) {
  17000. return _this15.loginWithMiniApp(authInfo, {
  17001. failOnNotExist: failOnNotExist
  17002. });
  17003. });
  17004. },
  17005. /**
  17006. * 使用当前使用微信小程序的微信用户身份注册或登录,
  17007. * 仅在微信小程序中可用。
  17008. *
  17009. * @deprecated please use {@link AV.User.loginWithMiniApp}
  17010. * @since 3.13.0
  17011. * @param {Object} [unionLoginOptions]
  17012. * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
  17013. * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
  17014. * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
  17015. */
  17016. loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
  17017. var _this16 = this;
  17018. var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  17019. _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
  17020. unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
  17021. _ref16$asMainAccount = _ref16.asMainAccount,
  17022. asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
  17023. _ref16$failOnNotExist = _ref16.failOnNotExist,
  17024. failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist;
  17025. var getAuthInfo = getAdapter('getAuthInfo');
  17026. return getAuthInfo({
  17027. platform: unionIdPlatform
  17028. }).then(function (authInfo) {
  17029. authInfo = AV.User.mergeUnionId(authInfo, unionId, {
  17030. asMainAccount: asMainAccount
  17031. });
  17032. return _this16.loginWithMiniApp(authInfo, {
  17033. failOnNotExist: failOnNotExist
  17034. });
  17035. });
  17036. },
  17037. /**
  17038. * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
  17039. * 仅在 QQ 小程序中可用。
  17040. *
  17041. * @deprecated please use {@link AV.User.loginWithMiniApp}
  17042. * @since 4.2.0
  17043. * @param {Object} [options]
  17044. * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
  17045. * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
  17046. * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
  17047. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
  17048. * @return {Promise.<AV.User>}
  17049. */
  17050. loginWithQQApp: function loginWithQQApp() {
  17051. var _this17 = this;
  17052. var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  17053. _ref17$preferUnionId = _ref17.preferUnionId,
  17054. preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
  17055. _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
  17056. unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
  17057. _ref17$asMainAccount = _ref17.asMainAccount,
  17058. asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
  17059. _ref17$failOnNotExist = _ref17.failOnNotExist,
  17060. failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist;
  17061. var getAuthInfo = getAdapter('getAuthInfo');
  17062. return getAuthInfo({
  17063. preferUnionId: preferUnionId,
  17064. asMainAccount: asMainAccount,
  17065. platform: unionIdPlatform
  17066. }).then(function (authInfo) {
  17067. authInfo.provider = PLATFORM_QQAPP;
  17068. return _this17.loginWithMiniApp(authInfo, {
  17069. failOnNotExist: failOnNotExist
  17070. });
  17071. });
  17072. },
  17073. /**
  17074. * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
  17075. * 仅在 QQ 小程序中可用。
  17076. *
  17077. * @deprecated please use {@link AV.User.loginWithMiniApp}
  17078. * @since 4.2.0
  17079. * @param {Object} [unionLoginOptions]
  17080. * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
  17081. * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
  17082. * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
  17083. * @return {Promise.<AV.User>}
  17084. */
  17085. loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
  17086. var _this18 = this;
  17087. var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  17088. _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
  17089. unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
  17090. _ref18$asMainAccount = _ref18.asMainAccount,
  17091. asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
  17092. _ref18$failOnNotExist = _ref18.failOnNotExist,
  17093. failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist;
  17094. var getAuthInfo = getAdapter('getAuthInfo');
  17095. return getAuthInfo({
  17096. platform: unionIdPlatform
  17097. }).then(function (authInfo) {
  17098. authInfo = AV.User.mergeUnionId(authInfo, unionId, {
  17099. asMainAccount: asMainAccount
  17100. });
  17101. authInfo.provider = PLATFORM_QQAPP;
  17102. return _this18.loginWithMiniApp(authInfo, {
  17103. failOnNotExist: failOnNotExist
  17104. });
  17105. });
  17106. },
  17107. /**
  17108. * Register or login using the identity of the current mini-app.
  17109. * @param {Object} authInfo
  17110. * @param {Object} [option]
  17111. * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
  17112. */
  17113. loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
  17114. var _this19 = this;
  17115. if (authInfo === undefined) {
  17116. var getAuthInfo = getAdapter('getAuthInfo');
  17117. return getAuthInfo().then(function (authInfo) {
  17118. return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
  17119. });
  17120. }
  17121. return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
  17122. },
  17123. /**
  17124. * Only use for DI in tests to produce deterministic IDs.
  17125. */
  17126. _genId: function _genId() {
  17127. return uuid();
  17128. },
  17129. /**
  17130. * Creates an anonymous user.
  17131. *
  17132. * @since 3.9.0
  17133. * @return {Promise.<AV.User>}
  17134. */
  17135. loginAnonymously: function loginAnonymously() {
  17136. return this.loginWithAuthData({
  17137. id: AV.User._genId()
  17138. }, 'anonymous');
  17139. },
  17140. associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
  17141. console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
  17142. return userObj._linkWith(platform, authData);
  17143. },
  17144. /**
  17145. * Logs out the currently logged in user session. This will remove the
  17146. * session from disk, log out of linked services, and future calls to
  17147. * <code>current</code> will return <code>null</code>.
  17148. * @return {Promise}
  17149. */
  17150. logOut: function logOut() {
  17151. if (AV._config.disableCurrentUser) {
  17152. console.warn('AV.User.current() was disabled in multi-user environment, call logOut() from user object instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
  17153. return _promise.default.resolve(null);
  17154. }
  17155. if (AV.User._currentUser !== null) {
  17156. AV.User._currentUser._logOutWithAll();
  17157. AV.User._currentUser._isCurrentUser = false;
  17158. }
  17159. AV.User._currentUserMatchesDisk = true;
  17160. AV.User._currentUser = null;
  17161. return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
  17162. return AV._refreshSubscriptionId();
  17163. });
  17164. },
  17165. /**
  17166. *Create a follower query for special user to query the user's followers.
  17167. * @param {String} userObjectId The user object id.
  17168. * @return {AV.FriendShipQuery}
  17169. * @since 0.3.0
  17170. */
  17171. followerQuery: function followerQuery(userObjectId) {
  17172. if (!userObjectId || !_.isString(userObjectId)) {
  17173. throw new Error('Invalid user object id.');
  17174. }
  17175. var query = new AV.FriendShipQuery('_Follower');
  17176. query._friendshipTag = 'follower';
  17177. query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
  17178. return query;
  17179. },
  17180. /**
  17181. *Create a followee query for special user to query the user's followees.
  17182. * @param {String} userObjectId The user object id.
  17183. * @return {AV.FriendShipQuery}
  17184. * @since 0.3.0
  17185. */
  17186. followeeQuery: function followeeQuery(userObjectId) {
  17187. if (!userObjectId || !_.isString(userObjectId)) {
  17188. throw new Error('Invalid user object id.');
  17189. }
  17190. var query = new AV.FriendShipQuery('_Followee');
  17191. query._friendshipTag = 'followee';
  17192. query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
  17193. return query;
  17194. },
  17195. /**
  17196. * Requests a password reset email to be sent to the specified email address
  17197. * associated with the user account. This email allows the user to securely
  17198. * reset their password on the AV site.
  17199. *
  17200. * @param {String} email The email address associated with the user that
  17201. * forgot their password.
  17202. * @return {Promise}
  17203. */
  17204. requestPasswordReset: function requestPasswordReset(email) {
  17205. var json = {
  17206. email: email
  17207. };
  17208. var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
  17209. return request;
  17210. },
  17211. /**
  17212. * Requests a verify email to be sent to the specified email address
  17213. * associated with the user account. This email allows the user to securely
  17214. * verify their email address on the AV site.
  17215. *
  17216. * @param {String} email The email address associated with the user that
  17217. * doesn't verify their email address.
  17218. * @return {Promise}
  17219. */
  17220. requestEmailVerify: function requestEmailVerify(email) {
  17221. var json = {
  17222. email: email
  17223. };
  17224. var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
  17225. return request;
  17226. },
  17227. /**
  17228. * Requests a verify sms code to be sent to the specified mobile phone
  17229. * number associated with the user account. This sms code allows the user to
  17230. * verify their mobile phone number by calling AV.User.verifyMobilePhone
  17231. *
  17232. * @param {String} mobilePhoneNumber The mobile phone number associated with the
  17233. * user that doesn't verify their mobile phone number.
  17234. * @param {SMSAuthOptions} [options]
  17235. * @return {Promise}
  17236. */
  17237. requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
  17238. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17239. var data = {
  17240. mobilePhoneNumber: mobilePhoneNumber
  17241. };
  17242. if (options.validateToken) {
  17243. data.validate_token = options.validateToken;
  17244. }
  17245. var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
  17246. return request;
  17247. },
  17248. /**
  17249. * Requests a reset password sms code to be sent to the specified mobile phone
  17250. * number associated with the user account. This sms code allows the user to
  17251. * reset their account's password by calling AV.User.resetPasswordBySmsCode
  17252. *
  17253. * @param {String} mobilePhoneNumber The mobile phone number associated with the
  17254. * user that doesn't verify their mobile phone number.
  17255. * @param {SMSAuthOptions} [options]
  17256. * @return {Promise}
  17257. */
  17258. requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
  17259. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17260. var data = {
  17261. mobilePhoneNumber: mobilePhoneNumber
  17262. };
  17263. if (options.validateToken) {
  17264. data.validate_token = options.validateToken;
  17265. }
  17266. var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
  17267. return request;
  17268. },
  17269. /**
  17270. * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
  17271. * This sms code allows current user to reset it's mobilePhoneNumber by
  17272. * calling {@link AV.User.changePhoneNumber}
  17273. * @since 4.7.0
  17274. * @param {String} mobilePhoneNumber
  17275. * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
  17276. * @param {SMSAuthOptions} [options]
  17277. * @return {Promise}
  17278. */
  17279. requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
  17280. var data = {
  17281. mobilePhoneNumber: mobilePhoneNumber
  17282. };
  17283. if (ttl) {
  17284. data.ttl = options.ttl;
  17285. }
  17286. if (options && options.validateToken) {
  17287. data.validate_token = options.validateToken;
  17288. }
  17289. return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
  17290. },
  17291. /**
  17292. * Makes a call to reset user's account mobilePhoneNumber by sms code.
  17293. * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
  17294. * @since 4.7.0
  17295. * @param {String} mobilePhoneNumber
  17296. * @param {String} code The sms code.
  17297. * @return {Promise}
  17298. */
  17299. changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
  17300. var data = {
  17301. mobilePhoneNumber: mobilePhoneNumber,
  17302. code: code
  17303. };
  17304. return AVRequest('changePhoneNumber', null, null, 'POST', data);
  17305. },
  17306. /**
  17307. * Makes a call to reset user's account password by sms code and new password.
  17308. * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
  17309. * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
  17310. * @param {String} password The new password.
  17311. * @return {Promise} A promise that will be resolved with the result
  17312. * of the function.
  17313. */
  17314. resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
  17315. var json = {
  17316. password: password
  17317. };
  17318. var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
  17319. return request;
  17320. },
  17321. /**
  17322. * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
  17323. * If verify successfully,the user mobilePhoneVerified attribute will be true.
  17324. * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
  17325. * @return {Promise} A promise that will be resolved with the result
  17326. * of the function.
  17327. */
  17328. verifyMobilePhone: function verifyMobilePhone(code) {
  17329. var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
  17330. return request;
  17331. },
  17332. /**
  17333. * Requests a logIn sms code to be sent to the specified mobile phone
  17334. * number associated with the user account. This sms code allows the user to
  17335. * login by AV.User.logInWithMobilePhoneSmsCode function.
  17336. *
  17337. * @param {String} mobilePhoneNumber The mobile phone number associated with the
  17338. * user that want to login by AV.User.logInWithMobilePhoneSmsCode
  17339. * @param {SMSAuthOptions} [options]
  17340. * @return {Promise}
  17341. */
  17342. requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
  17343. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17344. var data = {
  17345. mobilePhoneNumber: mobilePhoneNumber
  17346. };
  17347. if (options.validateToken) {
  17348. data.validate_token = options.validateToken;
  17349. }
  17350. var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
  17351. return request;
  17352. },
  17353. /**
  17354. * Retrieves the currently logged in AVUser with a valid session,
  17355. * either from memory or localStorage, if necessary.
  17356. * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
  17357. */
  17358. currentAsync: function currentAsync() {
  17359. if (AV._config.disableCurrentUser) {
  17360. console.warn('AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
  17361. return _promise.default.resolve(null);
  17362. }
  17363. if (AV.User._currentUser) {
  17364. return _promise.default.resolve(AV.User._currentUser);
  17365. }
  17366. if (AV.User._currentUserMatchesDisk) {
  17367. return _promise.default.resolve(AV.User._currentUser);
  17368. }
  17369. return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
  17370. if (!userData) {
  17371. return null;
  17372. } // Load the user from local storage.
  17373. AV.User._currentUserMatchesDisk = true;
  17374. AV.User._currentUser = AV.Object._create('_User');
  17375. AV.User._currentUser._isCurrentUser = true;
  17376. var json = JSON.parse(userData);
  17377. AV.User._currentUser.id = json._id;
  17378. delete json._id;
  17379. AV.User._currentUser._sessionToken = json._sessionToken;
  17380. delete json._sessionToken;
  17381. AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
  17382. AV.User._currentUser._synchronizeAllAuthData();
  17383. AV.User._currentUser._refreshCache();
  17384. AV.User._currentUser._opSetQueue = [{}];
  17385. return AV.User._currentUser;
  17386. });
  17387. },
  17388. /**
  17389. * Retrieves the currently logged in AVUser with a valid session,
  17390. * either from memory or localStorage, if necessary.
  17391. * @return {AV.User} The currently logged in AV.User.
  17392. */
  17393. current: function current() {
  17394. if (AV._config.disableCurrentUser) {
  17395. console.warn('AV.User.current() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
  17396. return null;
  17397. }
  17398. if (AV.localStorage.async) {
  17399. var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
  17400. error.code = 'SYNC_API_NOT_AVAILABLE';
  17401. throw error;
  17402. }
  17403. if (AV.User._currentUser) {
  17404. return AV.User._currentUser;
  17405. }
  17406. if (AV.User._currentUserMatchesDisk) {
  17407. return AV.User._currentUser;
  17408. } // Load the user from local storage.
  17409. AV.User._currentUserMatchesDisk = true;
  17410. var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
  17411. if (!userData) {
  17412. return null;
  17413. }
  17414. AV.User._currentUser = AV.Object._create('_User');
  17415. AV.User._currentUser._isCurrentUser = true;
  17416. var json = JSON.parse(userData);
  17417. AV.User._currentUser.id = json._id;
  17418. delete json._id;
  17419. AV.User._currentUser._sessionToken = json._sessionToken;
  17420. delete json._sessionToken;
  17421. AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
  17422. AV.User._currentUser._synchronizeAllAuthData();
  17423. AV.User._currentUser._refreshCache();
  17424. AV.User._currentUser._opSetQueue = [{}];
  17425. return AV.User._currentUser;
  17426. },
  17427. /**
  17428. * Persists a user as currentUser to localStorage, and into the singleton.
  17429. * @private
  17430. */
  17431. _saveCurrentUser: function _saveCurrentUser(user) {
  17432. var promise;
  17433. if (AV.User._currentUser !== user) {
  17434. promise = AV.User.logOut();
  17435. } else {
  17436. promise = _promise.default.resolve();
  17437. }
  17438. return promise.then(function () {
  17439. user._isCurrentUser = true;
  17440. AV.User._currentUser = user;
  17441. var json = user._toFullJSON();
  17442. json._id = user.id;
  17443. json._sessionToken = user._sessionToken;
  17444. return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
  17445. AV.User._currentUserMatchesDisk = true;
  17446. return AV._refreshSubscriptionId();
  17447. });
  17448. });
  17449. },
  17450. _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
  17451. AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
  17452. if (!AV._config.disableCurrentUser && AV.User.current()) {
  17453. AV.User.current()._synchronizeAuthData(provider.getAuthType());
  17454. }
  17455. },
  17456. _logInWith: function _logInWith(provider, authData, options) {
  17457. var user = AV.Object._create('_User');
  17458. return user._linkWith(provider, authData, options);
  17459. }
  17460. });
  17461. };
  17462. /***/ }),
  17463. /* 557 */
  17464. /***/ (function(module, exports, __webpack_require__) {
  17465. var _Object$defineProperty = __webpack_require__(150);
  17466. function _defineProperty(obj, key, value) {
  17467. if (key in obj) {
  17468. _Object$defineProperty(obj, key, {
  17469. value: value,
  17470. enumerable: true,
  17471. configurable: true,
  17472. writable: true
  17473. });
  17474. } else {
  17475. obj[key] = value;
  17476. }
  17477. return obj;
  17478. }
  17479. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  17480. /***/ }),
  17481. /* 558 */
  17482. /***/ (function(module, exports, __webpack_require__) {
  17483. "use strict";
  17484. var _interopRequireDefault = __webpack_require__(1);
  17485. var _map = _interopRequireDefault(__webpack_require__(35));
  17486. var _promise = _interopRequireDefault(__webpack_require__(12));
  17487. var _keys = _interopRequireDefault(__webpack_require__(59));
  17488. var _stringify = _interopRequireDefault(__webpack_require__(36));
  17489. var _find = _interopRequireDefault(__webpack_require__(93));
  17490. var _concat = _interopRequireDefault(__webpack_require__(22));
  17491. var _ = __webpack_require__(3);
  17492. var debug = __webpack_require__(60)('leancloud:query');
  17493. var AVError = __webpack_require__(46);
  17494. var _require = __webpack_require__(27),
  17495. _request = _require._request,
  17496. request = _require.request;
  17497. var _require2 = __webpack_require__(30),
  17498. ensureArray = _require2.ensureArray,
  17499. transformFetchOptions = _require2.transformFetchOptions,
  17500. continueWhile = _require2.continueWhile;
  17501. var requires = function requires(value, message) {
  17502. if (value === undefined) {
  17503. throw new Error(message);
  17504. }
  17505. }; // AV.Query is a way to create a list of AV.Objects.
  17506. module.exports = function (AV) {
  17507. /**
  17508. * Creates a new AV.Query for the given AV.Object subclass.
  17509. * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
  17510. * @class
  17511. *
  17512. * <p>AV.Query defines a query that is used to fetch AV.Objects. The
  17513. * most common use case is finding all objects that match a query through the
  17514. * <code>find</code> method. For example, this sample code fetches all objects
  17515. * of class <code>MyClass</code>. It calls a different function depending on
  17516. * whether the fetch succeeded or not.
  17517. *
  17518. * <pre>
  17519. * var query = new AV.Query(MyClass);
  17520. * query.find().then(function(results) {
  17521. * // results is an array of AV.Object.
  17522. * }, function(error) {
  17523. * // error is an instance of AVError.
  17524. * });</pre></p>
  17525. *
  17526. * <p>An AV.Query can also be used to retrieve a single object whose id is
  17527. * known, through the get method. For example, this sample code fetches an
  17528. * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
  17529. * different function depending on whether the fetch succeeded or not.
  17530. *
  17531. * <pre>
  17532. * var query = new AV.Query(MyClass);
  17533. * query.get(myId).then(function(object) {
  17534. * // object is an instance of AV.Object.
  17535. * }, function(error) {
  17536. * // error is an instance of AVError.
  17537. * });</pre></p>
  17538. *
  17539. * <p>An AV.Query can also be used to count the number of objects that match
  17540. * the query without retrieving all of those objects. For example, this
  17541. * sample code counts the number of objects of the class <code>MyClass</code>
  17542. * <pre>
  17543. * var query = new AV.Query(MyClass);
  17544. * query.count().then(function(number) {
  17545. * // There are number instances of MyClass.
  17546. * }, function(error) {
  17547. * // error is an instance of AVError.
  17548. * });</pre></p>
  17549. */
  17550. AV.Query = function (objectClass) {
  17551. if (_.isString(objectClass)) {
  17552. objectClass = AV.Object._getSubclass(objectClass);
  17553. }
  17554. this.objectClass = objectClass;
  17555. this.className = objectClass.prototype.className;
  17556. this._where = {};
  17557. this._include = [];
  17558. this._select = [];
  17559. this._limit = -1; // negative limit means, do not send a limit
  17560. this._skip = 0;
  17561. this._defaultParams = {};
  17562. };
  17563. /**
  17564. * Constructs a AV.Query that is the OR of the passed in queries. For
  17565. * example:
  17566. * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
  17567. *
  17568. * will create a compoundQuery that is an or of the query1, query2, and
  17569. * query3.
  17570. * @param {...AV.Query} var_args The list of queries to OR.
  17571. * @return {AV.Query} The query that is the OR of the passed in queries.
  17572. */
  17573. AV.Query.or = function () {
  17574. var queries = _.toArray(arguments);
  17575. var className = null;
  17576. AV._arrayEach(queries, function (q) {
  17577. if (_.isNull(className)) {
  17578. className = q.className;
  17579. }
  17580. if (className !== q.className) {
  17581. throw new Error('All queries must be for the same class');
  17582. }
  17583. });
  17584. var query = new AV.Query(className);
  17585. query._orQuery(queries);
  17586. return query;
  17587. };
  17588. /**
  17589. * Constructs a AV.Query that is the AND of the passed in queries. For
  17590. * example:
  17591. * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
  17592. *
  17593. * will create a compoundQuery that is an 'and' of the query1, query2, and
  17594. * query3.
  17595. * @param {...AV.Query} var_args The list of queries to AND.
  17596. * @return {AV.Query} The query that is the AND of the passed in queries.
  17597. */
  17598. AV.Query.and = function () {
  17599. var queries = _.toArray(arguments);
  17600. var className = null;
  17601. AV._arrayEach(queries, function (q) {
  17602. if (_.isNull(className)) {
  17603. className = q.className;
  17604. }
  17605. if (className !== q.className) {
  17606. throw new Error('All queries must be for the same class');
  17607. }
  17608. });
  17609. var query = new AV.Query(className);
  17610. query._andQuery(queries);
  17611. return query;
  17612. };
  17613. /**
  17614. * Retrieves a list of AVObjects that satisfy the CQL.
  17615. * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
  17616. *
  17617. * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
  17618. * @param {Array} pvalues An array contains placeholder values.
  17619. * @param {AuthOptions} options
  17620. * @return {Promise} A promise that is resolved with the results when
  17621. * the query completes.
  17622. */
  17623. AV.Query.doCloudQuery = function (cql, pvalues, options) {
  17624. var params = {
  17625. cql: cql
  17626. };
  17627. if (_.isArray(pvalues)) {
  17628. params.pvalues = pvalues;
  17629. } else {
  17630. options = pvalues;
  17631. }
  17632. var request = _request('cloudQuery', null, null, 'GET', params, options);
  17633. return request.then(function (response) {
  17634. //query to process results.
  17635. var query = new AV.Query(response.className);
  17636. var results = (0, _map.default)(_).call(_, response.results, function (json) {
  17637. var obj = query._newObject(response);
  17638. if (obj._finishFetch) {
  17639. obj._finishFetch(query._processResult(json), true);
  17640. }
  17641. return obj;
  17642. });
  17643. return {
  17644. results: results,
  17645. count: response.count,
  17646. className: response.className
  17647. };
  17648. });
  17649. };
  17650. /**
  17651. * Return a query with conditions from json.
  17652. * This can be useful to send a query from server side to client side.
  17653. * @since 4.0.0
  17654. * @param {Object} json from {@link AV.Query#toJSON}
  17655. * @return {AV.Query}
  17656. */
  17657. AV.Query.fromJSON = function (_ref) {
  17658. var className = _ref.className,
  17659. where = _ref.where,
  17660. include = _ref.include,
  17661. select = _ref.select,
  17662. includeACL = _ref.includeACL,
  17663. limit = _ref.limit,
  17664. skip = _ref.skip,
  17665. order = _ref.order;
  17666. if (typeof className !== 'string') {
  17667. throw new TypeError('Invalid Query JSON, className must be a String.');
  17668. }
  17669. var query = new AV.Query(className);
  17670. _.extend(query, {
  17671. _where: where,
  17672. _include: include,
  17673. _select: select,
  17674. _includeACL: includeACL,
  17675. _limit: limit,
  17676. _skip: skip,
  17677. _order: order
  17678. });
  17679. return query;
  17680. };
  17681. AV.Query._extend = AV._extend;
  17682. _.extend(AV.Query.prototype,
  17683. /** @lends AV.Query.prototype */
  17684. {
  17685. //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
  17686. _processResult: function _processResult(obj) {
  17687. return obj;
  17688. },
  17689. /**
  17690. * Constructs an AV.Object whose id is already known by fetching data from
  17691. * the server.
  17692. *
  17693. * @param {String} objectId The id of the object to be fetched.
  17694. * @param {AuthOptions} options
  17695. * @return {Promise.<AV.Object>}
  17696. */
  17697. get: function get(objectId, options) {
  17698. if (!_.isString(objectId)) {
  17699. throw new Error('objectId must be a string');
  17700. }
  17701. if (objectId === '') {
  17702. return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
  17703. }
  17704. var obj = this._newObject();
  17705. obj.id = objectId;
  17706. var queryJSON = this._getParams();
  17707. var fetchOptions = {};
  17708. if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
  17709. if (queryJSON.include) fetchOptions.include = queryJSON.include;
  17710. if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
  17711. return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
  17712. if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
  17713. obj._finishFetch(obj.parse(response), true);
  17714. return obj;
  17715. });
  17716. },
  17717. /**
  17718. * Returns a JSON representation of this query.
  17719. * @return {Object}
  17720. */
  17721. toJSON: function toJSON() {
  17722. var className = this.className,
  17723. where = this._where,
  17724. include = this._include,
  17725. select = this._select,
  17726. includeACL = this._includeACL,
  17727. limit = this._limit,
  17728. skip = this._skip,
  17729. order = this._order;
  17730. return {
  17731. className: className,
  17732. where: where,
  17733. include: include,
  17734. select: select,
  17735. includeACL: includeACL,
  17736. limit: limit,
  17737. skip: skip,
  17738. order: order
  17739. };
  17740. },
  17741. _getParams: function _getParams() {
  17742. var params = _.extend({}, this._defaultParams, {
  17743. where: this._where
  17744. });
  17745. if (this._include.length > 0) {
  17746. params.include = this._include.join(',');
  17747. }
  17748. if (this._select.length > 0) {
  17749. params.keys = this._select.join(',');
  17750. }
  17751. if (this._includeACL !== undefined) {
  17752. params.returnACL = this._includeACL;
  17753. }
  17754. if (this._limit >= 0) {
  17755. params.limit = this._limit;
  17756. }
  17757. if (this._skip > 0) {
  17758. params.skip = this._skip;
  17759. }
  17760. if (this._order !== undefined) {
  17761. params.order = this._order;
  17762. }
  17763. return params;
  17764. },
  17765. _newObject: function _newObject(response) {
  17766. var obj;
  17767. if (response && response.className) {
  17768. obj = new AV.Object(response.className);
  17769. } else {
  17770. obj = new this.objectClass();
  17771. }
  17772. return obj;
  17773. },
  17774. _createRequest: function _createRequest() {
  17775. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
  17776. var options = arguments.length > 1 ? arguments[1] : undefined;
  17777. var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
  17778. if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
  17779. var body = {
  17780. requests: [{
  17781. method: 'GET',
  17782. path: "/1.1".concat(path),
  17783. params: params
  17784. }]
  17785. };
  17786. return request({
  17787. path: '/batch',
  17788. method: 'POST',
  17789. data: body,
  17790. authOptions: options
  17791. }).then(function (response) {
  17792. var result = response[0];
  17793. if (result.success) {
  17794. return result.success;
  17795. }
  17796. var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
  17797. throw error;
  17798. });
  17799. }
  17800. return request({
  17801. method: 'GET',
  17802. path: path,
  17803. query: params,
  17804. authOptions: options
  17805. });
  17806. },
  17807. _parseResponse: function _parseResponse(response) {
  17808. var _this = this;
  17809. return (0, _map.default)(_).call(_, response.results, function (json) {
  17810. var obj = _this._newObject(response);
  17811. if (obj._finishFetch) {
  17812. obj._finishFetch(_this._processResult(json), true);
  17813. }
  17814. return obj;
  17815. });
  17816. },
  17817. /**
  17818. * Retrieves a list of AVObjects that satisfy this query.
  17819. *
  17820. * @param {AuthOptions} options
  17821. * @return {Promise} A promise that is resolved with the results when
  17822. * the query completes.
  17823. */
  17824. find: function find(options) {
  17825. var request = this._createRequest(undefined, options);
  17826. return request.then(this._parseResponse.bind(this));
  17827. },
  17828. /**
  17829. * Retrieves both AVObjects and total count.
  17830. *
  17831. * @since 4.12.0
  17832. * @param {AuthOptions} options
  17833. * @return {Promise} A tuple contains results and count.
  17834. */
  17835. findAndCount: function findAndCount(options) {
  17836. var _this2 = this;
  17837. var params = this._getParams();
  17838. params.count = 1;
  17839. var request = this._createRequest(params, options);
  17840. return request.then(function (response) {
  17841. return [_this2._parseResponse(response), response.count];
  17842. });
  17843. },
  17844. /**
  17845. * scan a Query. masterKey required.
  17846. *
  17847. * @since 2.1.0
  17848. * @param {object} [options]
  17849. * @param {string} [options.orderedBy] specify the key to sort
  17850. * @param {number} [options.batchSize] specify the batch size for each request
  17851. * @param {AuthOptions} [authOptions]
  17852. * @return {AsyncIterator.<AV.Object>}
  17853. * @example const testIterator = {
  17854. * [Symbol.asyncIterator]() {
  17855. * return new Query('Test').scan(undefined, { useMasterKey: true });
  17856. * },
  17857. * };
  17858. * for await (const test of testIterator) {
  17859. * console.log(test.id);
  17860. * }
  17861. */
  17862. scan: function scan() {
  17863. var _this3 = this;
  17864. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  17865. orderedBy = _ref2.orderedBy,
  17866. batchSize = _ref2.batchSize;
  17867. var authOptions = arguments.length > 1 ? arguments[1] : undefined;
  17868. var condition = this._getParams();
  17869. debug('scan %O', condition);
  17870. if (condition.order) {
  17871. console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
  17872. delete condition.order;
  17873. }
  17874. if (condition.skip) {
  17875. console.warn('The skip option of the query is ignored for Query#scan.');
  17876. delete condition.skip;
  17877. }
  17878. if (condition.limit) {
  17879. console.warn('The limit option of the query is ignored for Query#scan.');
  17880. delete condition.limit;
  17881. }
  17882. if (orderedBy) condition.scan_key = orderedBy;
  17883. if (batchSize) condition.limit = batchSize;
  17884. var cursor;
  17885. var remainResults = [];
  17886. return {
  17887. next: function next() {
  17888. if (remainResults.length) {
  17889. return _promise.default.resolve({
  17890. done: false,
  17891. value: remainResults.shift()
  17892. });
  17893. }
  17894. if (cursor === null) {
  17895. return _promise.default.resolve({
  17896. done: true
  17897. });
  17898. }
  17899. return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
  17900. cursor: cursor
  17901. }) : condition, authOptions).then(function (response) {
  17902. cursor = response.cursor;
  17903. if (response.results.length) {
  17904. var results = _this3._parseResponse(response);
  17905. results.forEach(function (result) {
  17906. return remainResults.push(result);
  17907. });
  17908. }
  17909. if (cursor === null && remainResults.length === 0) {
  17910. return {
  17911. done: true
  17912. };
  17913. }
  17914. return {
  17915. done: false,
  17916. value: remainResults.shift()
  17917. };
  17918. });
  17919. }
  17920. };
  17921. },
  17922. /**
  17923. * Delete objects retrieved by this query.
  17924. * @param {AuthOptions} options
  17925. * @return {Promise} A promise that is fulfilled when the save
  17926. * completes.
  17927. */
  17928. destroyAll: function destroyAll(options) {
  17929. var self = this;
  17930. return (0, _find.default)(self).call(self, options).then(function (objects) {
  17931. return AV.Object.destroyAll(objects, options);
  17932. });
  17933. },
  17934. /**
  17935. * Counts the number of objects that match this query.
  17936. *
  17937. * @param {AuthOptions} options
  17938. * @return {Promise} A promise that is resolved with the count when
  17939. * the query completes.
  17940. */
  17941. count: function count(options) {
  17942. var params = this._getParams();
  17943. params.limit = 0;
  17944. params.count = 1;
  17945. var request = this._createRequest(params, options);
  17946. return request.then(function (response) {
  17947. return response.count;
  17948. });
  17949. },
  17950. /**
  17951. * Retrieves at most one AV.Object that satisfies this query.
  17952. *
  17953. * @param {AuthOptions} options
  17954. * @return {Promise} A promise that is resolved with the object when
  17955. * the query completes.
  17956. */
  17957. first: function first(options) {
  17958. var self = this;
  17959. var params = this._getParams();
  17960. params.limit = 1;
  17961. var request = this._createRequest(params, options);
  17962. return request.then(function (response) {
  17963. return (0, _map.default)(_).call(_, response.results, function (json) {
  17964. var obj = self._newObject();
  17965. if (obj._finishFetch) {
  17966. obj._finishFetch(self._processResult(json), true);
  17967. }
  17968. return obj;
  17969. })[0];
  17970. });
  17971. },
  17972. /**
  17973. * Sets the number of results to skip before returning any results.
  17974. * This is useful for pagination.
  17975. * Default is to skip zero results.
  17976. * @param {Number} n the number of results to skip.
  17977. * @return {AV.Query} Returns the query, so you can chain this call.
  17978. */
  17979. skip: function skip(n) {
  17980. requires(n, 'undefined is not a valid skip value');
  17981. this._skip = n;
  17982. return this;
  17983. },
  17984. /**
  17985. * Sets the limit of the number of results to return. The default limit is
  17986. * 100, with a maximum of 1000 results being returned at a time.
  17987. * @param {Number} n the number of results to limit to.
  17988. * @return {AV.Query} Returns the query, so you can chain this call.
  17989. */
  17990. limit: function limit(n) {
  17991. requires(n, 'undefined is not a valid limit value');
  17992. this._limit = n;
  17993. return this;
  17994. },
  17995. /**
  17996. * Add a constraint to the query that requires a particular key's value to
  17997. * be equal to the provided value.
  17998. * @param {String} key The key to check.
  17999. * @param value The value that the AV.Object must contain.
  18000. * @return {AV.Query} Returns the query, so you can chain this call.
  18001. */
  18002. equalTo: function equalTo(key, value) {
  18003. requires(key, 'undefined is not a valid key');
  18004. requires(value, 'undefined is not a valid value');
  18005. this._where[key] = AV._encode(value);
  18006. return this;
  18007. },
  18008. /**
  18009. * Helper for condition queries
  18010. * @private
  18011. */
  18012. _addCondition: function _addCondition(key, condition, value) {
  18013. requires(key, 'undefined is not a valid condition key');
  18014. requires(condition, 'undefined is not a valid condition');
  18015. requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
  18016. if (!this._where[key]) {
  18017. this._where[key] = {};
  18018. }
  18019. this._where[key][condition] = AV._encode(value);
  18020. return this;
  18021. },
  18022. /**
  18023. * Add a constraint to the query that requires a particular
  18024. * <strong>array</strong> key's length to be equal to the provided value.
  18025. * @param {String} key The array key to check.
  18026. * @param {number} value The length value.
  18027. * @return {AV.Query} Returns the query, so you can chain this call.
  18028. */
  18029. sizeEqualTo: function sizeEqualTo(key, value) {
  18030. this._addCondition(key, '$size', value);
  18031. return this;
  18032. },
  18033. /**
  18034. * Add a constraint to the query that requires a particular key's value to
  18035. * be not equal to the provided value.
  18036. * @param {String} key The key to check.
  18037. * @param value The value that must not be equalled.
  18038. * @return {AV.Query} Returns the query, so you can chain this call.
  18039. */
  18040. notEqualTo: function notEqualTo(key, value) {
  18041. this._addCondition(key, '$ne', value);
  18042. return this;
  18043. },
  18044. /**
  18045. * Add a constraint to the query that requires a particular key's value to
  18046. * be less than the provided value.
  18047. * @param {String} key The key to check.
  18048. * @param value The value that provides an upper bound.
  18049. * @return {AV.Query} Returns the query, so you can chain this call.
  18050. */
  18051. lessThan: function lessThan(key, value) {
  18052. this._addCondition(key, '$lt', value);
  18053. return this;
  18054. },
  18055. /**
  18056. * Add a constraint to the query that requires a particular key's value to
  18057. * be greater than the provided value.
  18058. * @param {String} key The key to check.
  18059. * @param value The value that provides an lower bound.
  18060. * @return {AV.Query} Returns the query, so you can chain this call.
  18061. */
  18062. greaterThan: function greaterThan(key, value) {
  18063. this._addCondition(key, '$gt', value);
  18064. return this;
  18065. },
  18066. /**
  18067. * Add a constraint to the query that requires a particular key's value to
  18068. * be less than or equal to the provided value.
  18069. * @param {String} key The key to check.
  18070. * @param value The value that provides an upper bound.
  18071. * @return {AV.Query} Returns the query, so you can chain this call.
  18072. */
  18073. lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
  18074. this._addCondition(key, '$lte', value);
  18075. return this;
  18076. },
  18077. /**
  18078. * Add a constraint to the query that requires a particular key's value to
  18079. * be greater than or equal to the provided value.
  18080. * @param {String} key The key to check.
  18081. * @param value The value that provides an lower bound.
  18082. * @return {AV.Query} Returns the query, so you can chain this call.
  18083. */
  18084. greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
  18085. this._addCondition(key, '$gte', value);
  18086. return this;
  18087. },
  18088. /**
  18089. * Add a constraint to the query that requires a particular key's value to
  18090. * be contained in the provided list of values.
  18091. * @param {String} key The key to check.
  18092. * @param {Array} values The values that will match.
  18093. * @return {AV.Query} Returns the query, so you can chain this call.
  18094. */
  18095. containedIn: function containedIn(key, values) {
  18096. this._addCondition(key, '$in', values);
  18097. return this;
  18098. },
  18099. /**
  18100. * Add a constraint to the query that requires a particular key's value to
  18101. * not be contained in the provided list of values.
  18102. * @param {String} key The key to check.
  18103. * @param {Array} values The values that will not match.
  18104. * @return {AV.Query} Returns the query, so you can chain this call.
  18105. */
  18106. notContainedIn: function notContainedIn(key, values) {
  18107. this._addCondition(key, '$nin', values);
  18108. return this;
  18109. },
  18110. /**
  18111. * Add a constraint to the query that requires a particular key's value to
  18112. * contain each one of the provided list of values.
  18113. * @param {String} key The key to check. This key's value must be an array.
  18114. * @param {Array} values The values that will match.
  18115. * @return {AV.Query} Returns the query, so you can chain this call.
  18116. */
  18117. containsAll: function containsAll(key, values) {
  18118. this._addCondition(key, '$all', values);
  18119. return this;
  18120. },
  18121. /**
  18122. * Add a constraint for finding objects that contain the given key.
  18123. * @param {String} key The key that should exist.
  18124. * @return {AV.Query} Returns the query, so you can chain this call.
  18125. */
  18126. exists: function exists(key) {
  18127. this._addCondition(key, '$exists', true);
  18128. return this;
  18129. },
  18130. /**
  18131. * Add a constraint for finding objects that do not contain a given key.
  18132. * @param {String} key The key that should not exist
  18133. * @return {AV.Query} Returns the query, so you can chain this call.
  18134. */
  18135. doesNotExist: function doesNotExist(key) {
  18136. this._addCondition(key, '$exists', false);
  18137. return this;
  18138. },
  18139. /**
  18140. * Add a regular expression constraint for finding string values that match
  18141. * the provided regular expression.
  18142. * This may be slow for large datasets.
  18143. * @param {String} key The key that the string to match is stored in.
  18144. * @param {RegExp} regex The regular expression pattern to match.
  18145. * @return {AV.Query} Returns the query, so you can chain this call.
  18146. */
  18147. matches: function matches(key, regex, modifiers) {
  18148. this._addCondition(key, '$regex', regex);
  18149. if (!modifiers) {
  18150. modifiers = '';
  18151. } // Javascript regex options support mig as inline options but store them
  18152. // as properties of the object. We support mi & should migrate them to
  18153. // modifiers
  18154. if (regex.ignoreCase) {
  18155. modifiers += 'i';
  18156. }
  18157. if (regex.multiline) {
  18158. modifiers += 'm';
  18159. }
  18160. if (modifiers && modifiers.length) {
  18161. this._addCondition(key, '$options', modifiers);
  18162. }
  18163. return this;
  18164. },
  18165. /**
  18166. * Add a constraint that requires that a key's value matches a AV.Query
  18167. * constraint.
  18168. * @param {String} key The key that the contains the object to match the
  18169. * query.
  18170. * @param {AV.Query} query The query that should match.
  18171. * @return {AV.Query} Returns the query, so you can chain this call.
  18172. */
  18173. matchesQuery: function matchesQuery(key, query) {
  18174. var queryJSON = query._getParams();
  18175. queryJSON.className = query.className;
  18176. this._addCondition(key, '$inQuery', queryJSON);
  18177. return this;
  18178. },
  18179. /**
  18180. * Add a constraint that requires that a key's value not matches a
  18181. * AV.Query constraint.
  18182. * @param {String} key The key that the contains the object to match the
  18183. * query.
  18184. * @param {AV.Query} query The query that should not match.
  18185. * @return {AV.Query} Returns the query, so you can chain this call.
  18186. */
  18187. doesNotMatchQuery: function doesNotMatchQuery(key, query) {
  18188. var queryJSON = query._getParams();
  18189. queryJSON.className = query.className;
  18190. this._addCondition(key, '$notInQuery', queryJSON);
  18191. return this;
  18192. },
  18193. /**
  18194. * Add a constraint that requires that a key's value matches a value in
  18195. * an object returned by a different AV.Query.
  18196. * @param {String} key The key that contains the value that is being
  18197. * matched.
  18198. * @param {String} queryKey The key in the objects returned by the query to
  18199. * match against.
  18200. * @param {AV.Query} query The query to run.
  18201. * @return {AV.Query} Returns the query, so you can chain this call.
  18202. */
  18203. matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
  18204. var queryJSON = query._getParams();
  18205. queryJSON.className = query.className;
  18206. this._addCondition(key, '$select', {
  18207. key: queryKey,
  18208. query: queryJSON
  18209. });
  18210. return this;
  18211. },
  18212. /**
  18213. * Add a constraint that requires that a key's value not match a value in
  18214. * an object returned by a different AV.Query.
  18215. * @param {String} key The key that contains the value that is being
  18216. * excluded.
  18217. * @param {String} queryKey The key in the objects returned by the query to
  18218. * match against.
  18219. * @param {AV.Query} query The query to run.
  18220. * @return {AV.Query} Returns the query, so you can chain this call.
  18221. */
  18222. doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
  18223. var queryJSON = query._getParams();
  18224. queryJSON.className = query.className;
  18225. this._addCondition(key, '$dontSelect', {
  18226. key: queryKey,
  18227. query: queryJSON
  18228. });
  18229. return this;
  18230. },
  18231. /**
  18232. * Add constraint that at least one of the passed in queries matches.
  18233. * @param {Array} queries
  18234. * @return {AV.Query} Returns the query, so you can chain this call.
  18235. * @private
  18236. */
  18237. _orQuery: function _orQuery(queries) {
  18238. var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
  18239. return q._getParams().where;
  18240. });
  18241. this._where.$or = queryJSON;
  18242. return this;
  18243. },
  18244. /**
  18245. * Add constraint that both of the passed in queries matches.
  18246. * @param {Array} queries
  18247. * @return {AV.Query} Returns the query, so you can chain this call.
  18248. * @private
  18249. */
  18250. _andQuery: function _andQuery(queries) {
  18251. var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
  18252. return q._getParams().where;
  18253. });
  18254. this._where.$and = queryJSON;
  18255. return this;
  18256. },
  18257. /**
  18258. * Converts a string into a regex that matches it.
  18259. * Surrounding with \Q .. \E does this, we just need to escape \E's in
  18260. * the text separately.
  18261. * @private
  18262. */
  18263. _quote: function _quote(s) {
  18264. return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
  18265. },
  18266. /**
  18267. * Add a constraint for finding string values that contain a provided
  18268. * string. This may be slow for large datasets.
  18269. * @param {String} key The key that the string to match is stored in.
  18270. * @param {String} substring The substring that the value must contain.
  18271. * @return {AV.Query} Returns the query, so you can chain this call.
  18272. */
  18273. contains: function contains(key, value) {
  18274. this._addCondition(key, '$regex', this._quote(value));
  18275. return this;
  18276. },
  18277. /**
  18278. * Add a constraint for finding string values that start with a provided
  18279. * string. This query will use the backend index, so it will be fast even
  18280. * for large datasets.
  18281. * @param {String} key The key that the string to match is stored in.
  18282. * @param {String} prefix The substring that the value must start with.
  18283. * @return {AV.Query} Returns the query, so you can chain this call.
  18284. */
  18285. startsWith: function startsWith(key, value) {
  18286. this._addCondition(key, '$regex', '^' + this._quote(value));
  18287. return this;
  18288. },
  18289. /**
  18290. * Add a constraint for finding string values that end with a provided
  18291. * string. This will be slow for large datasets.
  18292. * @param {String} key The key that the string to match is stored in.
  18293. * @param {String} suffix The substring that the value must end with.
  18294. * @return {AV.Query} Returns the query, so you can chain this call.
  18295. */
  18296. endsWith: function endsWith(key, value) {
  18297. this._addCondition(key, '$regex', this._quote(value) + '$');
  18298. return this;
  18299. },
  18300. /**
  18301. * Sorts the results in ascending order by the given key.
  18302. *
  18303. * @param {String} key The key to order by.
  18304. * @return {AV.Query} Returns the query, so you can chain this call.
  18305. */
  18306. ascending: function ascending(key) {
  18307. requires(key, 'undefined is not a valid key');
  18308. this._order = key;
  18309. return this;
  18310. },
  18311. /**
  18312. * Also sorts the results in ascending order by the given key. The previous sort keys have
  18313. * precedence over this key.
  18314. *
  18315. * @param {String} key The key to order by
  18316. * @return {AV.Query} Returns the query so you can chain this call.
  18317. */
  18318. addAscending: function addAscending(key) {
  18319. requires(key, 'undefined is not a valid key');
  18320. if (this._order) this._order += ',' + key;else this._order = key;
  18321. return this;
  18322. },
  18323. /**
  18324. * Sorts the results in descending order by the given key.
  18325. *
  18326. * @param {String} key The key to order by.
  18327. * @return {AV.Query} Returns the query, so you can chain this call.
  18328. */
  18329. descending: function descending(key) {
  18330. requires(key, 'undefined is not a valid key');
  18331. this._order = '-' + key;
  18332. return this;
  18333. },
  18334. /**
  18335. * Also sorts the results in descending order by the given key. The previous sort keys have
  18336. * precedence over this key.
  18337. *
  18338. * @param {String} key The key to order by
  18339. * @return {AV.Query} Returns the query so you can chain this call.
  18340. */
  18341. addDescending: function addDescending(key) {
  18342. requires(key, 'undefined is not a valid key');
  18343. if (this._order) this._order += ',-' + key;else this._order = '-' + key;
  18344. return this;
  18345. },
  18346. /**
  18347. * Add a proximity based constraint for finding objects with key point
  18348. * values near the point given.
  18349. * @param {String} key The key that the AV.GeoPoint is stored in.
  18350. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
  18351. * @return {AV.Query} Returns the query, so you can chain this call.
  18352. */
  18353. near: function near(key, point) {
  18354. if (!(point instanceof AV.GeoPoint)) {
  18355. // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
  18356. point = new AV.GeoPoint(point);
  18357. }
  18358. this._addCondition(key, '$nearSphere', point);
  18359. return this;
  18360. },
  18361. /**
  18362. * Add a proximity based constraint for finding objects with key point
  18363. * values near the point given and within the maximum distance given.
  18364. * @param {String} key The key that the AV.GeoPoint is stored in.
  18365. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
  18366. * @param maxDistance Maximum distance (in radians) of results to return.
  18367. * @return {AV.Query} Returns the query, so you can chain this call.
  18368. */
  18369. withinRadians: function withinRadians(key, point, distance) {
  18370. this.near(key, point);
  18371. this._addCondition(key, '$maxDistance', distance);
  18372. return this;
  18373. },
  18374. /**
  18375. * Add a proximity based constraint for finding objects with key point
  18376. * values near the point given and within the maximum distance given.
  18377. * Radius of earth used is 3958.8 miles.
  18378. * @param {String} key The key that the AV.GeoPoint is stored in.
  18379. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
  18380. * @param {Number} maxDistance Maximum distance (in miles) of results to
  18381. * return.
  18382. * @return {AV.Query} Returns the query, so you can chain this call.
  18383. */
  18384. withinMiles: function withinMiles(key, point, distance) {
  18385. return this.withinRadians(key, point, distance / 3958.8);
  18386. },
  18387. /**
  18388. * Add a proximity based constraint for finding objects with key point
  18389. * values near the point given and within the maximum distance given.
  18390. * Radius of earth used is 6371.0 kilometers.
  18391. * @param {String} key The key that the AV.GeoPoint is stored in.
  18392. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
  18393. * @param {Number} maxDistance Maximum distance (in kilometers) of results
  18394. * to return.
  18395. * @return {AV.Query} Returns the query, so you can chain this call.
  18396. */
  18397. withinKilometers: function withinKilometers(key, point, distance) {
  18398. return this.withinRadians(key, point, distance / 6371.0);
  18399. },
  18400. /**
  18401. * Add a constraint to the query that requires a particular key's
  18402. * coordinates be contained within a given rectangular geographic bounding
  18403. * box.
  18404. * @param {String} key The key to be constrained.
  18405. * @param {AV.GeoPoint} southwest
  18406. * The lower-left inclusive corner of the box.
  18407. * @param {AV.GeoPoint} northeast
  18408. * The upper-right inclusive corner of the box.
  18409. * @return {AV.Query} Returns the query, so you can chain this call.
  18410. */
  18411. withinGeoBox: function withinGeoBox(key, southwest, northeast) {
  18412. if (!(southwest instanceof AV.GeoPoint)) {
  18413. southwest = new AV.GeoPoint(southwest);
  18414. }
  18415. if (!(northeast instanceof AV.GeoPoint)) {
  18416. northeast = new AV.GeoPoint(northeast);
  18417. }
  18418. this._addCondition(key, '$within', {
  18419. $box: [southwest, northeast]
  18420. });
  18421. return this;
  18422. },
  18423. /**
  18424. * Include nested AV.Objects for the provided key. You can use dot
  18425. * notation to specify which fields in the included object are also fetch.
  18426. * @param {String[]} keys The name of the key to include.
  18427. * @return {AV.Query} Returns the query, so you can chain this call.
  18428. */
  18429. include: function include(keys) {
  18430. var _this4 = this;
  18431. requires(keys, 'undefined is not a valid key');
  18432. _.forEach(arguments, function (keys) {
  18433. var _context;
  18434. _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
  18435. });
  18436. return this;
  18437. },
  18438. /**
  18439. * Include the ACL.
  18440. * @param {Boolean} [value=true] Whether to include the ACL
  18441. * @return {AV.Query} Returns the query, so you can chain this call.
  18442. */
  18443. includeACL: function includeACL() {
  18444. var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  18445. this._includeACL = value;
  18446. return this;
  18447. },
  18448. /**
  18449. * Restrict the fields of the returned AV.Objects to include only the
  18450. * provided keys. If this is called multiple times, then all of the keys
  18451. * specified in each of the calls will be included.
  18452. * @param {String[]} keys The names of the keys to include.
  18453. * @return {AV.Query} Returns the query, so you can chain this call.
  18454. */
  18455. select: function select(keys) {
  18456. var _this5 = this;
  18457. requires(keys, 'undefined is not a valid key');
  18458. _.forEach(arguments, function (keys) {
  18459. var _context2;
  18460. _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
  18461. });
  18462. return this;
  18463. },
  18464. /**
  18465. * Iterates over each result of a query, calling a callback for each one. If
  18466. * the callback returns a promise, the iteration will not continue until
  18467. * that promise has been fulfilled. If the callback returns a rejected
  18468. * promise, then iteration will stop with that error. The items are
  18469. * processed in an unspecified order. The query may not have any sort order,
  18470. * and may not use limit or skip.
  18471. * @param callback {Function} Callback that will be called with each result
  18472. * of the query.
  18473. * @return {Promise} A promise that will be fulfilled once the
  18474. * iteration has completed.
  18475. */
  18476. each: function each(callback) {
  18477. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  18478. if (this._order || this._skip || this._limit >= 0) {
  18479. var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
  18480. return _promise.default.reject(error);
  18481. }
  18482. var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
  18483. // This is undocumented, but useful for testing.
  18484. query._limit = options.batchSize || 100;
  18485. query._where = _.clone(this._where);
  18486. query._include = _.clone(this._include);
  18487. query.ascending('objectId');
  18488. var finished = false;
  18489. return continueWhile(function () {
  18490. return !finished;
  18491. }, function () {
  18492. return (0, _find.default)(query).call(query, options).then(function (results) {
  18493. var callbacksDone = _promise.default.resolve();
  18494. _.each(results, function (result) {
  18495. callbacksDone = callbacksDone.then(function () {
  18496. return callback(result);
  18497. });
  18498. });
  18499. return callbacksDone.then(function () {
  18500. if (results.length >= query._limit) {
  18501. query.greaterThan('objectId', results[results.length - 1].id);
  18502. } else {
  18503. finished = true;
  18504. }
  18505. });
  18506. });
  18507. });
  18508. },
  18509. /**
  18510. * Subscribe the changes of this query.
  18511. *
  18512. * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
  18513. *
  18514. * @since 3.0.0
  18515. * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
  18516. */
  18517. subscribe: function subscribe(options) {
  18518. return AV.LiveQuery.init(this, options);
  18519. }
  18520. });
  18521. AV.FriendShipQuery = AV.Query._extend({
  18522. _newObject: function _newObject() {
  18523. var UserClass = AV.Object._getSubclass('_User');
  18524. return new UserClass();
  18525. },
  18526. _processResult: function _processResult(json) {
  18527. if (json && json[this._friendshipTag]) {
  18528. var user = json[this._friendshipTag];
  18529. if (user.__type === 'Pointer' && user.className === '_User') {
  18530. delete user.__type;
  18531. delete user.className;
  18532. }
  18533. return user;
  18534. } else {
  18535. return null;
  18536. }
  18537. }
  18538. });
  18539. };
  18540. /***/ }),
  18541. /* 559 */
  18542. /***/ (function(module, exports, __webpack_require__) {
  18543. "use strict";
  18544. var _interopRequireDefault = __webpack_require__(1);
  18545. var _promise = _interopRequireDefault(__webpack_require__(12));
  18546. var _keys = _interopRequireDefault(__webpack_require__(59));
  18547. var _ = __webpack_require__(3);
  18548. var EventEmitter = __webpack_require__(235);
  18549. var _require = __webpack_require__(30),
  18550. inherits = _require.inherits;
  18551. var _require2 = __webpack_require__(27),
  18552. request = _require2.request;
  18553. var subscribe = function subscribe(queryJSON, subscriptionId) {
  18554. return request({
  18555. method: 'POST',
  18556. path: '/LiveQuery/subscribe',
  18557. data: {
  18558. query: queryJSON,
  18559. id: subscriptionId
  18560. }
  18561. });
  18562. };
  18563. module.exports = function (AV) {
  18564. var requireRealtime = function requireRealtime() {
  18565. if (!AV._config.realtime) {
  18566. throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
  18567. }
  18568. };
  18569. /**
  18570. * @class
  18571. * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
  18572. * @since 3.0.0
  18573. */
  18574. AV.LiveQuery = inherits(EventEmitter,
  18575. /** @lends AV.LiveQuery.prototype */
  18576. {
  18577. constructor: function constructor(id, client, queryJSON, subscriptionId) {
  18578. var _this = this;
  18579. EventEmitter.apply(this);
  18580. this.id = id;
  18581. this._client = client;
  18582. this._client.register(this);
  18583. this._queryJSON = queryJSON;
  18584. this._subscriptionId = subscriptionId;
  18585. this._onMessage = this._dispatch.bind(this);
  18586. this._onReconnect = function () {
  18587. subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
  18588. return console.error("LiveQuery resubscribe error: ".concat(error.message));
  18589. });
  18590. };
  18591. client.on('message', this._onMessage);
  18592. client.on('reconnect', this._onReconnect);
  18593. },
  18594. _dispatch: function _dispatch(message) {
  18595. var _this2 = this;
  18596. message.forEach(function (_ref) {
  18597. var op = _ref.op,
  18598. object = _ref.object,
  18599. queryId = _ref.query_id,
  18600. updatedKeys = _ref.updatedKeys;
  18601. if (queryId !== _this2.id) return;
  18602. var target = AV.parseJSON(_.extend({
  18603. __type: object.className === '_File' ? 'File' : 'Object'
  18604. }, object));
  18605. if (updatedKeys) {
  18606. /**
  18607. * An existing AV.Object which fulfills the Query you subscribe is updated.
  18608. * @event AV.LiveQuery#update
  18609. * @param {AV.Object|AV.File} target updated object
  18610. * @param {String[]} updatedKeys updated keys
  18611. */
  18612. /**
  18613. * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
  18614. * @event AV.LiveQuery#enter
  18615. * @param {AV.Object|AV.File} target updated object
  18616. * @param {String[]} updatedKeys updated keys
  18617. */
  18618. /**
  18619. * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
  18620. * @event AV.LiveQuery#leave
  18621. * @param {AV.Object|AV.File} target updated object
  18622. * @param {String[]} updatedKeys updated keys
  18623. */
  18624. _this2.emit(op, target, updatedKeys);
  18625. } else {
  18626. /**
  18627. * A new AV.Object which fulfills the Query you subscribe is created.
  18628. * @event AV.LiveQuery#create
  18629. * @param {AV.Object|AV.File} target updated object
  18630. */
  18631. /**
  18632. * An existing AV.Object which fulfills the Query you subscribe is deleted.
  18633. * @event AV.LiveQuery#delete
  18634. * @param {AV.Object|AV.File} target updated object
  18635. */
  18636. _this2.emit(op, target);
  18637. }
  18638. });
  18639. },
  18640. /**
  18641. * unsubscribe the query
  18642. *
  18643. * @return {Promise}
  18644. */
  18645. unsubscribe: function unsubscribe() {
  18646. var client = this._client;
  18647. client.off('message', this._onMessage);
  18648. client.off('reconnect', this._onReconnect);
  18649. client.deregister(this);
  18650. return request({
  18651. method: 'POST',
  18652. path: '/LiveQuery/unsubscribe',
  18653. data: {
  18654. id: client.id,
  18655. query_id: this.id
  18656. }
  18657. });
  18658. }
  18659. },
  18660. /** @lends AV.LiveQuery */
  18661. {
  18662. init: function init(query) {
  18663. var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  18664. _ref2$subscriptionId = _ref2.subscriptionId,
  18665. userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
  18666. requireRealtime();
  18667. if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
  18668. return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
  18669. return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
  18670. var _query$_getParams = query._getParams(),
  18671. where = _query$_getParams.where,
  18672. keys = (0, _keys.default)(_query$_getParams),
  18673. returnACL = _query$_getParams.returnACL;
  18674. var queryJSON = {
  18675. where: where,
  18676. keys: keys,
  18677. returnACL: returnACL,
  18678. className: query.className
  18679. };
  18680. var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
  18681. var queryId = _ref3.query_id;
  18682. return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
  18683. }).finally(function () {
  18684. liveQueryClient.deregister(promise);
  18685. });
  18686. liveQueryClient.register(promise);
  18687. return promise;
  18688. });
  18689. });
  18690. },
  18691. /**
  18692. * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
  18693. * @static
  18694. * @return void
  18695. */
  18696. pause: function pause() {
  18697. requireRealtime();
  18698. return AV._config.realtime.pause();
  18699. },
  18700. /**
  18701. * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
  18702. * @static
  18703. * @return void
  18704. */
  18705. resume: function resume() {
  18706. requireRealtime();
  18707. return AV._config.realtime.resume();
  18708. }
  18709. });
  18710. };
  18711. /***/ }),
  18712. /* 560 */
  18713. /***/ (function(module, exports, __webpack_require__) {
  18714. "use strict";
  18715. var _ = __webpack_require__(3);
  18716. var _require = __webpack_require__(30),
  18717. tap = _require.tap;
  18718. module.exports = function (AV) {
  18719. /**
  18720. * @class
  18721. * @example
  18722. * AV.Captcha.request().then(captcha => {
  18723. * captcha.bind({
  18724. * textInput: 'code', // the id for textInput
  18725. * image: 'captcha',
  18726. * verifyButton: 'verify',
  18727. * }, {
  18728. * success: (validateCode) => {}, // next step
  18729. * error: (error) => {}, // present error.message to user
  18730. * });
  18731. * });
  18732. */
  18733. AV.Captcha = function Captcha(options, authOptions) {
  18734. this._options = options;
  18735. this._authOptions = authOptions;
  18736. /**
  18737. * The image url of the captcha
  18738. * @type string
  18739. */
  18740. this.url = undefined;
  18741. /**
  18742. * The captchaToken of the captcha.
  18743. * @type string
  18744. */
  18745. this.captchaToken = undefined;
  18746. /**
  18747. * The validateToken of the captcha.
  18748. * @type string
  18749. */
  18750. this.validateToken = undefined;
  18751. };
  18752. /**
  18753. * Refresh the captcha
  18754. * @return {Promise.<string>} a new capcha url
  18755. */
  18756. AV.Captcha.prototype.refresh = function refresh() {
  18757. var _this = this;
  18758. return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
  18759. var captchaToken = _ref.captchaToken,
  18760. url = _ref.url;
  18761. _.extend(_this, {
  18762. captchaToken: captchaToken,
  18763. url: url
  18764. });
  18765. return url;
  18766. });
  18767. };
  18768. /**
  18769. * Verify the captcha
  18770. * @param {String} code The code from user input
  18771. * @return {Promise.<string>} validateToken if the code is valid
  18772. */
  18773. AV.Captcha.prototype.verify = function verify(code) {
  18774. var _this2 = this;
  18775. return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
  18776. return _this2.validateToken = validateToken;
  18777. }));
  18778. };
  18779. if (false) {
  18780. /**
  18781. * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
  18782. * @param [elements]
  18783. * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
  18784. * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
  18785. * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
  18786. * @param [callbacks]
  18787. * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
  18788. * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
  18789. */
  18790. AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
  18791. var _this3 = this;
  18792. var textInput = _ref2.textInput,
  18793. image = _ref2.image,
  18794. verifyButton = _ref2.verifyButton;
  18795. var success = _ref3.success,
  18796. error = _ref3.error;
  18797. if (typeof textInput === 'string') {
  18798. textInput = document.getElementById(textInput);
  18799. if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
  18800. }
  18801. if (typeof image === 'string') {
  18802. image = document.getElementById(image);
  18803. if (!image) throw new Error("image with id ".concat(image, " not found"));
  18804. }
  18805. if (typeof verifyButton === 'string') {
  18806. verifyButton = document.getElementById(verifyButton);
  18807. if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
  18808. }
  18809. this.__refresh = function () {
  18810. return _this3.refresh().then(function (url) {
  18811. image.src = url;
  18812. if (textInput) {
  18813. textInput.value = '';
  18814. textInput.focus();
  18815. }
  18816. }).catch(function (err) {
  18817. return console.warn("refresh captcha fail: ".concat(err.message));
  18818. });
  18819. };
  18820. if (image) {
  18821. this.__image = image;
  18822. image.src = this.url;
  18823. image.addEventListener('click', this.__refresh);
  18824. }
  18825. this.__verify = function () {
  18826. var code = textInput.value;
  18827. _this3.verify(code).catch(function (err) {
  18828. _this3.__refresh();
  18829. throw err;
  18830. }).then(success, error).catch(function (err) {
  18831. return console.warn("verify captcha fail: ".concat(err.message));
  18832. });
  18833. };
  18834. if (textInput && verifyButton) {
  18835. this.__verifyButton = verifyButton;
  18836. verifyButton.addEventListener('click', this.__verify);
  18837. }
  18838. };
  18839. /**
  18840. * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
  18841. */
  18842. AV.Captcha.prototype.unbind = function unbind() {
  18843. if (this.__image) this.__image.removeEventListener('click', this.__refresh);
  18844. if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
  18845. };
  18846. }
  18847. /**
  18848. * Request a captcha
  18849. * @param [options]
  18850. * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
  18851. * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
  18852. * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
  18853. * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
  18854. * @return {Promise.<AV.Captcha>}
  18855. */
  18856. AV.Captcha.request = function (options, authOptions) {
  18857. var captcha = new AV.Captcha(options, authOptions);
  18858. return captcha.refresh().then(function () {
  18859. return captcha;
  18860. });
  18861. };
  18862. };
  18863. /***/ }),
  18864. /* 561 */
  18865. /***/ (function(module, exports, __webpack_require__) {
  18866. "use strict";
  18867. var _interopRequireDefault = __webpack_require__(1);
  18868. var _promise = _interopRequireDefault(__webpack_require__(12));
  18869. var _ = __webpack_require__(3);
  18870. var _require = __webpack_require__(27),
  18871. _request = _require._request,
  18872. request = _require.request;
  18873. module.exports = function (AV) {
  18874. /**
  18875. * Contains functions for calling and declaring
  18876. * <p><strong><em>
  18877. * Some functions are only available from Cloud Code.
  18878. * </em></strong></p>
  18879. *
  18880. * @namespace
  18881. * @borrows AV.Captcha.request as requestCaptcha
  18882. */
  18883. AV.Cloud = AV.Cloud || {};
  18884. _.extend(AV.Cloud,
  18885. /** @lends AV.Cloud */
  18886. {
  18887. /**
  18888. * Makes a call to a cloud function.
  18889. * @param {String} name The function name.
  18890. * @param {Object} [data] The parameters to send to the cloud function.
  18891. * @param {AuthOptions} [options]
  18892. * @return {Promise} A promise that will be resolved with the result
  18893. * of the function.
  18894. */
  18895. run: function run(name, data, options) {
  18896. return request({
  18897. service: 'engine',
  18898. method: 'POST',
  18899. path: "/functions/".concat(name),
  18900. data: AV._encode(data, null, true),
  18901. authOptions: options
  18902. }).then(function (resp) {
  18903. return AV._decode(resp).result;
  18904. });
  18905. },
  18906. /**
  18907. * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
  18908. * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
  18909. * @param {String} name The function name.
  18910. * @param {Object} [data] The parameters to send to the cloud function.
  18911. * @param {AuthOptions} [options]
  18912. * @return {Promise} A promise that will be resolved with the result of the function.
  18913. */
  18914. rpc: function rpc(name, data, options) {
  18915. if (_.isArray(data)) {
  18916. return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
  18917. }
  18918. return request({
  18919. service: 'engine',
  18920. method: 'POST',
  18921. path: "/call/".concat(name),
  18922. data: AV._encodeObjectOrArray(data),
  18923. authOptions: options
  18924. }).then(function (resp) {
  18925. return AV._decode(resp).result;
  18926. });
  18927. },
  18928. /**
  18929. * Make a call to request server date time.
  18930. * @return {Promise.<Date>} A promise that will be resolved with the result
  18931. * of the function.
  18932. * @since 0.5.9
  18933. */
  18934. getServerDate: function getServerDate() {
  18935. return _request('date', null, null, 'GET').then(function (resp) {
  18936. return AV._decode(resp);
  18937. });
  18938. },
  18939. /**
  18940. * Makes a call to request an sms code for operation verification.
  18941. * @param {String|Object} data The mobile phone number string or a JSON
  18942. * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
  18943. * @param {String} data.mobilePhoneNumber
  18944. * @param {String} [data.template] sms template name
  18945. * @param {String} [data.sign] sms signature name
  18946. * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
  18947. * @param {SMSAuthOptions} [options]
  18948. * @return {Promise} A promise that will be resolved if the request succeed
  18949. */
  18950. requestSmsCode: function requestSmsCode(data) {
  18951. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  18952. if (_.isString(data)) {
  18953. data = {
  18954. mobilePhoneNumber: data
  18955. };
  18956. }
  18957. if (!data.mobilePhoneNumber) {
  18958. throw new Error('Missing mobilePhoneNumber.');
  18959. }
  18960. if (options.validateToken) {
  18961. data = _.extend({}, data, {
  18962. validate_token: options.validateToken
  18963. });
  18964. }
  18965. return _request('requestSmsCode', null, null, 'POST', data, options);
  18966. },
  18967. /**
  18968. * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
  18969. * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
  18970. * @param {phone} phone The mobile phoner number.
  18971. * @return {Promise} A promise that will be resolved with the result
  18972. * of the function.
  18973. */
  18974. verifySmsCode: function verifySmsCode(code, phone) {
  18975. if (!code) throw new Error('Missing sms code.');
  18976. var params = {};
  18977. if (_.isString(phone)) {
  18978. params['mobilePhoneNumber'] = phone;
  18979. }
  18980. return _request('verifySmsCode', code, null, 'POST', params);
  18981. },
  18982. _requestCaptcha: function _requestCaptcha(options, authOptions) {
  18983. return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
  18984. var url = _ref.captcha_url,
  18985. captchaToken = _ref.captcha_token;
  18986. return {
  18987. captchaToken: captchaToken,
  18988. url: url
  18989. };
  18990. });
  18991. },
  18992. /**
  18993. * Request a captcha.
  18994. */
  18995. requestCaptcha: AV.Captcha.request,
  18996. /**
  18997. * Verify captcha code. This is the low-level API for captcha.
  18998. * Checkout {@link AV.Captcha} for high abstract APIs.
  18999. * @param {String} code the code from user input
  19000. * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
  19001. * @return {Promise.<String>} validateToken if the code is valid
  19002. */
  19003. verifyCaptcha: function verifyCaptcha(code, captchaToken) {
  19004. return _request('verifyCaptcha', null, null, 'POST', {
  19005. captcha_code: code,
  19006. captcha_token: captchaToken
  19007. }).then(function (_ref2) {
  19008. var validateToken = _ref2.validate_token;
  19009. return validateToken;
  19010. });
  19011. }
  19012. });
  19013. };
  19014. /***/ }),
  19015. /* 562 */
  19016. /***/ (function(module, exports, __webpack_require__) {
  19017. "use strict";
  19018. var request = __webpack_require__(27).request;
  19019. module.exports = function (AV) {
  19020. AV.Installation = AV.Object.extend('_Installation');
  19021. /**
  19022. * @namespace
  19023. */
  19024. AV.Push = AV.Push || {};
  19025. /**
  19026. * Sends a push notification.
  19027. * @param {Object} data The data of the push notification.
  19028. * @param {String[]} [data.channels] An Array of channels to push to.
  19029. * @param {Date} [data.push_time] A Date object for when to send the push.
  19030. * @param {Date} [data.expiration_time] A Date object for when to expire
  19031. * the push.
  19032. * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
  19033. * @param {Number} [data.flow_control] The clients to notify per second
  19034. * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
  19035. * a set of installations to push to.
  19036. * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
  19037. * a set of installations to push to.
  19038. * @param {Object} data.data The data to send as part of the push.
  19039. More details: https://url.leanapp.cn/pushData
  19040. * @param {AuthOptions} [options]
  19041. * @return {Promise}
  19042. */
  19043. AV.Push.send = function (data, options) {
  19044. if (data.where) {
  19045. data.where = data.where._getParams().where;
  19046. }
  19047. if (data.where && data.cql) {
  19048. throw new Error("Both where and cql can't be set");
  19049. }
  19050. if (data.push_time) {
  19051. data.push_time = data.push_time.toJSON();
  19052. }
  19053. if (data.expiration_time) {
  19054. data.expiration_time = data.expiration_time.toJSON();
  19055. }
  19056. if (data.expiration_time && data.expiration_interval) {
  19057. throw new Error("Both expiration_time and expiration_interval can't be set");
  19058. }
  19059. return request({
  19060. service: 'push',
  19061. method: 'POST',
  19062. path: '/push',
  19063. data: data,
  19064. authOptions: options
  19065. });
  19066. };
  19067. };
  19068. /***/ }),
  19069. /* 563 */
  19070. /***/ (function(module, exports, __webpack_require__) {
  19071. "use strict";
  19072. var _interopRequireDefault = __webpack_require__(1);
  19073. var _promise = _interopRequireDefault(__webpack_require__(12));
  19074. var _typeof2 = _interopRequireDefault(__webpack_require__(73));
  19075. var _ = __webpack_require__(3);
  19076. var AVRequest = __webpack_require__(27)._request;
  19077. var _require = __webpack_require__(30),
  19078. getSessionToken = _require.getSessionToken;
  19079. module.exports = function (AV) {
  19080. var getUser = function getUser() {
  19081. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19082. var sessionToken = getSessionToken(options);
  19083. if (sessionToken) {
  19084. return AV.User._fetchUserBySessionToken(getSessionToken(options));
  19085. }
  19086. return AV.User.currentAsync();
  19087. };
  19088. var getUserPointer = function getUserPointer(options) {
  19089. return getUser(options).then(function (currUser) {
  19090. return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
  19091. });
  19092. };
  19093. /**
  19094. * Contains functions to deal with Status in LeanCloud.
  19095. * @class
  19096. */
  19097. AV.Status = function (imageUrl, message) {
  19098. this.data = {};
  19099. this.inboxType = 'default';
  19100. this.query = null;
  19101. if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
  19102. this.data = imageUrl;
  19103. } else {
  19104. if (imageUrl) {
  19105. this.data.image = imageUrl;
  19106. }
  19107. if (message) {
  19108. this.data.message = message;
  19109. }
  19110. }
  19111. return this;
  19112. };
  19113. _.extend(AV.Status.prototype,
  19114. /** @lends AV.Status.prototype */
  19115. {
  19116. /**
  19117. * Gets the value of an attribute in status data.
  19118. * @param {String} attr The string name of an attribute.
  19119. */
  19120. get: function get(attr) {
  19121. return this.data[attr];
  19122. },
  19123. /**
  19124. * Sets a hash of model attributes on the status data.
  19125. * @param {String} key The key to set.
  19126. * @param {any} value The value to give it.
  19127. */
  19128. set: function set(key, value) {
  19129. this.data[key] = value;
  19130. return this;
  19131. },
  19132. /**
  19133. * Destroy this status,then it will not be avaiable in other user's inboxes.
  19134. * @param {AuthOptions} options
  19135. * @return {Promise} A promise that is fulfilled when the destroy
  19136. * completes.
  19137. */
  19138. destroy: function destroy(options) {
  19139. if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
  19140. var request = AVRequest('statuses', null, this.id, 'DELETE', options);
  19141. return request;
  19142. },
  19143. /**
  19144. * Cast the AV.Status object to an AV.Object pointer.
  19145. * @return {AV.Object} A AV.Object pointer.
  19146. */
  19147. toObject: function toObject() {
  19148. if (!this.id) return null;
  19149. return AV.Object.createWithoutData('_Status', this.id);
  19150. },
  19151. _getDataJSON: function _getDataJSON() {
  19152. var json = _.clone(this.data);
  19153. return AV._encode(json);
  19154. },
  19155. /**
  19156. * Send a status by a AV.Query object.
  19157. * @since 0.3.0
  19158. * @param {AuthOptions} options
  19159. * @return {Promise} A promise that is fulfilled when the send
  19160. * completes.
  19161. * @example
  19162. * // send a status to male users
  19163. * var status = new AVStatus('image url', 'a message');
  19164. * status.query = new AV.Query('_User');
  19165. * status.query.equalTo('gender', 'male');
  19166. * status.send().then(function(){
  19167. * //send status successfully.
  19168. * }, function(err){
  19169. * //an error threw.
  19170. * console.dir(err);
  19171. * });
  19172. */
  19173. send: function send() {
  19174. var _this = this;
  19175. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19176. if (!getSessionToken(options) && !AV.User.current()) {
  19177. throw new Error('Please signin an user.');
  19178. }
  19179. if (!this.query) {
  19180. return AV.Status.sendStatusToFollowers(this, options);
  19181. }
  19182. return getUserPointer(options).then(function (currUser) {
  19183. var query = _this.query._getParams();
  19184. query.className = _this.query.className;
  19185. var data = {};
  19186. data.query = query;
  19187. _this.data = _this.data || {};
  19188. _this.data.source = _this.data.source || currUser;
  19189. data.data = _this._getDataJSON();
  19190. data.inboxType = _this.inboxType || 'default';
  19191. return AVRequest('statuses', null, null, 'POST', data, options);
  19192. }).then(function (response) {
  19193. _this.id = response.objectId;
  19194. _this.createdAt = AV._parseDate(response.createdAt);
  19195. return _this;
  19196. });
  19197. },
  19198. _finishFetch: function _finishFetch(serverData) {
  19199. this.id = serverData.objectId;
  19200. this.createdAt = AV._parseDate(serverData.createdAt);
  19201. this.updatedAt = AV._parseDate(serverData.updatedAt);
  19202. this.messageId = serverData.messageId;
  19203. delete serverData.messageId;
  19204. delete serverData.objectId;
  19205. delete serverData.createdAt;
  19206. delete serverData.updatedAt;
  19207. this.data = AV._decode(serverData);
  19208. }
  19209. });
  19210. /**
  19211. * Send a status to current signined user's followers.
  19212. * @since 0.3.0
  19213. * @param {AV.Status} status A status object to be send to followers.
  19214. * @param {AuthOptions} options
  19215. * @return {Promise} A promise that is fulfilled when the send
  19216. * completes.
  19217. * @example
  19218. * var status = new AVStatus('image url', 'a message');
  19219. * AV.Status.sendStatusToFollowers(status).then(function(){
  19220. * //send status successfully.
  19221. * }, function(err){
  19222. * //an error threw.
  19223. * console.dir(err);
  19224. * });
  19225. */
  19226. AV.Status.sendStatusToFollowers = function (status) {
  19227. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19228. if (!getSessionToken(options) && !AV.User.current()) {
  19229. throw new Error('Please signin an user.');
  19230. }
  19231. return getUserPointer(options).then(function (currUser) {
  19232. var query = {};
  19233. query.className = '_Follower';
  19234. query.keys = 'follower';
  19235. query.where = {
  19236. user: currUser
  19237. };
  19238. var data = {};
  19239. data.query = query;
  19240. status.data = status.data || {};
  19241. status.data.source = status.data.source || currUser;
  19242. data.data = status._getDataJSON();
  19243. data.inboxType = status.inboxType || 'default';
  19244. var request = AVRequest('statuses', null, null, 'POST', data, options);
  19245. return request.then(function (response) {
  19246. status.id = response.objectId;
  19247. status.createdAt = AV._parseDate(response.createdAt);
  19248. return status;
  19249. });
  19250. });
  19251. };
  19252. /**
  19253. * <p>Send a status from current signined user to other user's private status inbox.</p>
  19254. * @since 0.3.0
  19255. * @param {AV.Status} status A status object to be send to followers.
  19256. * @param {String} target The target user or user's objectId.
  19257. * @param {AuthOptions} options
  19258. * @return {Promise} A promise that is fulfilled when the send
  19259. * completes.
  19260. * @example
  19261. * // send a private status to user '52e84e47e4b0f8de283b079b'
  19262. * var status = new AVStatus('image url', 'a message');
  19263. * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
  19264. * //send status successfully.
  19265. * }, function(err){
  19266. * //an error threw.
  19267. * console.dir(err);
  19268. * });
  19269. */
  19270. AV.Status.sendPrivateStatus = function (status, target) {
  19271. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  19272. if (!getSessionToken(options) && !AV.User.current()) {
  19273. throw new Error('Please signin an user.');
  19274. }
  19275. if (!target) {
  19276. throw new Error('Invalid target user.');
  19277. }
  19278. var userObjectId = _.isString(target) ? target : target.id;
  19279. if (!userObjectId) {
  19280. throw new Error('Invalid target user.');
  19281. }
  19282. return getUserPointer(options).then(function (currUser) {
  19283. var query = {};
  19284. query.className = '_User';
  19285. query.where = {
  19286. objectId: userObjectId
  19287. };
  19288. var data = {};
  19289. data.query = query;
  19290. status.data = status.data || {};
  19291. status.data.source = status.data.source || currUser;
  19292. data.data = status._getDataJSON();
  19293. data.inboxType = 'private';
  19294. status.inboxType = 'private';
  19295. var request = AVRequest('statuses', null, null, 'POST', data, options);
  19296. return request.then(function (response) {
  19297. status.id = response.objectId;
  19298. status.createdAt = AV._parseDate(response.createdAt);
  19299. return status;
  19300. });
  19301. });
  19302. };
  19303. /**
  19304. * Count unread statuses in someone's inbox.
  19305. * @since 0.3.0
  19306. * @param {AV.User} owner The status owner.
  19307. * @param {String} inboxType The inbox type, 'default' by default.
  19308. * @param {AuthOptions} options
  19309. * @return {Promise} A promise that is fulfilled when the count
  19310. * completes.
  19311. * @example
  19312. * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
  19313. * console.log(response.unread); //unread statuses number.
  19314. * console.log(response.total); //total statuses number.
  19315. * });
  19316. */
  19317. AV.Status.countUnreadStatuses = function (owner) {
  19318. var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
  19319. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  19320. if (!_.isString(inboxType)) options = inboxType;
  19321. if (!getSessionToken(options) && owner == null && !AV.User.current()) {
  19322. throw new Error('Please signin an user or pass the owner objectId.');
  19323. }
  19324. return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
  19325. var params = {};
  19326. params.inboxType = AV._encode(inboxType);
  19327. params.owner = AV._encode(owner);
  19328. return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
  19329. });
  19330. };
  19331. /**
  19332. * reset unread statuses count in someone's inbox.
  19333. * @since 2.1.0
  19334. * @param {AV.User} owner The status owner.
  19335. * @param {String} inboxType The inbox type, 'default' by default.
  19336. * @param {AuthOptions} options
  19337. * @return {Promise} A promise that is fulfilled when the reset
  19338. * completes.
  19339. * @example
  19340. * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
  19341. * console.log(response.unread); //unread statuses number.
  19342. * console.log(response.total); //total statuses number.
  19343. * });
  19344. */
  19345. AV.Status.resetUnreadCount = function (owner) {
  19346. var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
  19347. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  19348. if (!_.isString(inboxType)) options = inboxType;
  19349. if (!getSessionToken(options) && owner == null && !AV.User.current()) {
  19350. throw new Error('Please signin an user or pass the owner objectId.');
  19351. }
  19352. return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
  19353. var params = {};
  19354. params.inboxType = AV._encode(inboxType);
  19355. params.owner = AV._encode(owner);
  19356. return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
  19357. });
  19358. };
  19359. /**
  19360. * Create a status query to find someone's published statuses.
  19361. * @since 0.3.0
  19362. * @param {AV.User} source The status source, typically the publisher.
  19363. * @return {AV.Query} The query object for status.
  19364. * @example
  19365. * //Find current user's published statuses.
  19366. * var query = AV.Status.statusQuery(AV.User.current());
  19367. * query.find().then(function(statuses){
  19368. * //process statuses
  19369. * });
  19370. */
  19371. AV.Status.statusQuery = function (source) {
  19372. var query = new AV.Query('_Status');
  19373. if (source) {
  19374. query.equalTo('source', source);
  19375. }
  19376. return query;
  19377. };
  19378. /**
  19379. * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
  19380. * @class
  19381. */
  19382. AV.InboxQuery = AV.Query._extend(
  19383. /** @lends AV.InboxQuery.prototype */
  19384. {
  19385. _objectClass: AV.Status,
  19386. _sinceId: 0,
  19387. _maxId: 0,
  19388. _inboxType: 'default',
  19389. _owner: null,
  19390. _newObject: function _newObject() {
  19391. return new AV.Status();
  19392. },
  19393. _createRequest: function _createRequest(params, options) {
  19394. return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
  19395. },
  19396. /**
  19397. * Sets the messageId of results to skip before returning any results.
  19398. * This is useful for pagination.
  19399. * Default is zero.
  19400. * @param {Number} n the mesage id.
  19401. * @return {AV.InboxQuery} Returns the query, so you can chain this call.
  19402. */
  19403. sinceId: function sinceId(id) {
  19404. this._sinceId = id;
  19405. return this;
  19406. },
  19407. /**
  19408. * Sets the maximal messageId of results。
  19409. * This is useful for pagination.
  19410. * Default is zero that is no limition.
  19411. * @param {Number} n the mesage id.
  19412. * @return {AV.InboxQuery} Returns the query, so you can chain this call.
  19413. */
  19414. maxId: function maxId(id) {
  19415. this._maxId = id;
  19416. return this;
  19417. },
  19418. /**
  19419. * Sets the owner of the querying inbox.
  19420. * @param {AV.User} owner The inbox owner.
  19421. * @return {AV.InboxQuery} Returns the query, so you can chain this call.
  19422. */
  19423. owner: function owner(_owner) {
  19424. this._owner = _owner;
  19425. return this;
  19426. },
  19427. /**
  19428. * Sets the querying inbox type.default is 'default'.
  19429. * @param {String} type The inbox type.
  19430. * @return {AV.InboxQuery} Returns the query, so you can chain this call.
  19431. */
  19432. inboxType: function inboxType(type) {
  19433. this._inboxType = type;
  19434. return this;
  19435. },
  19436. _getParams: function _getParams() {
  19437. var params = AV.InboxQuery.__super__._getParams.call(this);
  19438. params.owner = AV._encode(this._owner);
  19439. params.inboxType = AV._encode(this._inboxType);
  19440. params.sinceId = AV._encode(this._sinceId);
  19441. params.maxId = AV._encode(this._maxId);
  19442. return params;
  19443. }
  19444. });
  19445. /**
  19446. * Create a inbox status query to find someone's inbox statuses.
  19447. * @since 0.3.0
  19448. * @param {AV.User} owner The inbox's owner
  19449. * @param {String} inboxType The inbox type,'default' by default.
  19450. * @return {AV.InboxQuery} The inbox query object.
  19451. * @see AV.InboxQuery
  19452. * @example
  19453. * //Find current user's default inbox statuses.
  19454. * var query = AV.Status.inboxQuery(AV.User.current());
  19455. * //find the statuses after the last message id
  19456. * query.sinceId(lastMessageId);
  19457. * query.find().then(function(statuses){
  19458. * //process statuses
  19459. * });
  19460. */
  19461. AV.Status.inboxQuery = function (owner, inboxType) {
  19462. var query = new AV.InboxQuery(AV.Status);
  19463. if (owner) {
  19464. query._owner = owner;
  19465. }
  19466. if (inboxType) {
  19467. query._inboxType = inboxType;
  19468. }
  19469. return query;
  19470. };
  19471. };
  19472. /***/ }),
  19473. /* 564 */
  19474. /***/ (function(module, exports, __webpack_require__) {
  19475. "use strict";
  19476. var _interopRequireDefault = __webpack_require__(1);
  19477. var _stringify = _interopRequireDefault(__webpack_require__(36));
  19478. var _map = _interopRequireDefault(__webpack_require__(35));
  19479. var _ = __webpack_require__(3);
  19480. var AVRequest = __webpack_require__(27)._request;
  19481. module.exports = function (AV) {
  19482. /**
  19483. * A builder to generate sort string for app searching.For example:
  19484. * @class
  19485. * @since 0.5.1
  19486. * @example
  19487. * var builder = new AV.SearchSortBuilder();
  19488. * builder.ascending('key1').descending('key2','max');
  19489. * var query = new AV.SearchQuery('Player');
  19490. * query.sortBy(builder);
  19491. * query.find().then();
  19492. */
  19493. AV.SearchSortBuilder = function () {
  19494. this._sortFields = [];
  19495. };
  19496. _.extend(AV.SearchSortBuilder.prototype,
  19497. /** @lends AV.SearchSortBuilder.prototype */
  19498. {
  19499. _addField: function _addField(key, order, mode, missing) {
  19500. var field = {};
  19501. field[key] = {
  19502. order: order || 'asc',
  19503. mode: mode || 'avg',
  19504. missing: '_' + (missing || 'last')
  19505. };
  19506. this._sortFields.push(field);
  19507. return this;
  19508. },
  19509. /**
  19510. * Sorts the results in ascending order by the given key and options.
  19511. *
  19512. * @param {String} key The key to order by.
  19513. * @param {String} mode The sort mode, default is 'avg', you can choose
  19514. * 'max' or 'min' too.
  19515. * @param {String} missing The missing key behaviour, default is 'last',
  19516. * you can choose 'first' too.
  19517. * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
  19518. */
  19519. ascending: function ascending(key, mode, missing) {
  19520. return this._addField(key, 'asc', mode, missing);
  19521. },
  19522. /**
  19523. * Sorts the results in descending order by the given key and options.
  19524. *
  19525. * @param {String} key The key to order by.
  19526. * @param {String} mode The sort mode, default is 'avg', you can choose
  19527. * 'max' or 'min' too.
  19528. * @param {String} missing The missing key behaviour, default is 'last',
  19529. * you can choose 'first' too.
  19530. * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
  19531. */
  19532. descending: function descending(key, mode, missing) {
  19533. return this._addField(key, 'desc', mode, missing);
  19534. },
  19535. /**
  19536. * Add a proximity based constraint for finding objects with key point
  19537. * values near the point given.
  19538. * @param {String} key The key that the AV.GeoPoint is stored in.
  19539. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
  19540. * @param {Object} options The other options such as mode,order, unit etc.
  19541. * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
  19542. */
  19543. whereNear: function whereNear(key, point, options) {
  19544. options = options || {};
  19545. var field = {};
  19546. var geo = {
  19547. lat: point.latitude,
  19548. lon: point.longitude
  19549. };
  19550. var m = {
  19551. order: options.order || 'asc',
  19552. mode: options.mode || 'avg',
  19553. unit: options.unit || 'km'
  19554. };
  19555. m[key] = geo;
  19556. field['_geo_distance'] = m;
  19557. this._sortFields.push(field);
  19558. return this;
  19559. },
  19560. /**
  19561. * Build a sort string by configuration.
  19562. * @return {String} the sort string.
  19563. */
  19564. build: function build() {
  19565. return (0, _stringify.default)(AV._encode(this._sortFields));
  19566. }
  19567. });
  19568. /**
  19569. * App searching query.Use just like AV.Query:
  19570. *
  19571. * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
  19572. * for more details.
  19573. * @class
  19574. * @since 0.5.1
  19575. * @example
  19576. * var query = new AV.SearchQuery('Player');
  19577. * query.queryString('*');
  19578. * query.find().then(function(results) {
  19579. * console.log('Found %d objects', query.hits());
  19580. * //Process results
  19581. * });
  19582. */
  19583. AV.SearchQuery = AV.Query._extend(
  19584. /** @lends AV.SearchQuery.prototype */
  19585. {
  19586. _sid: null,
  19587. _hits: 0,
  19588. _queryString: null,
  19589. _highlights: null,
  19590. _sortBuilder: null,
  19591. _clazz: null,
  19592. constructor: function constructor(className) {
  19593. if (className) {
  19594. this._clazz = className;
  19595. } else {
  19596. className = '__INVALID_CLASS';
  19597. }
  19598. AV.Query.call(this, className);
  19599. },
  19600. _createRequest: function _createRequest(params, options) {
  19601. return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
  19602. },
  19603. /**
  19604. * Sets the sid of app searching query.Default is null.
  19605. * @param {String} sid Scroll id for searching.
  19606. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19607. */
  19608. sid: function sid(_sid) {
  19609. this._sid = _sid;
  19610. return this;
  19611. },
  19612. /**
  19613. * Sets the query string of app searching.
  19614. * @param {String} q The query string.
  19615. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19616. */
  19617. queryString: function queryString(q) {
  19618. this._queryString = q;
  19619. return this;
  19620. },
  19621. /**
  19622. * Sets the highlight fields. Such as
  19623. * <pre><code>
  19624. * query.highlights('title');
  19625. * //or pass an array.
  19626. * query.highlights(['title', 'content'])
  19627. * </code></pre>
  19628. * @param {String|String[]} highlights a list of fields.
  19629. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19630. */
  19631. highlights: function highlights(_highlights) {
  19632. var objects;
  19633. if (_highlights && _.isString(_highlights)) {
  19634. objects = _.toArray(arguments);
  19635. } else {
  19636. objects = _highlights;
  19637. }
  19638. this._highlights = objects;
  19639. return this;
  19640. },
  19641. /**
  19642. * Sets the sort builder for this query.
  19643. * @see AV.SearchSortBuilder
  19644. * @param { AV.SearchSortBuilder} builder The sort builder.
  19645. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19646. *
  19647. */
  19648. sortBy: function sortBy(builder) {
  19649. this._sortBuilder = builder;
  19650. return this;
  19651. },
  19652. /**
  19653. * Returns the number of objects that match this query.
  19654. * @return {Number}
  19655. */
  19656. hits: function hits() {
  19657. if (!this._hits) {
  19658. this._hits = 0;
  19659. }
  19660. return this._hits;
  19661. },
  19662. _processResult: function _processResult(json) {
  19663. delete json['className'];
  19664. delete json['_app_url'];
  19665. delete json['_deeplink'];
  19666. return json;
  19667. },
  19668. /**
  19669. * Returns true when there are more documents can be retrieved by this
  19670. * query instance, you can call find function to get more results.
  19671. * @see AV.SearchQuery#find
  19672. * @return {Boolean}
  19673. */
  19674. hasMore: function hasMore() {
  19675. return !this._hitEnd;
  19676. },
  19677. /**
  19678. * Reset current query instance state(such as sid, hits etc) except params
  19679. * for a new searching. After resetting, hasMore() will return true.
  19680. */
  19681. reset: function reset() {
  19682. this._hitEnd = false;
  19683. this._sid = null;
  19684. this._hits = 0;
  19685. },
  19686. /**
  19687. * Retrieves a list of AVObjects that satisfy this query.
  19688. * Either options.success or options.error is called when the find
  19689. * completes.
  19690. *
  19691. * @see AV.Query#find
  19692. * @param {AuthOptions} options
  19693. * @return {Promise} A promise that is resolved with the results when
  19694. * the query completes.
  19695. */
  19696. find: function find(options) {
  19697. var self = this;
  19698. var request = this._createRequest(undefined, options);
  19699. return request.then(function (response) {
  19700. //update sid for next querying.
  19701. if (response.sid) {
  19702. self._oldSid = self._sid;
  19703. self._sid = response.sid;
  19704. } else {
  19705. self._sid = null;
  19706. self._hitEnd = true;
  19707. }
  19708. self._hits = response.hits || 0;
  19709. return (0, _map.default)(_).call(_, response.results, function (json) {
  19710. if (json.className) {
  19711. response.className = json.className;
  19712. }
  19713. var obj = self._newObject(response);
  19714. obj.appURL = json['_app_url'];
  19715. obj._finishFetch(self._processResult(json), true);
  19716. return obj;
  19717. });
  19718. });
  19719. },
  19720. _getParams: function _getParams() {
  19721. var params = AV.SearchQuery.__super__._getParams.call(this);
  19722. delete params.where;
  19723. if (this._clazz) {
  19724. params.clazz = this.className;
  19725. }
  19726. if (this._sid) {
  19727. params.sid = this._sid;
  19728. }
  19729. if (!this._queryString) {
  19730. throw new Error('Please set query string.');
  19731. } else {
  19732. params.q = this._queryString;
  19733. }
  19734. if (this._highlights) {
  19735. params.highlights = this._highlights.join(',');
  19736. }
  19737. if (this._sortBuilder && params.order) {
  19738. throw new Error('sort and order can not be set at same time.');
  19739. }
  19740. if (this._sortBuilder) {
  19741. params.sort = this._sortBuilder.build();
  19742. }
  19743. return params;
  19744. }
  19745. });
  19746. };
  19747. /**
  19748. * Sorts the results in ascending order by the given key.
  19749. *
  19750. * @method AV.SearchQuery#ascending
  19751. * @param {String} key The key to order by.
  19752. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19753. */
  19754. /**
  19755. * Also sorts the results in ascending order by the given key. The previous sort keys have
  19756. * precedence over this key.
  19757. *
  19758. * @method AV.SearchQuery#addAscending
  19759. * @param {String} key The key to order by
  19760. * @return {AV.SearchQuery} Returns the query so you can chain this call.
  19761. */
  19762. /**
  19763. * Sorts the results in descending order by the given key.
  19764. *
  19765. * @method AV.SearchQuery#descending
  19766. * @param {String} key The key to order by.
  19767. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19768. */
  19769. /**
  19770. * Also sorts the results in descending order by the given key. The previous sort keys have
  19771. * precedence over this key.
  19772. *
  19773. * @method AV.SearchQuery#addDescending
  19774. * @param {String} key The key to order by
  19775. * @return {AV.SearchQuery} Returns the query so you can chain this call.
  19776. */
  19777. /**
  19778. * Include nested AV.Objects for the provided key. You can use dot
  19779. * notation to specify which fields in the included object are also fetch.
  19780. * @method AV.SearchQuery#include
  19781. * @param {String[]} keys The name of the key to include.
  19782. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19783. */
  19784. /**
  19785. * Sets the number of results to skip before returning any results.
  19786. * This is useful for pagination.
  19787. * Default is to skip zero results.
  19788. * @method AV.SearchQuery#skip
  19789. * @param {Number} n the number of results to skip.
  19790. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19791. */
  19792. /**
  19793. * Sets the limit of the number of results to return. The default limit is
  19794. * 100, with a maximum of 1000 results being returned at a time.
  19795. * @method AV.SearchQuery#limit
  19796. * @param {Number} n the number of results to limit to.
  19797. * @return {AV.SearchQuery} Returns the query, so you can chain this call.
  19798. */
  19799. /***/ }),
  19800. /* 565 */
  19801. /***/ (function(module, exports, __webpack_require__) {
  19802. "use strict";
  19803. var _interopRequireDefault = __webpack_require__(1);
  19804. var _promise = _interopRequireDefault(__webpack_require__(12));
  19805. var _ = __webpack_require__(3);
  19806. var AVError = __webpack_require__(46);
  19807. var _require = __webpack_require__(27),
  19808. request = _require.request;
  19809. module.exports = function (AV) {
  19810. /**
  19811. * 包含了使用了 LeanCloud
  19812. * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
  19813. * <p><strong><em>
  19814. * 仅在云引擎运行环境下有效。
  19815. * </em></strong></p>
  19816. * @namespace
  19817. */
  19818. AV.Insight = AV.Insight || {};
  19819. _.extend(AV.Insight,
  19820. /** @lends AV.Insight */
  19821. {
  19822. /**
  19823. * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
  19824. * AV.Insight.JobQuery 查询任务状态和结果。
  19825. * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
  19826. * { "sql" : "select count(*) as c,gender from _User group by gender",
  19827. * "saveAs": {
  19828. * "className" : "UserGender",
  19829. * "limit": 1
  19830. * }
  19831. * }
  19832. * </pre></code>
  19833. * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
  19834. * @param {AuthOptions} [options]
  19835. * @return {Promise} A promise that will be resolved with the result
  19836. * of the function.
  19837. */
  19838. startJob: function startJob(jobConfig, options) {
  19839. if (!jobConfig || !jobConfig.sql) {
  19840. throw new Error('Please provide the sql to run the job.');
  19841. }
  19842. var data = {
  19843. jobConfig: jobConfig,
  19844. appId: AV.applicationId
  19845. };
  19846. return request({
  19847. path: '/bigquery/jobs',
  19848. method: 'POST',
  19849. data: AV._encode(data, null, true),
  19850. authOptions: options,
  19851. signKey: false
  19852. }).then(function (resp) {
  19853. return AV._decode(resp).id;
  19854. });
  19855. },
  19856. /**
  19857. * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
  19858. * <p><strong><em>
  19859. * 仅在云引擎运行环境下有效。
  19860. * </em></strong></p>
  19861. * @param {String} event 监听的事件,目前尚不支持。
  19862. * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
  19863. * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
  19864. *
  19865. */
  19866. on: function on(event, cb) {}
  19867. });
  19868. /**
  19869. * 创建一个对象,用于查询 Insight 任务状态和结果。
  19870. * @class
  19871. * @param {String} id 任务 id
  19872. * @since 0.5.5
  19873. */
  19874. AV.Insight.JobQuery = function (id, className) {
  19875. if (!id) {
  19876. throw new Error('Please provide the job id.');
  19877. }
  19878. this.id = id;
  19879. this.className = className;
  19880. this._skip = 0;
  19881. this._limit = 100;
  19882. };
  19883. _.extend(AV.Insight.JobQuery.prototype,
  19884. /** @lends AV.Insight.JobQuery.prototype */
  19885. {
  19886. /**
  19887. * Sets the number of results to skip before returning any results.
  19888. * This is useful for pagination.
  19889. * Default is to skip zero results.
  19890. * @param {Number} n the number of results to skip.
  19891. * @return {AV.Query} Returns the query, so you can chain this call.
  19892. */
  19893. skip: function skip(n) {
  19894. this._skip = n;
  19895. return this;
  19896. },
  19897. /**
  19898. * Sets the limit of the number of results to return. The default limit is
  19899. * 100, with a maximum of 1000 results being returned at a time.
  19900. * @param {Number} n the number of results to limit to.
  19901. * @return {AV.Query} Returns the query, so you can chain this call.
  19902. */
  19903. limit: function limit(n) {
  19904. this._limit = n;
  19905. return this;
  19906. },
  19907. /**
  19908. * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
  19909. * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
  19910. * startTime、endTime 等信息。
  19911. *
  19912. * @param {AuthOptions} [options]
  19913. * @return {Promise} A promise that will be resolved with the result
  19914. * of the function.
  19915. *
  19916. */
  19917. find: function find(options) {
  19918. var params = {
  19919. skip: this._skip,
  19920. limit: this._limit
  19921. };
  19922. return request({
  19923. path: "/bigquery/jobs/".concat(this.id),
  19924. method: 'GET',
  19925. query: params,
  19926. authOptions: options,
  19927. signKey: false
  19928. }).then(function (response) {
  19929. if (response.error) {
  19930. return _promise.default.reject(new AVError(response.code, response.error));
  19931. }
  19932. return _promise.default.resolve(response);
  19933. });
  19934. }
  19935. });
  19936. };
  19937. /***/ }),
  19938. /* 566 */
  19939. /***/ (function(module, exports, __webpack_require__) {
  19940. "use strict";
  19941. var _interopRequireDefault = __webpack_require__(1);
  19942. var _promise = _interopRequireDefault(__webpack_require__(12));
  19943. var _ = __webpack_require__(3);
  19944. var _require = __webpack_require__(27),
  19945. LCRequest = _require.request;
  19946. var _require2 = __webpack_require__(30),
  19947. getSessionToken = _require2.getSessionToken;
  19948. module.exports = function (AV) {
  19949. var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
  19950. if (authOptions.user) {
  19951. if (!authOptions.user._sessionToken) {
  19952. throw new Error('authOptions.user is not signed in.');
  19953. }
  19954. return _promise.default.resolve(authOptions.user);
  19955. }
  19956. if (authOptions.sessionToken) {
  19957. return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
  19958. }
  19959. return AV.User.currentAsync();
  19960. };
  19961. var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
  19962. var sessionToken = getSessionToken(authOptions);
  19963. if (sessionToken) {
  19964. return _promise.default.resolve(sessionToken);
  19965. }
  19966. return AV.User.currentAsync().then(function (user) {
  19967. if (user) {
  19968. return user.getSessionToken();
  19969. }
  19970. });
  19971. };
  19972. /**
  19973. * Contains functions to deal with Friendship in LeanCloud.
  19974. * @class
  19975. */
  19976. AV.Friendship = {
  19977. /**
  19978. * Request friendship.
  19979. * @since 4.8.0
  19980. * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
  19981. * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
  19982. * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
  19983. * @param {AuthOptions} [authOptions]
  19984. * @return {Promise<void>}
  19985. */
  19986. request: function request(options) {
  19987. var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19988. var friend;
  19989. var attributes;
  19990. if (options.friend) {
  19991. friend = options.friend;
  19992. attributes = options.attributes;
  19993. } else {
  19994. friend = options;
  19995. }
  19996. var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
  19997. return getUserWithSessionToken(authOptions).then(function (userObj) {
  19998. if (!userObj) {
  19999. throw new Error('Please signin an user.');
  20000. }
  20001. return LCRequest({
  20002. method: 'POST',
  20003. path: '/users/friendshipRequests',
  20004. data: {
  20005. user: userObj._toPointer(),
  20006. friend: friendObj._toPointer(),
  20007. friendship: attributes
  20008. },
  20009. authOptions: authOptions
  20010. });
  20011. });
  20012. },
  20013. /**
  20014. * Accept a friendship request.
  20015. * @since 4.8.0
  20016. * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
  20017. * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
  20018. * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
  20019. * @param {AuthOptions} [authOptions]
  20020. * @return {Promise<void>}
  20021. */
  20022. acceptRequest: function acceptRequest(options) {
  20023. var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20024. var request;
  20025. var attributes;
  20026. if (options.request) {
  20027. request = options.request;
  20028. attributes = options.attributes;
  20029. } else {
  20030. request = options;
  20031. }
  20032. var requestId = _.isString(request) ? request : request.id;
  20033. return getSessionTokenAsync(authOptions).then(function (sessionToken) {
  20034. if (!sessionToken) {
  20035. throw new Error('Please signin an user.');
  20036. }
  20037. return LCRequest({
  20038. method: 'PUT',
  20039. path: '/users/friendshipRequests/' + requestId + '/accept',
  20040. data: {
  20041. friendship: AV._encode(attributes)
  20042. },
  20043. authOptions: authOptions
  20044. });
  20045. });
  20046. },
  20047. /**
  20048. * Decline a friendship request.
  20049. * @param {AV.Object | string} request The request (or it's objectId) to be declined.
  20050. * @param {AuthOptions} [authOptions]
  20051. * @return {Promise<void>}
  20052. */
  20053. declineRequest: function declineRequest(request) {
  20054. var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20055. var requestId = _.isString(request) ? request : request.id;
  20056. return getSessionTokenAsync(authOptions).then(function (sessionToken) {
  20057. if (!sessionToken) {
  20058. throw new Error('Please signin an user.');
  20059. }
  20060. return LCRequest({
  20061. method: 'PUT',
  20062. path: '/users/friendshipRequests/' + requestId + '/decline',
  20063. authOptions: authOptions
  20064. });
  20065. });
  20066. }
  20067. };
  20068. };
  20069. /***/ }),
  20070. /* 567 */
  20071. /***/ (function(module, exports, __webpack_require__) {
  20072. "use strict";
  20073. var _interopRequireDefault = __webpack_require__(1);
  20074. var _stringify = _interopRequireDefault(__webpack_require__(36));
  20075. var _ = __webpack_require__(3);
  20076. var _require = __webpack_require__(27),
  20077. _request = _require._request;
  20078. var AV = __webpack_require__(69);
  20079. var serializeMessage = function serializeMessage(message) {
  20080. if (typeof message === 'string') {
  20081. return message;
  20082. }
  20083. if (typeof message.getPayload === 'function') {
  20084. return (0, _stringify.default)(message.getPayload());
  20085. }
  20086. return (0, _stringify.default)(message);
  20087. };
  20088. /**
  20089. * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
  20090. * conversation. This class is a subclass of AV.Object, and retains the
  20091. * same functionality of an AV.Object, but also extends it with various
  20092. * conversation specific methods, like get members, creators of this conversation.
  20093. * </p>
  20094. *
  20095. * @class AV.Conversation
  20096. * @param {String} name The name of the Role to create.
  20097. * @param {Object} [options]
  20098. * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
  20099. * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
  20100. */
  20101. module.exports = AV.Object.extend('_Conversation',
  20102. /** @lends AV.Conversation.prototype */
  20103. {
  20104. constructor: function constructor(name) {
  20105. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20106. AV.Object.prototype.constructor.call(this, null, null);
  20107. this.set('name', name);
  20108. if (options.isSystem !== undefined) {
  20109. this.set('sys', options.isSystem ? true : false);
  20110. }
  20111. if (options.isTransient !== undefined) {
  20112. this.set('tr', options.isTransient ? true : false);
  20113. }
  20114. },
  20115. /**
  20116. * Get current conversation's creator.
  20117. *
  20118. * @return {String}
  20119. */
  20120. getCreator: function getCreator() {
  20121. return this.get('c');
  20122. },
  20123. /**
  20124. * Get the last message's time.
  20125. *
  20126. * @return {Date}
  20127. */
  20128. getLastMessageAt: function getLastMessageAt() {
  20129. return this.get('lm');
  20130. },
  20131. /**
  20132. * Get this conversation's members
  20133. *
  20134. * @return {String[]}
  20135. */
  20136. getMembers: function getMembers() {
  20137. return this.get('m');
  20138. },
  20139. /**
  20140. * Add a member to this conversation
  20141. *
  20142. * @param {String} member
  20143. */
  20144. addMember: function addMember(member) {
  20145. return this.add('m', member);
  20146. },
  20147. /**
  20148. * Get this conversation's members who set this conversation as muted.
  20149. *
  20150. * @return {String[]}
  20151. */
  20152. getMutedMembers: function getMutedMembers() {
  20153. return this.get('mu');
  20154. },
  20155. /**
  20156. * Get this conversation's name field.
  20157. *
  20158. * @return String
  20159. */
  20160. getName: function getName() {
  20161. return this.get('name');
  20162. },
  20163. /**
  20164. * Returns true if this conversation is transient conversation.
  20165. *
  20166. * @return {Boolean}
  20167. */
  20168. isTransient: function isTransient() {
  20169. return this.get('tr');
  20170. },
  20171. /**
  20172. * Returns true if this conversation is system conversation.
  20173. *
  20174. * @return {Boolean}
  20175. */
  20176. isSystem: function isSystem() {
  20177. return this.get('sys');
  20178. },
  20179. /**
  20180. * Send realtime message to this conversation, using HTTP request.
  20181. *
  20182. * @param {String} fromClient Sender's client id.
  20183. * @param {String|Object} message The message which will send to conversation.
  20184. * It could be a raw string, or an object with a `toJSON` method, like a
  20185. * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
  20186. * @param {Object} [options]
  20187. * @param {Boolean} [options.transient] Whether send this message as transient message or not.
  20188. * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
  20189. * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
  20190. * @param {AuthOptions} [authOptions]
  20191. * @return {Promise}
  20192. */
  20193. send: function send(fromClient, message) {
  20194. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  20195. var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  20196. var data = {
  20197. from_peer: fromClient,
  20198. conv_id: this.id,
  20199. transient: false,
  20200. message: serializeMessage(message)
  20201. };
  20202. if (options.toClients !== undefined) {
  20203. data.to_peers = options.toClients;
  20204. }
  20205. if (options.transient !== undefined) {
  20206. data.transient = options.transient ? true : false;
  20207. }
  20208. if (options.pushData !== undefined) {
  20209. data.push_data = options.pushData;
  20210. }
  20211. return _request('rtm', 'messages', null, 'POST', data, authOptions);
  20212. },
  20213. /**
  20214. * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
  20215. *
  20216. * @param {String} fromClient Sender's client id.
  20217. * @param {String|Object} message The message which will send to conversation.
  20218. * It could be a raw string, or an object with a `toJSON` method, like a
  20219. * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
  20220. * @param {Object} [options]
  20221. * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
  20222. * @param {Object} [options.validTill] The message will valid till this time.
  20223. * @param {AuthOptions} [authOptions]
  20224. * @return {Promise}
  20225. */
  20226. broadcast: function broadcast(fromClient, message) {
  20227. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  20228. var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  20229. var data = {
  20230. from_peer: fromClient,
  20231. conv_id: this.id,
  20232. message: serializeMessage(message)
  20233. };
  20234. if (options.pushData !== undefined) {
  20235. data.push = options.pushData;
  20236. }
  20237. if (options.validTill !== undefined) {
  20238. var ts = options.validTill;
  20239. if (_.isDate(ts)) {
  20240. ts = ts.getTime();
  20241. }
  20242. options.valid_till = ts;
  20243. }
  20244. return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
  20245. }
  20246. });
  20247. /***/ }),
  20248. /* 568 */
  20249. /***/ (function(module, exports, __webpack_require__) {
  20250. "use strict";
  20251. var _interopRequireDefault = __webpack_require__(1);
  20252. var _promise = _interopRequireDefault(__webpack_require__(12));
  20253. var _map = _interopRequireDefault(__webpack_require__(35));
  20254. var _concat = _interopRequireDefault(__webpack_require__(22));
  20255. var _ = __webpack_require__(3);
  20256. var _require = __webpack_require__(27),
  20257. request = _require.request;
  20258. var _require2 = __webpack_require__(30),
  20259. ensureArray = _require2.ensureArray,
  20260. parseDate = _require2.parseDate;
  20261. var AV = __webpack_require__(69);
  20262. /**
  20263. * The version change interval for Leaderboard
  20264. * @enum
  20265. */
  20266. AV.LeaderboardVersionChangeInterval = {
  20267. NEVER: 'never',
  20268. DAY: 'day',
  20269. WEEK: 'week',
  20270. MONTH: 'month'
  20271. };
  20272. /**
  20273. * The order of the leaderboard results
  20274. * @enum
  20275. */
  20276. AV.LeaderboardOrder = {
  20277. ASCENDING: 'ascending',
  20278. DESCENDING: 'descending'
  20279. };
  20280. /**
  20281. * The update strategy for Leaderboard
  20282. * @enum
  20283. */
  20284. AV.LeaderboardUpdateStrategy = {
  20285. /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
  20286. BETTER: 'better',
  20287. /** Keep the last updated statistic */
  20288. LAST: 'last',
  20289. /** Keep the sum of all updated statistics */
  20290. SUM: 'sum'
  20291. };
  20292. /**
  20293. * @typedef {Object} Ranking
  20294. * @property {number} rank Starts at 0
  20295. * @property {number} value the statistic value of this ranking
  20296. * @property {AV.User} user The user of this ranking
  20297. * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
  20298. */
  20299. /**
  20300. * @typedef {Object} LeaderboardArchive
  20301. * @property {string} statisticName
  20302. * @property {number} version version of the leaderboard
  20303. * @property {string} status
  20304. * @property {string} url URL for the downloadable archive
  20305. * @property {Date} activatedAt time when this version became active
  20306. * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
  20307. */
  20308. /**
  20309. * @class
  20310. */
  20311. function Statistic(_ref) {
  20312. var name = _ref.name,
  20313. value = _ref.value,
  20314. version = _ref.version;
  20315. /**
  20316. * @type {string}
  20317. */
  20318. this.name = name;
  20319. /**
  20320. * @type {number}
  20321. */
  20322. this.value = value;
  20323. /**
  20324. * @type {number?}
  20325. */
  20326. this.version = version;
  20327. }
  20328. var parseStatisticData = function parseStatisticData(statisticData) {
  20329. var _AV$_decode = AV._decode(statisticData),
  20330. name = _AV$_decode.statisticName,
  20331. value = _AV$_decode.statisticValue,
  20332. version = _AV$_decode.version;
  20333. return new Statistic({
  20334. name: name,
  20335. value: value,
  20336. version: version
  20337. });
  20338. };
  20339. /**
  20340. * @class
  20341. */
  20342. AV.Leaderboard = function Leaderboard(statisticName) {
  20343. /**
  20344. * @type {string}
  20345. */
  20346. this.statisticName = statisticName;
  20347. /**
  20348. * @type {AV.LeaderboardOrder}
  20349. */
  20350. this.order = undefined;
  20351. /**
  20352. * @type {AV.LeaderboardUpdateStrategy}
  20353. */
  20354. this.updateStrategy = undefined;
  20355. /**
  20356. * @type {AV.LeaderboardVersionChangeInterval}
  20357. */
  20358. this.versionChangeInterval = undefined;
  20359. /**
  20360. * @type {number}
  20361. */
  20362. this.version = undefined;
  20363. /**
  20364. * @type {Date?}
  20365. */
  20366. this.nextResetAt = undefined;
  20367. /**
  20368. * @type {Date?}
  20369. */
  20370. this.createdAt = undefined;
  20371. };
  20372. var Leaderboard = AV.Leaderboard;
  20373. /**
  20374. * Create an instance of Leaderboard for the give statistic name.
  20375. * @param {string} statisticName
  20376. * @return {AV.Leaderboard}
  20377. */
  20378. AV.Leaderboard.createWithoutData = function (statisticName) {
  20379. return new Leaderboard(statisticName);
  20380. };
  20381. /**
  20382. * (masterKey required) Create a new Leaderboard.
  20383. * @param {Object} options
  20384. * @param {string} options.statisticName
  20385. * @param {AV.LeaderboardOrder} options.order
  20386. * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
  20387. * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
  20388. * @param {AuthOptions} [authOptions]
  20389. * @return {Promise<AV.Leaderboard>}
  20390. */
  20391. AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
  20392. var statisticName = _ref2.statisticName,
  20393. order = _ref2.order,
  20394. versionChangeInterval = _ref2.versionChangeInterval,
  20395. updateStrategy = _ref2.updateStrategy;
  20396. return request({
  20397. method: 'POST',
  20398. path: '/leaderboard/leaderboards',
  20399. data: {
  20400. statisticName: statisticName,
  20401. order: order,
  20402. versionChangeInterval: versionChangeInterval,
  20403. updateStrategy: updateStrategy
  20404. },
  20405. authOptions: authOptions
  20406. }).then(function (data) {
  20407. var leaderboard = new Leaderboard(statisticName);
  20408. return leaderboard._finishFetch(data);
  20409. });
  20410. };
  20411. /**
  20412. * Get the Leaderboard with the specified statistic name.
  20413. * @param {string} statisticName
  20414. * @param {AuthOptions} [authOptions]
  20415. * @return {Promise<AV.Leaderboard>}
  20416. */
  20417. AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
  20418. return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
  20419. };
  20420. /**
  20421. * Get Statistics for the specified user.
  20422. * @param {AV.User} user The specified AV.User pointer.
  20423. * @param {Object} [options]
  20424. * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
  20425. * @param {AuthOptions} [authOptions]
  20426. * @return {Promise<Statistic[]>}
  20427. */
  20428. AV.Leaderboard.getStatistics = function (user) {
  20429. var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  20430. statisticNames = _ref3.statisticNames;
  20431. var authOptions = arguments.length > 2 ? arguments[2] : undefined;
  20432. return _promise.default.resolve().then(function () {
  20433. if (!(user && user.id)) throw new Error('user must be an AV.User');
  20434. return request({
  20435. method: 'GET',
  20436. path: "/leaderboard/users/".concat(user.id, "/statistics"),
  20437. query: {
  20438. statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
  20439. },
  20440. authOptions: authOptions
  20441. }).then(function (_ref4) {
  20442. var results = _ref4.results;
  20443. return (0, _map.default)(results).call(results, parseStatisticData);
  20444. });
  20445. });
  20446. };
  20447. /**
  20448. * Update Statistics for the specified user.
  20449. * @param {AV.User} user The specified AV.User pointer.
  20450. * @param {Object} statistics A name-value pair representing the statistics to update.
  20451. * @param {AuthOptions} [options] AuthOptions plus:
  20452. * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
  20453. * @return {Promise<Statistic[]>}
  20454. */
  20455. AV.Leaderboard.updateStatistics = function (user, statistics) {
  20456. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  20457. return _promise.default.resolve().then(function () {
  20458. if (!(user && user.id)) throw new Error('user must be an AV.User');
  20459. var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
  20460. return {
  20461. statisticName: key,
  20462. statisticValue: value
  20463. };
  20464. });
  20465. var overwrite = options.overwrite;
  20466. return request({
  20467. method: 'POST',
  20468. path: "/leaderboard/users/".concat(user.id, "/statistics"),
  20469. query: {
  20470. overwrite: overwrite ? 1 : undefined
  20471. },
  20472. data: data,
  20473. authOptions: options
  20474. }).then(function (_ref5) {
  20475. var results = _ref5.results;
  20476. return (0, _map.default)(results).call(results, parseStatisticData);
  20477. });
  20478. });
  20479. };
  20480. /**
  20481. * Delete Statistics for the specified user.
  20482. * @param {AV.User} user The specified AV.User pointer.
  20483. * @param {Object} statistics A name-value pair representing the statistics to delete.
  20484. * @param {AuthOptions} [options]
  20485. * @return {Promise<void>}
  20486. */
  20487. AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
  20488. return _promise.default.resolve().then(function () {
  20489. if (!(user && user.id)) throw new Error('user must be an AV.User');
  20490. return request({
  20491. method: 'DELETE',
  20492. path: "/leaderboard/users/".concat(user.id, "/statistics"),
  20493. query: {
  20494. statistics: ensureArray(statisticNames).join(',')
  20495. },
  20496. authOptions: authOptions
  20497. }).then(function () {
  20498. return undefined;
  20499. });
  20500. });
  20501. };
  20502. _.extend(Leaderboard.prototype,
  20503. /** @lends AV.Leaderboard.prototype */
  20504. {
  20505. _finishFetch: function _finishFetch(data) {
  20506. var _this = this;
  20507. _.forEach(data, function (value, key) {
  20508. if (key === 'updatedAt' || key === 'objectId') return;
  20509. if (key === 'expiredAt') {
  20510. key = 'nextResetAt';
  20511. }
  20512. if (key === 'createdAt') {
  20513. value = parseDate(value);
  20514. }
  20515. if (value && value.__type === 'Date') {
  20516. value = parseDate(value.iso);
  20517. }
  20518. _this[key] = value;
  20519. });
  20520. return this;
  20521. },
  20522. /**
  20523. * Fetch data from the srever.
  20524. * @param {AuthOptions} [authOptions]
  20525. * @return {Promise<AV.Leaderboard>}
  20526. */
  20527. fetch: function fetch(authOptions) {
  20528. var _this2 = this;
  20529. return request({
  20530. method: 'GET',
  20531. path: "/leaderboard/leaderboards/".concat(this.statisticName),
  20532. authOptions: authOptions
  20533. }).then(function (data) {
  20534. return _this2._finishFetch(data);
  20535. });
  20536. },
  20537. /**
  20538. * Counts the number of users participated in this leaderboard
  20539. * @param {Object} [options]
  20540. * @param {number} [options.version] Specify the version of the leaderboard
  20541. * @param {AuthOptions} [authOptions]
  20542. * @return {Promise<number>}
  20543. */
  20544. count: function count() {
  20545. var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20546. version = _ref6.version;
  20547. var authOptions = arguments.length > 1 ? arguments[1] : undefined;
  20548. return request({
  20549. method: 'GET',
  20550. path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
  20551. query: {
  20552. count: 1,
  20553. limit: 0,
  20554. version: version
  20555. },
  20556. authOptions: authOptions
  20557. }).then(function (_ref7) {
  20558. var count = _ref7.count;
  20559. return count;
  20560. });
  20561. },
  20562. _getResults: function _getResults(_ref8, authOptions, userId) {
  20563. var _context;
  20564. var skip = _ref8.skip,
  20565. limit = _ref8.limit,
  20566. selectUserKeys = _ref8.selectUserKeys,
  20567. includeUserKeys = _ref8.includeUserKeys,
  20568. includeStatistics = _ref8.includeStatistics,
  20569. version = _ref8.version;
  20570. return request({
  20571. method: 'GET',
  20572. path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
  20573. query: {
  20574. skip: skip,
  20575. limit: limit,
  20576. selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
  20577. includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
  20578. includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
  20579. version: version
  20580. },
  20581. authOptions: authOptions
  20582. }).then(function (_ref9) {
  20583. var rankings = _ref9.results;
  20584. return (0, _map.default)(rankings).call(rankings, function (rankingData) {
  20585. var _AV$_decode2 = AV._decode(rankingData),
  20586. user = _AV$_decode2.user,
  20587. value = _AV$_decode2.statisticValue,
  20588. rank = _AV$_decode2.rank,
  20589. _AV$_decode2$statisti = _AV$_decode2.statistics,
  20590. statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
  20591. return {
  20592. user: user,
  20593. value: value,
  20594. rank: rank,
  20595. includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
  20596. };
  20597. });
  20598. });
  20599. },
  20600. /**
  20601. * Retrieve a list of ranked users for this Leaderboard.
  20602. * @param {Object} [options]
  20603. * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
  20604. * @param {number} [options.limit] The limit of the number of results.
  20605. * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
  20606. * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
  20607. * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
  20608. * @param {number} [options.version] Specify the version of the leaderboard
  20609. * @param {AuthOptions} [authOptions]
  20610. * @return {Promise<Ranking[]>}
  20611. */
  20612. getResults: function getResults() {
  20613. var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20614. skip = _ref10.skip,
  20615. limit = _ref10.limit,
  20616. selectUserKeys = _ref10.selectUserKeys,
  20617. includeUserKeys = _ref10.includeUserKeys,
  20618. includeStatistics = _ref10.includeStatistics,
  20619. version = _ref10.version;
  20620. var authOptions = arguments.length > 1 ? arguments[1] : undefined;
  20621. return this._getResults({
  20622. skip: skip,
  20623. limit: limit,
  20624. selectUserKeys: selectUserKeys,
  20625. includeUserKeys: includeUserKeys,
  20626. includeStatistics: includeStatistics,
  20627. version: version
  20628. }, authOptions);
  20629. },
  20630. /**
  20631. * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
  20632. * @param {AV.User} user The specified AV.User pointer.
  20633. * @param {Object} [options]
  20634. * @param {number} [options.limit] The limit of the number of results.
  20635. * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
  20636. * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
  20637. * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
  20638. * @param {number} [options.version] Specify the version of the leaderboard
  20639. * @param {AuthOptions} [authOptions]
  20640. * @return {Promise<Ranking[]>}
  20641. */
  20642. getResultsAroundUser: function getResultsAroundUser(user) {
  20643. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20644. var authOptions = arguments.length > 2 ? arguments[2] : undefined;
  20645. // getResultsAroundUser(options, authOptions)
  20646. if (user && typeof user.id !== 'string') {
  20647. return this.getResultsAroundUser(undefined, user, options);
  20648. }
  20649. var limit = options.limit,
  20650. selectUserKeys = options.selectUserKeys,
  20651. includeUserKeys = options.includeUserKeys,
  20652. includeStatistics = options.includeStatistics,
  20653. version = options.version;
  20654. return this._getResults({
  20655. limit: limit,
  20656. selectUserKeys: selectUserKeys,
  20657. includeUserKeys: includeUserKeys,
  20658. includeStatistics: includeStatistics,
  20659. version: version
  20660. }, authOptions, user ? user.id : 'self');
  20661. },
  20662. _update: function _update(data, authOptions) {
  20663. var _this3 = this;
  20664. return request({
  20665. method: 'PUT',
  20666. path: "/leaderboard/leaderboards/".concat(this.statisticName),
  20667. data: data,
  20668. authOptions: authOptions
  20669. }).then(function (result) {
  20670. return _this3._finishFetch(result);
  20671. });
  20672. },
  20673. /**
  20674. * (masterKey required) Update the version change interval of the Leaderboard.
  20675. * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
  20676. * @param {AuthOptions} [authOptions]
  20677. * @return {Promise<AV.Leaderboard>}
  20678. */
  20679. updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
  20680. return this._update({
  20681. versionChangeInterval: versionChangeInterval
  20682. }, authOptions);
  20683. },
  20684. /**
  20685. * (masterKey required) Update the version change interval of the Leaderboard.
  20686. * @param {AV.LeaderboardUpdateStrategy} updateStrategy
  20687. * @param {AuthOptions} [authOptions]
  20688. * @return {Promise<AV.Leaderboard>}
  20689. */
  20690. updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
  20691. return this._update({
  20692. updateStrategy: updateStrategy
  20693. }, authOptions);
  20694. },
  20695. /**
  20696. * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
  20697. * @param {AuthOptions} [authOptions]
  20698. * @return {Promise<AV.Leaderboard>}
  20699. */
  20700. reset: function reset(authOptions) {
  20701. var _this4 = this;
  20702. return request({
  20703. method: 'PUT',
  20704. path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
  20705. authOptions: authOptions
  20706. }).then(function (data) {
  20707. return _this4._finishFetch(data);
  20708. });
  20709. },
  20710. /**
  20711. * (masterKey required) Delete the Leaderboard and its all archived versions.
  20712. * @param {AuthOptions} [authOptions]
  20713. * @return {void}
  20714. */
  20715. destroy: function destroy(authOptions) {
  20716. return AV.request({
  20717. method: 'DELETE',
  20718. path: "/leaderboard/leaderboards/".concat(this.statisticName),
  20719. authOptions: authOptions
  20720. }).then(function () {
  20721. return undefined;
  20722. });
  20723. },
  20724. /**
  20725. * (masterKey required) Get archived versions.
  20726. * @param {Object} [options]
  20727. * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
  20728. * @param {number} [options.limit] The limit of the number of results.
  20729. * @param {AuthOptions} [authOptions]
  20730. * @return {Promise<LeaderboardArchive[]>}
  20731. */
  20732. getArchives: function getArchives() {
  20733. var _this5 = this;
  20734. var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20735. skip = _ref11.skip,
  20736. limit = _ref11.limit;
  20737. var authOptions = arguments.length > 1 ? arguments[1] : undefined;
  20738. return request({
  20739. method: 'GET',
  20740. path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
  20741. query: {
  20742. skip: skip,
  20743. limit: limit
  20744. },
  20745. authOptions: authOptions
  20746. }).then(function (_ref12) {
  20747. var results = _ref12.results;
  20748. return (0, _map.default)(results).call(results, function (_ref13) {
  20749. var version = _ref13.version,
  20750. status = _ref13.status,
  20751. url = _ref13.url,
  20752. activatedAt = _ref13.activatedAt,
  20753. deactivatedAt = _ref13.deactivatedAt;
  20754. return {
  20755. statisticName: _this5.statisticName,
  20756. version: version,
  20757. status: status,
  20758. url: url,
  20759. activatedAt: parseDate(activatedAt.iso),
  20760. deactivatedAt: parseDate(deactivatedAt.iso)
  20761. };
  20762. });
  20763. });
  20764. }
  20765. });
  20766. /***/ }),
  20767. /* 569 */
  20768. /***/ (function(module, exports, __webpack_require__) {
  20769. "use strict";
  20770. var _interopRequireDefault = __webpack_require__(1);
  20771. var _typeof2 = _interopRequireDefault(__webpack_require__(73));
  20772. var _defineProperty = _interopRequireDefault(__webpack_require__(92));
  20773. var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238));
  20774. var _assign2 = _interopRequireDefault(__webpack_require__(152));
  20775. var _indexOf = _interopRequireDefault(__webpack_require__(71));
  20776. var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
  20777. var _promise = _interopRequireDefault(__webpack_require__(12));
  20778. var _symbol = _interopRequireDefault(__webpack_require__(149));
  20779. var _iterator = _interopRequireDefault(__webpack_require__(576));
  20780. var _weakMap = _interopRequireDefault(__webpack_require__(260));
  20781. var _keys = _interopRequireDefault(__webpack_require__(115));
  20782. var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
  20783. var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
  20784. var _map = _interopRequireDefault(__webpack_require__(583));
  20785. (0, _defineProperty.default)(exports, '__esModule', {
  20786. value: true
  20787. });
  20788. /******************************************************************************
  20789. Copyright (c) Microsoft Corporation.
  20790. Permission to use, copy, modify, and/or distribute this software for any
  20791. purpose with or without fee is hereby granted.
  20792. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  20793. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20794. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  20795. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  20796. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  20797. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20798. PERFORMANCE OF THIS SOFTWARE.
  20799. ***************************************************************************** */
  20800. /* global Reflect, Promise */
  20801. var _extendStatics$ = function extendStatics$1(d, b) {
  20802. _extendStatics$ = _setPrototypeOf.default || {
  20803. __proto__: []
  20804. } instanceof Array && function (d, b) {
  20805. d.__proto__ = b;
  20806. } || function (d, b) {
  20807. for (var p in b) {
  20808. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  20809. }
  20810. };
  20811. return _extendStatics$(d, b);
  20812. };
  20813. function __extends$1(d, b) {
  20814. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  20815. _extendStatics$(d, b);
  20816. function __() {
  20817. this.constructor = d;
  20818. }
  20819. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20820. }
  20821. var _assign = function __assign() {
  20822. _assign = _assign2.default || function __assign(t) {
  20823. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20824. s = arguments[i];
  20825. for (var p in s) {
  20826. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20827. }
  20828. }
  20829. return t;
  20830. };
  20831. return _assign.apply(this, arguments);
  20832. };
  20833. function __rest(s, e) {
  20834. var t = {};
  20835. for (var p in s) {
  20836. if (Object.prototype.hasOwnProperty.call(s, p) && (0, _indexOf.default)(e).call(e, p) < 0) t[p] = s[p];
  20837. }
  20838. if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) {
  20839. if ((0, _indexOf.default)(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  20840. }
  20841. return t;
  20842. }
  20843. function __awaiter(thisArg, _arguments, P, generator) {
  20844. function adopt(value) {
  20845. return value instanceof P ? value : new P(function (resolve) {
  20846. resolve(value);
  20847. });
  20848. }
  20849. return new (P || (P = _promise.default))(function (resolve, reject) {
  20850. function fulfilled(value) {
  20851. try {
  20852. step(generator.next(value));
  20853. } catch (e) {
  20854. reject(e);
  20855. }
  20856. }
  20857. function rejected(value) {
  20858. try {
  20859. step(generator["throw"](value));
  20860. } catch (e) {
  20861. reject(e);
  20862. }
  20863. }
  20864. function step(result) {
  20865. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  20866. }
  20867. step((generator = generator.apply(thisArg, _arguments || [])).next());
  20868. });
  20869. }
  20870. function __generator(thisArg, body) {
  20871. var _ = {
  20872. label: 0,
  20873. sent: function sent() {
  20874. if (t[0] & 1) throw t[1];
  20875. return t[1];
  20876. },
  20877. trys: [],
  20878. ops: []
  20879. },
  20880. f,
  20881. y,
  20882. t,
  20883. g;
  20884. return g = {
  20885. next: verb(0),
  20886. "throw": verb(1),
  20887. "return": verb(2)
  20888. }, typeof _symbol.default === "function" && (g[_iterator.default] = function () {
  20889. return this;
  20890. }), g;
  20891. function verb(n) {
  20892. return function (v) {
  20893. return step([n, v]);
  20894. };
  20895. }
  20896. function step(op) {
  20897. if (f) throw new TypeError("Generator is already executing.");
  20898. while (_) {
  20899. try {
  20900. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  20901. if (y = 0, t) op = [op[0] & 2, t.value];
  20902. switch (op[0]) {
  20903. case 0:
  20904. case 1:
  20905. t = op;
  20906. break;
  20907. case 4:
  20908. _.label++;
  20909. return {
  20910. value: op[1],
  20911. done: false
  20912. };
  20913. case 5:
  20914. _.label++;
  20915. y = op[1];
  20916. op = [0];
  20917. continue;
  20918. case 7:
  20919. op = _.ops.pop();
  20920. _.trys.pop();
  20921. continue;
  20922. default:
  20923. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  20924. _ = 0;
  20925. continue;
  20926. }
  20927. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  20928. _.label = op[1];
  20929. break;
  20930. }
  20931. if (op[0] === 6 && _.label < t[1]) {
  20932. _.label = t[1];
  20933. t = op;
  20934. break;
  20935. }
  20936. if (t && _.label < t[2]) {
  20937. _.label = t[2];
  20938. _.ops.push(op);
  20939. break;
  20940. }
  20941. if (t[2]) _.ops.pop();
  20942. _.trys.pop();
  20943. continue;
  20944. }
  20945. op = body.call(thisArg, _);
  20946. } catch (e) {
  20947. op = [6, e];
  20948. y = 0;
  20949. } finally {
  20950. f = t = 0;
  20951. }
  20952. }
  20953. if (op[0] & 5) throw op[1];
  20954. return {
  20955. value: op[0] ? op[1] : void 0,
  20956. done: true
  20957. };
  20958. }
  20959. }
  20960. var PROVIDER = "lc_weapp";
  20961. var PLATFORM = "weixin";
  20962. function getLoginCode() {
  20963. return new _promise.default(function (resolve, reject) {
  20964. wx.login({
  20965. success: function success(res) {
  20966. return res.code ? resolve(res.code) : reject(new Error(res.errMsg));
  20967. },
  20968. fail: function fail(_a) {
  20969. var errMsg = _a.errMsg;
  20970. return reject(new Error(errMsg));
  20971. }
  20972. });
  20973. });
  20974. }
  20975. var getAuthInfo = function getAuthInfo(_a) {
  20976. var _b = _a === void 0 ? {} : _a,
  20977. _c = _b.platform,
  20978. platform = _c === void 0 ? PLATFORM : _c,
  20979. _d = _b.preferUnionId,
  20980. preferUnionId = _d === void 0 ? false : _d,
  20981. _e = _b.asMainAccount,
  20982. asMainAccount = _e === void 0 ? false : _e;
  20983. return __awaiter(this, void 0, void 0, function () {
  20984. var code, authData;
  20985. return __generator(this, function (_f) {
  20986. switch (_f.label) {
  20987. case 0:
  20988. return [4
  20989. /*yield*/
  20990. , getLoginCode()];
  20991. case 1:
  20992. code = _f.sent();
  20993. authData = {
  20994. code: code
  20995. };
  20996. if (preferUnionId) {
  20997. authData.platform = platform;
  20998. authData.main_account = asMainAccount;
  20999. }
  21000. return [2
  21001. /*return*/
  21002. , {
  21003. authData: authData,
  21004. platform: platform,
  21005. provider: PROVIDER
  21006. }];
  21007. }
  21008. });
  21009. });
  21010. };
  21011. var storage = {
  21012. getItem: function getItem(key) {
  21013. return wx.getStorageSync(key);
  21014. },
  21015. setItem: function setItem(key, value) {
  21016. return wx.setStorageSync(key, value);
  21017. },
  21018. removeItem: function removeItem(key) {
  21019. return wx.removeStorageSync(key);
  21020. },
  21021. clear: function clear() {
  21022. return wx.clearStorageSync();
  21023. }
  21024. };
  21025. /******************************************************************************
  21026. Copyright (c) Microsoft Corporation.
  21027. Permission to use, copy, modify, and/or distribute this software for any
  21028. purpose with or without fee is hereby granted.
  21029. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  21030. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  21031. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  21032. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  21033. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  21034. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  21035. PERFORMANCE OF THIS SOFTWARE.
  21036. ***************************************************************************** */
  21037. /* global Reflect, Promise */
  21038. var _extendStatics = function extendStatics(d, b) {
  21039. _extendStatics = _setPrototypeOf.default || {
  21040. __proto__: []
  21041. } instanceof Array && function (d, b) {
  21042. d.__proto__ = b;
  21043. } || function (d, b) {
  21044. for (var p in b) {
  21045. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  21046. }
  21047. };
  21048. return _extendStatics(d, b);
  21049. };
  21050. function __extends(d, b) {
  21051. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  21052. _extendStatics(d, b);
  21053. function __() {
  21054. this.constructor = d;
  21055. }
  21056. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21057. }
  21058. var AbortError =
  21059. /** @class */
  21060. function (_super) {
  21061. __extends(AbortError, _super);
  21062. function AbortError() {
  21063. var _this = _super !== null && _super.apply(this, arguments) || this;
  21064. _this.name = "AbortError";
  21065. return _this;
  21066. }
  21067. return AbortError;
  21068. }(Error);
  21069. var request = function request(url, options) {
  21070. if (options === void 0) {
  21071. options = {};
  21072. }
  21073. var method = options.method,
  21074. data = options.data,
  21075. headers = options.headers,
  21076. signal = options.signal;
  21077. if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
  21078. return _promise.default.reject(new AbortError("Request aborted"));
  21079. }
  21080. return new _promise.default(function (resolve, reject) {
  21081. var task = wx.request({
  21082. url: url,
  21083. method: method,
  21084. data: data,
  21085. header: headers,
  21086. complete: function complete(res) {
  21087. signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
  21088. if (!res.statusCode) {
  21089. reject(new Error(res.errMsg));
  21090. return;
  21091. }
  21092. resolve({
  21093. ok: !(res.statusCode >= 400),
  21094. status: res.statusCode,
  21095. headers: res.header,
  21096. data: res.data
  21097. });
  21098. }
  21099. });
  21100. var abortListener = function abortListener() {
  21101. reject(new AbortError("Request aborted"));
  21102. task.abort();
  21103. };
  21104. signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
  21105. });
  21106. };
  21107. var upload = function upload(url, file, options) {
  21108. if (options === void 0) {
  21109. options = {};
  21110. }
  21111. var headers = options.headers,
  21112. data = options.data,
  21113. onprogress = options.onprogress,
  21114. signal = options.signal;
  21115. if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
  21116. return _promise.default.reject(new AbortError("Request aborted"));
  21117. }
  21118. if (!(file && file.data && file.data.uri)) {
  21119. return _promise.default.reject(new TypeError("File data must be an object like { uri: localPath }."));
  21120. }
  21121. return new _promise.default(function (resolve, reject) {
  21122. var task = wx.uploadFile({
  21123. url: url,
  21124. header: headers,
  21125. filePath: file.data.uri,
  21126. name: file.field,
  21127. formData: data,
  21128. success: function success(response) {
  21129. var status = response.statusCode,
  21130. data = response.data,
  21131. rest = __rest(response, ["statusCode", "data"]);
  21132. resolve(_assign(_assign({}, rest), {
  21133. data: typeof data === "string" ? JSON.parse(data) : data,
  21134. status: status,
  21135. ok: !(status >= 400)
  21136. }));
  21137. },
  21138. fail: function fail(response) {
  21139. reject(new Error(response.errMsg));
  21140. },
  21141. complete: function complete() {
  21142. signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
  21143. }
  21144. });
  21145. var abortListener = function abortListener() {
  21146. reject(new AbortError("Request aborted"));
  21147. task.abort();
  21148. };
  21149. signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
  21150. if (onprogress) {
  21151. task.onProgressUpdate(function (event) {
  21152. return onprogress({
  21153. loaded: event.totalBytesSent,
  21154. total: event.totalBytesExpectedToSend,
  21155. percent: event.progress
  21156. });
  21157. });
  21158. }
  21159. });
  21160. };
  21161. /**
  21162. * @author Toru Nagashima <https://github.com/mysticatea>
  21163. * @copyright 2015 Toru Nagashima. All rights reserved.
  21164. * See LICENSE file in root directory for full license.
  21165. */
  21166. /**
  21167. * @typedef {object} PrivateData
  21168. * @property {EventTarget} eventTarget The event target.
  21169. * @property {{type:string}} event The original event object.
  21170. * @property {number} eventPhase The current event phase.
  21171. * @property {EventTarget|null} currentTarget The current event target.
  21172. * @property {boolean} canceled The flag to prevent default.
  21173. * @property {boolean} stopped The flag to stop propagation.
  21174. * @property {boolean} immediateStopped The flag to stop propagation immediately.
  21175. * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
  21176. * @property {number} timeStamp The unix time.
  21177. * @private
  21178. */
  21179. /**
  21180. * Private data for event wrappers.
  21181. * @type {WeakMap<Event, PrivateData>}
  21182. * @private
  21183. */
  21184. var privateData = new _weakMap.default();
  21185. /**
  21186. * Cache for wrapper classes.
  21187. * @type {WeakMap<Object, Function>}
  21188. * @private
  21189. */
  21190. var wrappers = new _weakMap.default();
  21191. /**
  21192. * Get private data.
  21193. * @param {Event} event The event object to get private data.
  21194. * @returns {PrivateData} The private data of the event.
  21195. * @private
  21196. */
  21197. function pd(event) {
  21198. var retv = privateData.get(event);
  21199. console.assert(retv != null, "'this' is expected an Event object, but got", event);
  21200. return retv;
  21201. }
  21202. /**
  21203. * https://dom.spec.whatwg.org/#set-the-canceled-flag
  21204. * @param data {PrivateData} private data.
  21205. */
  21206. function setCancelFlag(data) {
  21207. if (data.passiveListener != null) {
  21208. if (typeof console !== "undefined" && typeof console.error === "function") {
  21209. console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
  21210. }
  21211. return;
  21212. }
  21213. if (!data.event.cancelable) {
  21214. return;
  21215. }
  21216. data.canceled = true;
  21217. if (typeof data.event.preventDefault === "function") {
  21218. data.event.preventDefault();
  21219. }
  21220. }
  21221. /**
  21222. * @see https://dom.spec.whatwg.org/#interface-event
  21223. * @private
  21224. */
  21225. /**
  21226. * The event wrapper.
  21227. * @constructor
  21228. * @param {EventTarget} eventTarget The event target of this dispatching.
  21229. * @param {Event|{type:string}} event The original event to wrap.
  21230. */
  21231. function Event(eventTarget, event) {
  21232. privateData.set(this, {
  21233. eventTarget: eventTarget,
  21234. event: event,
  21235. eventPhase: 2,
  21236. currentTarget: eventTarget,
  21237. canceled: false,
  21238. stopped: false,
  21239. immediateStopped: false,
  21240. passiveListener: null,
  21241. timeStamp: event.timeStamp || Date.now()
  21242. }); // https://heycam.github.io/webidl/#Unforgeable
  21243. (0, _defineProperty.default)(this, "isTrusted", {
  21244. value: false,
  21245. enumerable: true
  21246. }); // Define accessors
  21247. var keys = (0, _keys.default)(event);
  21248. for (var i = 0; i < keys.length; ++i) {
  21249. var key = keys[i];
  21250. if (!(key in this)) {
  21251. (0, _defineProperty.default)(this, key, defineRedirectDescriptor(key));
  21252. }
  21253. }
  21254. } // Should be enumerable, but class methods are not enumerable.
  21255. Event.prototype = {
  21256. /**
  21257. * The type of this event.
  21258. * @type {string}
  21259. */
  21260. get type() {
  21261. return pd(this).event.type;
  21262. },
  21263. /**
  21264. * The target of this event.
  21265. * @type {EventTarget}
  21266. */
  21267. get target() {
  21268. return pd(this).eventTarget;
  21269. },
  21270. /**
  21271. * The target of this event.
  21272. * @type {EventTarget}
  21273. */
  21274. get currentTarget() {
  21275. return pd(this).currentTarget;
  21276. },
  21277. /**
  21278. * @returns {EventTarget[]} The composed path of this event.
  21279. */
  21280. composedPath: function composedPath() {
  21281. var currentTarget = pd(this).currentTarget;
  21282. if (currentTarget == null) {
  21283. return [];
  21284. }
  21285. return [currentTarget];
  21286. },
  21287. /**
  21288. * Constant of NONE.
  21289. * @type {number}
  21290. */
  21291. get NONE() {
  21292. return 0;
  21293. },
  21294. /**
  21295. * Constant of CAPTURING_PHASE.
  21296. * @type {number}
  21297. */
  21298. get CAPTURING_PHASE() {
  21299. return 1;
  21300. },
  21301. /**
  21302. * Constant of AT_TARGET.
  21303. * @type {number}
  21304. */
  21305. get AT_TARGET() {
  21306. return 2;
  21307. },
  21308. /**
  21309. * Constant of BUBBLING_PHASE.
  21310. * @type {number}
  21311. */
  21312. get BUBBLING_PHASE() {
  21313. return 3;
  21314. },
  21315. /**
  21316. * The target of this event.
  21317. * @type {number}
  21318. */
  21319. get eventPhase() {
  21320. return pd(this).eventPhase;
  21321. },
  21322. /**
  21323. * Stop event bubbling.
  21324. * @returns {void}
  21325. */
  21326. stopPropagation: function stopPropagation() {
  21327. var data = pd(this);
  21328. data.stopped = true;
  21329. if (typeof data.event.stopPropagation === "function") {
  21330. data.event.stopPropagation();
  21331. }
  21332. },
  21333. /**
  21334. * Stop event bubbling.
  21335. * @returns {void}
  21336. */
  21337. stopImmediatePropagation: function stopImmediatePropagation() {
  21338. var data = pd(this);
  21339. data.stopped = true;
  21340. data.immediateStopped = true;
  21341. if (typeof data.event.stopImmediatePropagation === "function") {
  21342. data.event.stopImmediatePropagation();
  21343. }
  21344. },
  21345. /**
  21346. * The flag to be bubbling.
  21347. * @type {boolean}
  21348. */
  21349. get bubbles() {
  21350. return Boolean(pd(this).event.bubbles);
  21351. },
  21352. /**
  21353. * The flag to be cancelable.
  21354. * @type {boolean}
  21355. */
  21356. get cancelable() {
  21357. return Boolean(pd(this).event.cancelable);
  21358. },
  21359. /**
  21360. * Cancel this event.
  21361. * @returns {void}
  21362. */
  21363. preventDefault: function preventDefault() {
  21364. setCancelFlag(pd(this));
  21365. },
  21366. /**
  21367. * The flag to indicate cancellation state.
  21368. * @type {boolean}
  21369. */
  21370. get defaultPrevented() {
  21371. return pd(this).canceled;
  21372. },
  21373. /**
  21374. * The flag to be composed.
  21375. * @type {boolean}
  21376. */
  21377. get composed() {
  21378. return Boolean(pd(this).event.composed);
  21379. },
  21380. /**
  21381. * The unix time of this event.
  21382. * @type {number}
  21383. */
  21384. get timeStamp() {
  21385. return pd(this).timeStamp;
  21386. },
  21387. /**
  21388. * The target of this event.
  21389. * @type {EventTarget}
  21390. * @deprecated
  21391. */
  21392. get srcElement() {
  21393. return pd(this).eventTarget;
  21394. },
  21395. /**
  21396. * The flag to stop event bubbling.
  21397. * @type {boolean}
  21398. * @deprecated
  21399. */
  21400. get cancelBubble() {
  21401. return pd(this).stopped;
  21402. },
  21403. set cancelBubble(value) {
  21404. if (!value) {
  21405. return;
  21406. }
  21407. var data = pd(this);
  21408. data.stopped = true;
  21409. if (typeof data.event.cancelBubble === "boolean") {
  21410. data.event.cancelBubble = true;
  21411. }
  21412. },
  21413. /**
  21414. * The flag to indicate cancellation state.
  21415. * @type {boolean}
  21416. * @deprecated
  21417. */
  21418. get returnValue() {
  21419. return !pd(this).canceled;
  21420. },
  21421. set returnValue(value) {
  21422. if (!value) {
  21423. setCancelFlag(pd(this));
  21424. }
  21425. },
  21426. /**
  21427. * Initialize this event object. But do nothing under event dispatching.
  21428. * @param {string} type The event type.
  21429. * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
  21430. * @param {boolean} [cancelable=false] The flag to be possible to cancel.
  21431. * @deprecated
  21432. */
  21433. initEvent: function initEvent() {// Do nothing.
  21434. }
  21435. }; // `constructor` is not enumerable.
  21436. (0, _defineProperty.default)(Event.prototype, "constructor", {
  21437. value: Event,
  21438. configurable: true,
  21439. writable: true
  21440. }); // Ensure `event instanceof window.Event` is `true`.
  21441. if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
  21442. (0, _setPrototypeOf.default)(Event.prototype, window.Event.prototype); // Make association for wrappers.
  21443. wrappers.set(window.Event.prototype, Event);
  21444. }
  21445. /**
  21446. * Get the property descriptor to redirect a given property.
  21447. * @param {string} key Property name to define property descriptor.
  21448. * @returns {PropertyDescriptor} The property descriptor to redirect the property.
  21449. * @private
  21450. */
  21451. function defineRedirectDescriptor(key) {
  21452. return {
  21453. get: function get() {
  21454. return pd(this).event[key];
  21455. },
  21456. set: function set(value) {
  21457. pd(this).event[key] = value;
  21458. },
  21459. configurable: true,
  21460. enumerable: true
  21461. };
  21462. }
  21463. /**
  21464. * Get the property descriptor to call a given method property.
  21465. * @param {string} key Property name to define property descriptor.
  21466. * @returns {PropertyDescriptor} The property descriptor to call the method property.
  21467. * @private
  21468. */
  21469. function defineCallDescriptor(key) {
  21470. return {
  21471. value: function value() {
  21472. var event = pd(this).event;
  21473. return event[key].apply(event, arguments);
  21474. },
  21475. configurable: true,
  21476. enumerable: true
  21477. };
  21478. }
  21479. /**
  21480. * Define new wrapper class.
  21481. * @param {Function} BaseEvent The base wrapper class.
  21482. * @param {Object} proto The prototype of the original event.
  21483. * @returns {Function} The defined wrapper class.
  21484. * @private
  21485. */
  21486. function defineWrapper(BaseEvent, proto) {
  21487. var keys = (0, _keys.default)(proto);
  21488. if (keys.length === 0) {
  21489. return BaseEvent;
  21490. }
  21491. /** CustomEvent */
  21492. function CustomEvent(eventTarget, event) {
  21493. BaseEvent.call(this, eventTarget, event);
  21494. }
  21495. CustomEvent.prototype = Object.create(BaseEvent.prototype, {
  21496. constructor: {
  21497. value: CustomEvent,
  21498. configurable: true,
  21499. writable: true
  21500. }
  21501. }); // Define accessors.
  21502. for (var i = 0; i < keys.length; ++i) {
  21503. var key = keys[i];
  21504. if (!(key in BaseEvent.prototype)) {
  21505. var descriptor = (0, _getOwnPropertyDescriptor.default)(proto, key);
  21506. var isFunc = typeof descriptor.value === "function";
  21507. (0, _defineProperty.default)(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
  21508. }
  21509. }
  21510. return CustomEvent;
  21511. }
  21512. /**
  21513. * Get the wrapper class of a given prototype.
  21514. * @param {Object} proto The prototype of the original event to get its wrapper.
  21515. * @returns {Function} The wrapper class.
  21516. * @private
  21517. */
  21518. function getWrapper(proto) {
  21519. if (proto == null || proto === Object.prototype) {
  21520. return Event;
  21521. }
  21522. var wrapper = wrappers.get(proto);
  21523. if (wrapper == null) {
  21524. wrapper = defineWrapper(getWrapper((0, _getPrototypeOf.default)(proto)), proto);
  21525. wrappers.set(proto, wrapper);
  21526. }
  21527. return wrapper;
  21528. }
  21529. /**
  21530. * Wrap a given event to management a dispatching.
  21531. * @param {EventTarget} eventTarget The event target of this dispatching.
  21532. * @param {Object} event The event to wrap.
  21533. * @returns {Event} The wrapper instance.
  21534. * @private
  21535. */
  21536. function wrapEvent(eventTarget, event) {
  21537. var Wrapper = getWrapper((0, _getPrototypeOf.default)(event));
  21538. return new Wrapper(eventTarget, event);
  21539. }
  21540. /**
  21541. * Get the immediateStopped flag of a given event.
  21542. * @param {Event} event The event to get.
  21543. * @returns {boolean} The flag to stop propagation immediately.
  21544. * @private
  21545. */
  21546. function isStopped(event) {
  21547. return pd(event).immediateStopped;
  21548. }
  21549. /**
  21550. * Set the current event phase of a given event.
  21551. * @param {Event} event The event to set current target.
  21552. * @param {number} eventPhase New event phase.
  21553. * @returns {void}
  21554. * @private
  21555. */
  21556. function setEventPhase(event, eventPhase) {
  21557. pd(event).eventPhase = eventPhase;
  21558. }
  21559. /**
  21560. * Set the current target of a given event.
  21561. * @param {Event} event The event to set current target.
  21562. * @param {EventTarget|null} currentTarget New current target.
  21563. * @returns {void}
  21564. * @private
  21565. */
  21566. function setCurrentTarget(event, currentTarget) {
  21567. pd(event).currentTarget = currentTarget;
  21568. }
  21569. /**
  21570. * Set a passive listener of a given event.
  21571. * @param {Event} event The event to set current target.
  21572. * @param {Function|null} passiveListener New passive listener.
  21573. * @returns {void}
  21574. * @private
  21575. */
  21576. function setPassiveListener(event, passiveListener) {
  21577. pd(event).passiveListener = passiveListener;
  21578. }
  21579. /**
  21580. * @typedef {object} ListenerNode
  21581. * @property {Function} listener
  21582. * @property {1|2|3} listenerType
  21583. * @property {boolean} passive
  21584. * @property {boolean} once
  21585. * @property {ListenerNode|null} next
  21586. * @private
  21587. */
  21588. /**
  21589. * @type {WeakMap<object, Map<string, ListenerNode>>}
  21590. * @private
  21591. */
  21592. var listenersMap = new _weakMap.default(); // Listener types
  21593. var CAPTURE = 1;
  21594. var BUBBLE = 2;
  21595. var ATTRIBUTE = 3;
  21596. /**
  21597. * Check whether a given value is an object or not.
  21598. * @param {any} x The value to check.
  21599. * @returns {boolean} `true` if the value is an object.
  21600. */
  21601. function isObject(x) {
  21602. return x !== null && (0, _typeof2.default)(x) === "object"; //eslint-disable-line no-restricted-syntax
  21603. }
  21604. /**
  21605. * Get listeners.
  21606. * @param {EventTarget} eventTarget The event target to get.
  21607. * @returns {Map<string, ListenerNode>} The listeners.
  21608. * @private
  21609. */
  21610. function getListeners(eventTarget) {
  21611. var listeners = listenersMap.get(eventTarget);
  21612. if (listeners == null) {
  21613. throw new TypeError("'this' is expected an EventTarget object, but got another value.");
  21614. }
  21615. return listeners;
  21616. }
  21617. /**
  21618. * Get the property descriptor for the event attribute of a given event.
  21619. * @param {string} eventName The event name to get property descriptor.
  21620. * @returns {PropertyDescriptor} The property descriptor.
  21621. * @private
  21622. */
  21623. function defineEventAttributeDescriptor(eventName) {
  21624. return {
  21625. get: function get() {
  21626. var listeners = getListeners(this);
  21627. var node = listeners.get(eventName);
  21628. while (node != null) {
  21629. if (node.listenerType === ATTRIBUTE) {
  21630. return node.listener;
  21631. }
  21632. node = node.next;
  21633. }
  21634. return null;
  21635. },
  21636. set: function set(listener) {
  21637. if (typeof listener !== "function" && !isObject(listener)) {
  21638. listener = null; // eslint-disable-line no-param-reassign
  21639. }
  21640. var listeners = getListeners(this); // Traverse to the tail while removing old value.
  21641. var prev = null;
  21642. var node = listeners.get(eventName);
  21643. while (node != null) {
  21644. if (node.listenerType === ATTRIBUTE) {
  21645. // Remove old value.
  21646. if (prev !== null) {
  21647. prev.next = node.next;
  21648. } else if (node.next !== null) {
  21649. listeners.set(eventName, node.next);
  21650. } else {
  21651. listeners.delete(eventName);
  21652. }
  21653. } else {
  21654. prev = node;
  21655. }
  21656. node = node.next;
  21657. } // Add new value.
  21658. if (listener !== null) {
  21659. var newNode = {
  21660. listener: listener,
  21661. listenerType: ATTRIBUTE,
  21662. passive: false,
  21663. once: false,
  21664. next: null
  21665. };
  21666. if (prev === null) {
  21667. listeners.set(eventName, newNode);
  21668. } else {
  21669. prev.next = newNode;
  21670. }
  21671. }
  21672. },
  21673. configurable: true,
  21674. enumerable: true
  21675. };
  21676. }
  21677. /**
  21678. * Define an event attribute (e.g. `eventTarget.onclick`).
  21679. * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
  21680. * @param {string} eventName The event name to define.
  21681. * @returns {void}
  21682. */
  21683. function defineEventAttribute(eventTargetPrototype, eventName) {
  21684. (0, _defineProperty.default)(eventTargetPrototype, "on".concat(eventName), defineEventAttributeDescriptor(eventName));
  21685. }
  21686. /**
  21687. * Define a custom EventTarget with event attributes.
  21688. * @param {string[]} eventNames Event names for event attributes.
  21689. * @returns {EventTarget} The custom EventTarget.
  21690. * @private
  21691. */
  21692. function defineCustomEventTarget(eventNames) {
  21693. /** CustomEventTarget */
  21694. function CustomEventTarget() {
  21695. EventTarget.call(this);
  21696. }
  21697. CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
  21698. constructor: {
  21699. value: CustomEventTarget,
  21700. configurable: true,
  21701. writable: true
  21702. }
  21703. });
  21704. for (var i = 0; i < eventNames.length; ++i) {
  21705. defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
  21706. }
  21707. return CustomEventTarget;
  21708. }
  21709. /**
  21710. * EventTarget.
  21711. *
  21712. * - This is constructor if no arguments.
  21713. * - This is a function which returns a CustomEventTarget constructor if there are arguments.
  21714. *
  21715. * For example:
  21716. *
  21717. * class A extends EventTarget {}
  21718. * class B extends EventTarget("message") {}
  21719. * class C extends EventTarget("message", "error") {}
  21720. * class D extends EventTarget(["message", "error"]) {}
  21721. */
  21722. function EventTarget() {
  21723. /*eslint-disable consistent-return */
  21724. if (this instanceof EventTarget) {
  21725. listenersMap.set(this, new _map.default());
  21726. return;
  21727. }
  21728. if (arguments.length === 1 && Array.isArray(arguments[0])) {
  21729. return defineCustomEventTarget(arguments[0]);
  21730. }
  21731. if (arguments.length > 0) {
  21732. var types = new Array(arguments.length);
  21733. for (var i = 0; i < arguments.length; ++i) {
  21734. types[i] = arguments[i];
  21735. }
  21736. return defineCustomEventTarget(types);
  21737. }
  21738. throw new TypeError("Cannot call a class as a function");
  21739. /*eslint-enable consistent-return */
  21740. } // Should be enumerable, but class methods are not enumerable.
  21741. EventTarget.prototype = {
  21742. /**
  21743. * Add a given listener to this event target.
  21744. * @param {string} eventName The event name to add.
  21745. * @param {Function} listener The listener to add.
  21746. * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
  21747. * @returns {void}
  21748. */
  21749. addEventListener: function addEventListener(eventName, listener, options) {
  21750. if (listener == null) {
  21751. return;
  21752. }
  21753. if (typeof listener !== "function" && !isObject(listener)) {
  21754. throw new TypeError("'listener' should be a function or an object.");
  21755. }
  21756. var listeners = getListeners(this);
  21757. var optionsIsObj = isObject(options);
  21758. var capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
  21759. var listenerType = capture ? CAPTURE : BUBBLE;
  21760. var newNode = {
  21761. listener: listener,
  21762. listenerType: listenerType,
  21763. passive: optionsIsObj && Boolean(options.passive),
  21764. once: optionsIsObj && Boolean(options.once),
  21765. next: null
  21766. }; // Set it as the first node if the first node is null.
  21767. var node = listeners.get(eventName);
  21768. if (node === undefined) {
  21769. listeners.set(eventName, newNode);
  21770. return;
  21771. } // Traverse to the tail while checking duplication..
  21772. var prev = null;
  21773. while (node != null) {
  21774. if (node.listener === listener && node.listenerType === listenerType) {
  21775. // Should ignore duplication.
  21776. return;
  21777. }
  21778. prev = node;
  21779. node = node.next;
  21780. } // Add it.
  21781. prev.next = newNode;
  21782. },
  21783. /**
  21784. * Remove a given listener from this event target.
  21785. * @param {string} eventName The event name to remove.
  21786. * @param {Function} listener The listener to remove.
  21787. * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
  21788. * @returns {void}
  21789. */
  21790. removeEventListener: function removeEventListener(eventName, listener, options) {
  21791. if (listener == null) {
  21792. return;
  21793. }
  21794. var listeners = getListeners(this);
  21795. var capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
  21796. var listenerType = capture ? CAPTURE : BUBBLE;
  21797. var prev = null;
  21798. var node = listeners.get(eventName);
  21799. while (node != null) {
  21800. if (node.listener === listener && node.listenerType === listenerType) {
  21801. if (prev !== null) {
  21802. prev.next = node.next;
  21803. } else if (node.next !== null) {
  21804. listeners.set(eventName, node.next);
  21805. } else {
  21806. listeners.delete(eventName);
  21807. }
  21808. return;
  21809. }
  21810. prev = node;
  21811. node = node.next;
  21812. }
  21813. },
  21814. /**
  21815. * Dispatch a given event.
  21816. * @param {Event|{type:string}} event The event to dispatch.
  21817. * @returns {boolean} `false` if canceled.
  21818. */
  21819. dispatchEvent: function dispatchEvent(event) {
  21820. if (event == null || typeof event.type !== "string") {
  21821. throw new TypeError('"event.type" should be a string.');
  21822. } // If listeners aren't registered, terminate.
  21823. var listeners = getListeners(this);
  21824. var eventName = event.type;
  21825. var node = listeners.get(eventName);
  21826. if (node == null) {
  21827. return true;
  21828. } // Since we cannot rewrite several properties, so wrap object.
  21829. var wrappedEvent = wrapEvent(this, event); // This doesn't process capturing phase and bubbling phase.
  21830. // This isn't participating in a tree.
  21831. var prev = null;
  21832. while (node != null) {
  21833. // Remove this listener if it's once
  21834. if (node.once) {
  21835. if (prev !== null) {
  21836. prev.next = node.next;
  21837. } else if (node.next !== null) {
  21838. listeners.set(eventName, node.next);
  21839. } else {
  21840. listeners.delete(eventName);
  21841. }
  21842. } else {
  21843. prev = node;
  21844. } // Call this listener
  21845. setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
  21846. if (typeof node.listener === "function") {
  21847. try {
  21848. node.listener.call(this, wrappedEvent);
  21849. } catch (err) {
  21850. if (typeof console !== "undefined" && typeof console.error === "function") {
  21851. console.error(err);
  21852. }
  21853. }
  21854. } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
  21855. node.listener.handleEvent(wrappedEvent);
  21856. } // Break if `event.stopImmediatePropagation` was called.
  21857. if (isStopped(wrappedEvent)) {
  21858. break;
  21859. }
  21860. node = node.next;
  21861. }
  21862. setPassiveListener(wrappedEvent, null);
  21863. setEventPhase(wrappedEvent, 0);
  21864. setCurrentTarget(wrappedEvent, null);
  21865. return !wrappedEvent.defaultPrevented;
  21866. }
  21867. }; // `constructor` is not enumerable.
  21868. (0, _defineProperty.default)(EventTarget.prototype, "constructor", {
  21869. value: EventTarget,
  21870. configurable: true,
  21871. writable: true
  21872. }); // Ensure `eventTarget instanceof window.EventTarget` is `true`.
  21873. if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
  21874. (0, _setPrototypeOf.default)(EventTarget.prototype, window.EventTarget.prototype);
  21875. }
  21876. var WS =
  21877. /** @class */
  21878. function (_super) {
  21879. __extends$1(WS, _super);
  21880. function WS(url, protocol) {
  21881. var _this = _super.call(this) || this;
  21882. _this._readyState = WS.CLOSED;
  21883. if (!url) {
  21884. throw new TypeError("Failed to construct 'WebSocket': url required");
  21885. }
  21886. _this._url = url;
  21887. _this._protocol = protocol;
  21888. return _this;
  21889. }
  21890. (0, _defineProperty.default)(WS.prototype, "url", {
  21891. get: function get() {
  21892. return this._url;
  21893. },
  21894. enumerable: false,
  21895. configurable: true
  21896. });
  21897. (0, _defineProperty.default)(WS.prototype, "protocol", {
  21898. get: function get() {
  21899. return this._protocol;
  21900. },
  21901. enumerable: false,
  21902. configurable: true
  21903. });
  21904. (0, _defineProperty.default)(WS.prototype, "readyState", {
  21905. get: function get() {
  21906. return this._readyState;
  21907. },
  21908. enumerable: false,
  21909. configurable: true
  21910. });
  21911. WS.CONNECTING = 0;
  21912. WS.OPEN = 1;
  21913. WS.CLOSING = 2;
  21914. WS.CLOSED = 3;
  21915. return WS;
  21916. }(EventTarget("open", "error", "message", "close"));
  21917. var WechatWS =
  21918. /** @class */
  21919. function (_super) {
  21920. __extends$1(WechatWS, _super);
  21921. function WechatWS(url, protocol) {
  21922. var _this = _super.call(this, url, protocol) || this;
  21923. if (protocol && !(wx.canIUse && wx.canIUse("connectSocket.object.protocols"))) {
  21924. throw new Error("subprotocol not supported in weapp");
  21925. }
  21926. _this._readyState = WS.CONNECTING;
  21927. var errorHandler = function errorHandler(event) {
  21928. _this._readyState = WS.CLOSED;
  21929. _this.dispatchEvent({
  21930. type: "error",
  21931. message: event.errMsg
  21932. });
  21933. };
  21934. var socketTask = wx.connectSocket({
  21935. url: url,
  21936. protocols: _this._protocol === undefined || Array.isArray(_this._protocol) ? _this._protocol : [_this._protocol],
  21937. fail: function fail(error) {
  21938. return setTimeout(function () {
  21939. return errorHandler(error);
  21940. }, 0);
  21941. }
  21942. });
  21943. _this._socketTask = socketTask;
  21944. socketTask.onOpen(function () {
  21945. _this._readyState = WS.OPEN;
  21946. _this.dispatchEvent({
  21947. type: "open"
  21948. });
  21949. });
  21950. socketTask.onError(errorHandler);
  21951. socketTask.onMessage(function (event) {
  21952. var data = event.data;
  21953. _this.dispatchEvent({
  21954. data: data,
  21955. type: "message"
  21956. });
  21957. });
  21958. socketTask.onClose(function (event) {
  21959. _this._readyState = WS.CLOSED;
  21960. var code = event.code,
  21961. reason = event.reason;
  21962. _this.dispatchEvent({
  21963. code: code,
  21964. reason: reason,
  21965. type: "close"
  21966. });
  21967. });
  21968. return _this;
  21969. }
  21970. WechatWS.prototype.close = function () {
  21971. if (this.readyState === WS.CLOSED) return;
  21972. if (this.readyState === WS.CONNECTING) {
  21973. console.warn("close WebSocket which is connecting might not work");
  21974. }
  21975. this._socketTask.close({});
  21976. };
  21977. WechatWS.prototype.send = function (data) {
  21978. if (this.readyState !== WS.OPEN) {
  21979. throw new Error("INVALID_STATE_ERR");
  21980. }
  21981. if (!(typeof data === "string" || data instanceof ArrayBuffer)) {
  21982. throw new TypeError("only String/ArrayBuffer supported");
  21983. }
  21984. this._socketTask.send({
  21985. data: data
  21986. });
  21987. };
  21988. return WechatWS;
  21989. }(WS);
  21990. var WebSocket = WechatWS;
  21991. var platformInfo = {
  21992. name: "Weapp"
  21993. };
  21994. exports.WebSocket = WebSocket;
  21995. exports.getAuthInfo = getAuthInfo;
  21996. exports.platformInfo = platformInfo;
  21997. exports.request = request;
  21998. exports.storage = storage;
  21999. exports.upload = upload;
  22000. /***/ }),
  22001. /* 570 */
  22002. /***/ (function(module, exports, __webpack_require__) {
  22003. var parent = __webpack_require__(571);
  22004. module.exports = parent;
  22005. /***/ }),
  22006. /* 571 */
  22007. /***/ (function(module, exports, __webpack_require__) {
  22008. __webpack_require__(572);
  22009. var path = __webpack_require__(5);
  22010. module.exports = path.Object.assign;
  22011. /***/ }),
  22012. /* 572 */
  22013. /***/ (function(module, exports, __webpack_require__) {
  22014. var $ = __webpack_require__(0);
  22015. var assign = __webpack_require__(573);
  22016. // `Object.assign` method
  22017. // https://tc39.es/ecma262/#sec-object.assign
  22018. // eslint-disable-next-line es-x/no-object-assign -- required for testing
  22019. $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
  22020. assign: assign
  22021. });
  22022. /***/ }),
  22023. /* 573 */
  22024. /***/ (function(module, exports, __webpack_require__) {
  22025. "use strict";
  22026. var DESCRIPTORS = __webpack_require__(14);
  22027. var uncurryThis = __webpack_require__(4);
  22028. var call = __webpack_require__(15);
  22029. var fails = __webpack_require__(2);
  22030. var objectKeys = __webpack_require__(105);
  22031. var getOwnPropertySymbolsModule = __webpack_require__(104);
  22032. var propertyIsEnumerableModule = __webpack_require__(120);
  22033. var toObject = __webpack_require__(34);
  22034. var IndexedObject = __webpack_require__(95);
  22035. // eslint-disable-next-line es-x/no-object-assign -- safe
  22036. var $assign = Object.assign;
  22037. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  22038. var defineProperty = Object.defineProperty;
  22039. var concat = uncurryThis([].concat);
  22040. // `Object.assign` method
  22041. // https://tc39.es/ecma262/#sec-object.assign
  22042. module.exports = !$assign || fails(function () {
  22043. // should have correct order of operations (Edge bug)
  22044. if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
  22045. enumerable: true,
  22046. get: function () {
  22047. defineProperty(this, 'b', {
  22048. value: 3,
  22049. enumerable: false
  22050. });
  22051. }
  22052. }), { b: 2 })).b !== 1) return true;
  22053. // should work with symbols and should have deterministic property order (V8 bug)
  22054. var A = {};
  22055. var B = {};
  22056. // eslint-disable-next-line es-x/no-symbol -- safe
  22057. var symbol = Symbol();
  22058. var alphabet = 'abcdefghijklmnopqrst';
  22059. A[symbol] = 7;
  22060. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  22061. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  22062. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  22063. var T = toObject(target);
  22064. var argumentsLength = arguments.length;
  22065. var index = 1;
  22066. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  22067. var propertyIsEnumerable = propertyIsEnumerableModule.f;
  22068. while (argumentsLength > index) {
  22069. var S = IndexedObject(arguments[index++]);
  22070. var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
  22071. var length = keys.length;
  22072. var j = 0;
  22073. var key;
  22074. while (length > j) {
  22075. key = keys[j++];
  22076. if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
  22077. }
  22078. } return T;
  22079. } : $assign;
  22080. /***/ }),
  22081. /* 574 */
  22082. /***/ (function(module, exports, __webpack_require__) {
  22083. var parent = __webpack_require__(575);
  22084. module.exports = parent;
  22085. /***/ }),
  22086. /* 575 */
  22087. /***/ (function(module, exports, __webpack_require__) {
  22088. __webpack_require__(244);
  22089. var path = __webpack_require__(5);
  22090. module.exports = path.Object.getOwnPropertySymbols;
  22091. /***/ }),
  22092. /* 576 */
  22093. /***/ (function(module, exports, __webpack_require__) {
  22094. module.exports = __webpack_require__(249);
  22095. /***/ }),
  22096. /* 577 */
  22097. /***/ (function(module, exports, __webpack_require__) {
  22098. var parent = __webpack_require__(578);
  22099. __webpack_require__(39);
  22100. module.exports = parent;
  22101. /***/ }),
  22102. /* 578 */
  22103. /***/ (function(module, exports, __webpack_require__) {
  22104. __webpack_require__(38);
  22105. __webpack_require__(53);
  22106. __webpack_require__(579);
  22107. var path = __webpack_require__(5);
  22108. module.exports = path.WeakMap;
  22109. /***/ }),
  22110. /* 579 */
  22111. /***/ (function(module, exports, __webpack_require__) {
  22112. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  22113. __webpack_require__(580);
  22114. /***/ }),
  22115. /* 580 */
  22116. /***/ (function(module, exports, __webpack_require__) {
  22117. "use strict";
  22118. var global = __webpack_require__(7);
  22119. var uncurryThis = __webpack_require__(4);
  22120. var defineBuiltIns = __webpack_require__(154);
  22121. var InternalMetadataModule = __webpack_require__(94);
  22122. var collection = __webpack_require__(155);
  22123. var collectionWeak = __webpack_require__(582);
  22124. var isObject = __webpack_require__(11);
  22125. var isExtensible = __webpack_require__(261);
  22126. var enforceInternalState = __webpack_require__(43).enforce;
  22127. var NATIVE_WEAK_MAP = __webpack_require__(170);
  22128. var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
  22129. var InternalWeakMap;
  22130. var wrapper = function (init) {
  22131. return function WeakMap() {
  22132. return init(this, arguments.length ? arguments[0] : undefined);
  22133. };
  22134. };
  22135. // `WeakMap` constructor
  22136. // https://tc39.es/ecma262/#sec-weakmap-constructor
  22137. var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
  22138. // IE11 WeakMap frozen keys fix
  22139. // We can't use feature detection because it crash some old IE builds
  22140. // https://github.com/zloirock/core-js/issues/485
  22141. if (NATIVE_WEAK_MAP && IS_IE11) {
  22142. InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
  22143. InternalMetadataModule.enable();
  22144. var WeakMapPrototype = $WeakMap.prototype;
  22145. var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
  22146. var nativeHas = uncurryThis(WeakMapPrototype.has);
  22147. var nativeGet = uncurryThis(WeakMapPrototype.get);
  22148. var nativeSet = uncurryThis(WeakMapPrototype.set);
  22149. defineBuiltIns(WeakMapPrototype, {
  22150. 'delete': function (key) {
  22151. if (isObject(key) && !isExtensible(key)) {
  22152. var state = enforceInternalState(this);
  22153. if (!state.frozen) state.frozen = new InternalWeakMap();
  22154. return nativeDelete(this, key) || state.frozen['delete'](key);
  22155. } return nativeDelete(this, key);
  22156. },
  22157. has: function has(key) {
  22158. if (isObject(key) && !isExtensible(key)) {
  22159. var state = enforceInternalState(this);
  22160. if (!state.frozen) state.frozen = new InternalWeakMap();
  22161. return nativeHas(this, key) || state.frozen.has(key);
  22162. } return nativeHas(this, key);
  22163. },
  22164. get: function get(key) {
  22165. if (isObject(key) && !isExtensible(key)) {
  22166. var state = enforceInternalState(this);
  22167. if (!state.frozen) state.frozen = new InternalWeakMap();
  22168. return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
  22169. } return nativeGet(this, key);
  22170. },
  22171. set: function set(key, value) {
  22172. if (isObject(key) && !isExtensible(key)) {
  22173. var state = enforceInternalState(this);
  22174. if (!state.frozen) state.frozen = new InternalWeakMap();
  22175. nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
  22176. } else nativeSet(this, key, value);
  22177. return this;
  22178. }
  22179. });
  22180. }
  22181. /***/ }),
  22182. /* 581 */
  22183. /***/ (function(module, exports, __webpack_require__) {
  22184. // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
  22185. var fails = __webpack_require__(2);
  22186. module.exports = fails(function () {
  22187. if (typeof ArrayBuffer == 'function') {
  22188. var buffer = new ArrayBuffer(8);
  22189. // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
  22190. if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
  22191. }
  22192. });
  22193. /***/ }),
  22194. /* 582 */
  22195. /***/ (function(module, exports, __webpack_require__) {
  22196. "use strict";
  22197. var uncurryThis = __webpack_require__(4);
  22198. var defineBuiltIns = __webpack_require__(154);
  22199. var getWeakData = __webpack_require__(94).getWeakData;
  22200. var anObject = __webpack_require__(20);
  22201. var isObject = __webpack_require__(11);
  22202. var anInstance = __webpack_require__(108);
  22203. var iterate = __webpack_require__(42);
  22204. var ArrayIterationModule = __webpack_require__(70);
  22205. var hasOwn = __webpack_require__(13);
  22206. var InternalStateModule = __webpack_require__(43);
  22207. var setInternalState = InternalStateModule.set;
  22208. var internalStateGetterFor = InternalStateModule.getterFor;
  22209. var find = ArrayIterationModule.find;
  22210. var findIndex = ArrayIterationModule.findIndex;
  22211. var splice = uncurryThis([].splice);
  22212. var id = 0;
  22213. // fallback for uncaught frozen keys
  22214. var uncaughtFrozenStore = function (store) {
  22215. return store.frozen || (store.frozen = new UncaughtFrozenStore());
  22216. };
  22217. var UncaughtFrozenStore = function () {
  22218. this.entries = [];
  22219. };
  22220. var findUncaughtFrozen = function (store, key) {
  22221. return find(store.entries, function (it) {
  22222. return it[0] === key;
  22223. });
  22224. };
  22225. UncaughtFrozenStore.prototype = {
  22226. get: function (key) {
  22227. var entry = findUncaughtFrozen(this, key);
  22228. if (entry) return entry[1];
  22229. },
  22230. has: function (key) {
  22231. return !!findUncaughtFrozen(this, key);
  22232. },
  22233. set: function (key, value) {
  22234. var entry = findUncaughtFrozen(this, key);
  22235. if (entry) entry[1] = value;
  22236. else this.entries.push([key, value]);
  22237. },
  22238. 'delete': function (key) {
  22239. var index = findIndex(this.entries, function (it) {
  22240. return it[0] === key;
  22241. });
  22242. if (~index) splice(this.entries, index, 1);
  22243. return !!~index;
  22244. }
  22245. };
  22246. module.exports = {
  22247. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  22248. var Constructor = wrapper(function (that, iterable) {
  22249. anInstance(that, Prototype);
  22250. setInternalState(that, {
  22251. type: CONSTRUCTOR_NAME,
  22252. id: id++,
  22253. frozen: undefined
  22254. });
  22255. if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
  22256. });
  22257. var Prototype = Constructor.prototype;
  22258. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  22259. var define = function (that, key, value) {
  22260. var state = getInternalState(that);
  22261. var data = getWeakData(anObject(key), true);
  22262. if (data === true) uncaughtFrozenStore(state).set(key, value);
  22263. else data[state.id] = value;
  22264. return that;
  22265. };
  22266. defineBuiltIns(Prototype, {
  22267. // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
  22268. // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
  22269. // https://tc39.es/ecma262/#sec-weakset.prototype.delete
  22270. 'delete': function (key) {
  22271. var state = getInternalState(this);
  22272. if (!isObject(key)) return false;
  22273. var data = getWeakData(key);
  22274. if (data === true) return uncaughtFrozenStore(state)['delete'](key);
  22275. return data && hasOwn(data, state.id) && delete data[state.id];
  22276. },
  22277. // `{ WeakMap, WeakSet }.prototype.has(key)` methods
  22278. // https://tc39.es/ecma262/#sec-weakmap.prototype.has
  22279. // https://tc39.es/ecma262/#sec-weakset.prototype.has
  22280. has: function has(key) {
  22281. var state = getInternalState(this);
  22282. if (!isObject(key)) return false;
  22283. var data = getWeakData(key);
  22284. if (data === true) return uncaughtFrozenStore(state).has(key);
  22285. return data && hasOwn(data, state.id);
  22286. }
  22287. });
  22288. defineBuiltIns(Prototype, IS_MAP ? {
  22289. // `WeakMap.prototype.get(key)` method
  22290. // https://tc39.es/ecma262/#sec-weakmap.prototype.get
  22291. get: function get(key) {
  22292. var state = getInternalState(this);
  22293. if (isObject(key)) {
  22294. var data = getWeakData(key);
  22295. if (data === true) return uncaughtFrozenStore(state).get(key);
  22296. return data ? data[state.id] : undefined;
  22297. }
  22298. },
  22299. // `WeakMap.prototype.set(key, value)` method
  22300. // https://tc39.es/ecma262/#sec-weakmap.prototype.set
  22301. set: function set(key, value) {
  22302. return define(this, key, value);
  22303. }
  22304. } : {
  22305. // `WeakSet.prototype.add(value)` method
  22306. // https://tc39.es/ecma262/#sec-weakset.prototype.add
  22307. add: function add(value) {
  22308. return define(this, value, true);
  22309. }
  22310. });
  22311. return Constructor;
  22312. }
  22313. };
  22314. /***/ }),
  22315. /* 583 */
  22316. /***/ (function(module, exports, __webpack_require__) {
  22317. module.exports = __webpack_require__(584);
  22318. /***/ }),
  22319. /* 584 */
  22320. /***/ (function(module, exports, __webpack_require__) {
  22321. var parent = __webpack_require__(585);
  22322. __webpack_require__(39);
  22323. module.exports = parent;
  22324. /***/ }),
  22325. /* 585 */
  22326. /***/ (function(module, exports, __webpack_require__) {
  22327. __webpack_require__(38);
  22328. __webpack_require__(586);
  22329. __webpack_require__(53);
  22330. __webpack_require__(55);
  22331. var path = __webpack_require__(5);
  22332. module.exports = path.Map;
  22333. /***/ }),
  22334. /* 586 */
  22335. /***/ (function(module, exports, __webpack_require__) {
  22336. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  22337. __webpack_require__(587);
  22338. /***/ }),
  22339. /* 587 */
  22340. /***/ (function(module, exports, __webpack_require__) {
  22341. "use strict";
  22342. var collection = __webpack_require__(155);
  22343. var collectionStrong = __webpack_require__(263);
  22344. // `Map` constructor
  22345. // https://tc39.es/ecma262/#sec-map-objects
  22346. collection('Map', function (init) {
  22347. return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
  22348. }, collectionStrong);
  22349. /***/ }),
  22350. /* 588 */
  22351. /***/ (function(module, exports, __webpack_require__) {
  22352. "use strict";
  22353. var _require = __webpack_require__(156),
  22354. Realtime = _require.Realtime,
  22355. setRTMAdapters = _require.setAdapters;
  22356. var _require2 = __webpack_require__(664),
  22357. LiveQueryPlugin = _require2.LiveQueryPlugin;
  22358. Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
  22359. module.exports = function (AV) {
  22360. AV._sharedConfig.liveQueryRealtime = Realtime;
  22361. var setAdapters = AV.setAdapters;
  22362. AV.setAdapters = function (adapters) {
  22363. setAdapters(adapters);
  22364. setRTMAdapters(adapters);
  22365. };
  22366. return AV;
  22367. };
  22368. /***/ }),
  22369. /* 589 */
  22370. /***/ (function(module, exports, __webpack_require__) {
  22371. "use strict";
  22372. /* WEBPACK VAR INJECTION */(function(global) {
  22373. var _interopRequireDefault = __webpack_require__(1);
  22374. var _typeof3 = _interopRequireDefault(__webpack_require__(73));
  22375. var _defineProperty2 = _interopRequireDefault(__webpack_require__(92));
  22376. var _freeze = _interopRequireDefault(__webpack_require__(590));
  22377. var _assign = _interopRequireDefault(__webpack_require__(152));
  22378. var _symbol = _interopRequireDefault(__webpack_require__(149));
  22379. var _concat = _interopRequireDefault(__webpack_require__(22));
  22380. var _keys = _interopRequireDefault(__webpack_require__(115));
  22381. var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
  22382. var _filter = _interopRequireDefault(__webpack_require__(250));
  22383. var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
  22384. var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(594));
  22385. var _defineProperties = _interopRequireDefault(__webpack_require__(598));
  22386. var _promise = _interopRequireDefault(__webpack_require__(12));
  22387. var _slice = _interopRequireDefault(__webpack_require__(61));
  22388. var _indexOf = _interopRequireDefault(__webpack_require__(71));
  22389. var _weakMap = _interopRequireDefault(__webpack_require__(260));
  22390. var _stringify = _interopRequireDefault(__webpack_require__(36));
  22391. var _map = _interopRequireDefault(__webpack_require__(35));
  22392. var _reduce = _interopRequireDefault(__webpack_require__(602));
  22393. var _find = _interopRequireDefault(__webpack_require__(93));
  22394. var _set = _interopRequireDefault(__webpack_require__(264));
  22395. var _context6, _context15;
  22396. (0, _defineProperty2.default)(exports, '__esModule', {
  22397. value: true
  22398. });
  22399. function _interopDefault(ex) {
  22400. return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
  22401. }
  22402. var protobufLight = _interopDefault(__webpack_require__(612));
  22403. var EventEmitter = _interopDefault(__webpack_require__(616));
  22404. var _regeneratorRuntime = _interopDefault(__webpack_require__(617));
  22405. var _asyncToGenerator = _interopDefault(__webpack_require__(619));
  22406. var _toConsumableArray = _interopDefault(__webpack_require__(620));
  22407. var _defineProperty = _interopDefault(__webpack_require__(623));
  22408. var _objectWithoutProperties = _interopDefault(__webpack_require__(624));
  22409. var _assertThisInitialized = _interopDefault(__webpack_require__(626));
  22410. var _inheritsLoose = _interopDefault(__webpack_require__(627));
  22411. var d = _interopDefault(__webpack_require__(60));
  22412. var shuffle = _interopDefault(__webpack_require__(628));
  22413. var values = _interopDefault(__webpack_require__(269));
  22414. var _toArray = _interopDefault(__webpack_require__(655));
  22415. var _createClass = _interopDefault(__webpack_require__(658));
  22416. var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(659));
  22417. var StateMachine = _interopDefault(__webpack_require__(660));
  22418. var _typeof = _interopDefault(__webpack_require__(661));
  22419. var isPlainObject = _interopDefault(__webpack_require__(662));
  22420. var promiseTimeout = __webpack_require__(251);
  22421. var messageCompiled = protobufLight.newBuilder({})['import']({
  22422. "package": 'push_server.messages2',
  22423. syntax: 'proto2',
  22424. options: {
  22425. objc_class_prefix: 'AVIM'
  22426. },
  22427. messages: [{
  22428. name: 'JsonObjectMessage',
  22429. syntax: 'proto2',
  22430. fields: [{
  22431. rule: 'required',
  22432. type: 'string',
  22433. name: 'data',
  22434. id: 1
  22435. }]
  22436. }, {
  22437. name: 'UnreadTuple',
  22438. syntax: 'proto2',
  22439. fields: [{
  22440. rule: 'required',
  22441. type: 'string',
  22442. name: 'cid',
  22443. id: 1
  22444. }, {
  22445. rule: 'required',
  22446. type: 'int32',
  22447. name: 'unread',
  22448. id: 2
  22449. }, {
  22450. rule: 'optional',
  22451. type: 'string',
  22452. name: 'mid',
  22453. id: 3
  22454. }, {
  22455. rule: 'optional',
  22456. type: 'int64',
  22457. name: 'timestamp',
  22458. id: 4
  22459. }, {
  22460. rule: 'optional',
  22461. type: 'string',
  22462. name: 'from',
  22463. id: 5
  22464. }, {
  22465. rule: 'optional',
  22466. type: 'string',
  22467. name: 'data',
  22468. id: 6
  22469. }, {
  22470. rule: 'optional',
  22471. type: 'int64',
  22472. name: 'patchTimestamp',
  22473. id: 7
  22474. }, {
  22475. rule: 'optional',
  22476. type: 'bool',
  22477. name: 'mentioned',
  22478. id: 8
  22479. }, {
  22480. rule: 'optional',
  22481. type: 'bytes',
  22482. name: 'binaryMsg',
  22483. id: 9
  22484. }, {
  22485. rule: 'optional',
  22486. type: 'int32',
  22487. name: 'convType',
  22488. id: 10
  22489. }]
  22490. }, {
  22491. name: 'LogItem',
  22492. syntax: 'proto2',
  22493. fields: [{
  22494. rule: 'optional',
  22495. type: 'string',
  22496. name: 'from',
  22497. id: 1
  22498. }, {
  22499. rule: 'optional',
  22500. type: 'string',
  22501. name: 'data',
  22502. id: 2
  22503. }, {
  22504. rule: 'optional',
  22505. type: 'int64',
  22506. name: 'timestamp',
  22507. id: 3
  22508. }, {
  22509. rule: 'optional',
  22510. type: 'string',
  22511. name: 'msgId',
  22512. id: 4
  22513. }, {
  22514. rule: 'optional',
  22515. type: 'int64',
  22516. name: 'ackAt',
  22517. id: 5
  22518. }, {
  22519. rule: 'optional',
  22520. type: 'int64',
  22521. name: 'readAt',
  22522. id: 6
  22523. }, {
  22524. rule: 'optional',
  22525. type: 'int64',
  22526. name: 'patchTimestamp',
  22527. id: 7
  22528. }, {
  22529. rule: 'optional',
  22530. type: 'bool',
  22531. name: 'mentionAll',
  22532. id: 8
  22533. }, {
  22534. rule: 'repeated',
  22535. type: 'string',
  22536. name: 'mentionPids',
  22537. id: 9
  22538. }, {
  22539. rule: 'optional',
  22540. type: 'bool',
  22541. name: 'bin',
  22542. id: 10
  22543. }, {
  22544. rule: 'optional',
  22545. type: 'int32',
  22546. name: 'convType',
  22547. id: 11
  22548. }]
  22549. }, {
  22550. name: 'ConvMemberInfo',
  22551. syntax: 'proto2',
  22552. fields: [{
  22553. rule: 'optional',
  22554. type: 'string',
  22555. name: 'pid',
  22556. id: 1
  22557. }, {
  22558. rule: 'optional',
  22559. type: 'string',
  22560. name: 'role',
  22561. id: 2
  22562. }, {
  22563. rule: 'optional',
  22564. type: 'string',
  22565. name: 'infoId',
  22566. id: 3
  22567. }]
  22568. }, {
  22569. name: 'DataCommand',
  22570. syntax: 'proto2',
  22571. fields: [{
  22572. rule: 'repeated',
  22573. type: 'string',
  22574. name: 'ids',
  22575. id: 1
  22576. }, {
  22577. rule: 'repeated',
  22578. type: 'JsonObjectMessage',
  22579. name: 'msg',
  22580. id: 2
  22581. }, {
  22582. rule: 'optional',
  22583. type: 'bool',
  22584. name: 'offline',
  22585. id: 3
  22586. }]
  22587. }, {
  22588. name: 'SessionCommand',
  22589. syntax: 'proto2',
  22590. fields: [{
  22591. rule: 'optional',
  22592. type: 'int64',
  22593. name: 't',
  22594. id: 1
  22595. }, {
  22596. rule: 'optional',
  22597. type: 'string',
  22598. name: 'n',
  22599. id: 2
  22600. }, {
  22601. rule: 'optional',
  22602. type: 'string',
  22603. name: 's',
  22604. id: 3
  22605. }, {
  22606. rule: 'optional',
  22607. type: 'string',
  22608. name: 'ua',
  22609. id: 4
  22610. }, {
  22611. rule: 'optional',
  22612. type: 'bool',
  22613. name: 'r',
  22614. id: 5
  22615. }, {
  22616. rule: 'optional',
  22617. type: 'string',
  22618. name: 'tag',
  22619. id: 6
  22620. }, {
  22621. rule: 'optional',
  22622. type: 'string',
  22623. name: 'deviceId',
  22624. id: 7
  22625. }, {
  22626. rule: 'repeated',
  22627. type: 'string',
  22628. name: 'sessionPeerIds',
  22629. id: 8
  22630. }, {
  22631. rule: 'repeated',
  22632. type: 'string',
  22633. name: 'onlineSessionPeerIds',
  22634. id: 9
  22635. }, {
  22636. rule: 'optional',
  22637. type: 'string',
  22638. name: 'st',
  22639. id: 10
  22640. }, {
  22641. rule: 'optional',
  22642. type: 'int32',
  22643. name: 'stTtl',
  22644. id: 11
  22645. }, {
  22646. rule: 'optional',
  22647. type: 'int32',
  22648. name: 'code',
  22649. id: 12
  22650. }, {
  22651. rule: 'optional',
  22652. type: 'string',
  22653. name: 'reason',
  22654. id: 13
  22655. }, {
  22656. rule: 'optional',
  22657. type: 'string',
  22658. name: 'deviceToken',
  22659. id: 14
  22660. }, {
  22661. rule: 'optional',
  22662. type: 'bool',
  22663. name: 'sp',
  22664. id: 15
  22665. }, {
  22666. rule: 'optional',
  22667. type: 'string',
  22668. name: 'detail',
  22669. id: 16
  22670. }, {
  22671. rule: 'optional',
  22672. type: 'int64',
  22673. name: 'lastUnreadNotifTime',
  22674. id: 17
  22675. }, {
  22676. rule: 'optional',
  22677. type: 'int64',
  22678. name: 'lastPatchTime',
  22679. id: 18
  22680. }, {
  22681. rule: 'optional',
  22682. type: 'int64',
  22683. name: 'configBitmap',
  22684. id: 19
  22685. }]
  22686. }, {
  22687. name: 'ErrorCommand',
  22688. syntax: 'proto2',
  22689. fields: [{
  22690. rule: 'required',
  22691. type: 'int32',
  22692. name: 'code',
  22693. id: 1
  22694. }, {
  22695. rule: 'required',
  22696. type: 'string',
  22697. name: 'reason',
  22698. id: 2
  22699. }, {
  22700. rule: 'optional',
  22701. type: 'int32',
  22702. name: 'appCode',
  22703. id: 3
  22704. }, {
  22705. rule: 'optional',
  22706. type: 'string',
  22707. name: 'detail',
  22708. id: 4
  22709. }, {
  22710. rule: 'repeated',
  22711. type: 'string',
  22712. name: 'pids',
  22713. id: 5
  22714. }, {
  22715. rule: 'optional',
  22716. type: 'string',
  22717. name: 'appMsg',
  22718. id: 6
  22719. }]
  22720. }, {
  22721. name: 'DirectCommand',
  22722. syntax: 'proto2',
  22723. fields: [{
  22724. rule: 'optional',
  22725. type: 'string',
  22726. name: 'msg',
  22727. id: 1
  22728. }, {
  22729. rule: 'optional',
  22730. type: 'string',
  22731. name: 'uid',
  22732. id: 2
  22733. }, {
  22734. rule: 'optional',
  22735. type: 'string',
  22736. name: 'fromPeerId',
  22737. id: 3
  22738. }, {
  22739. rule: 'optional',
  22740. type: 'int64',
  22741. name: 'timestamp',
  22742. id: 4
  22743. }, {
  22744. rule: 'optional',
  22745. type: 'bool',
  22746. name: 'offline',
  22747. id: 5
  22748. }, {
  22749. rule: 'optional',
  22750. type: 'bool',
  22751. name: 'hasMore',
  22752. id: 6
  22753. }, {
  22754. rule: 'repeated',
  22755. type: 'string',
  22756. name: 'toPeerIds',
  22757. id: 7
  22758. }, {
  22759. rule: 'optional',
  22760. type: 'bool',
  22761. name: 'r',
  22762. id: 10
  22763. }, {
  22764. rule: 'optional',
  22765. type: 'string',
  22766. name: 'cid',
  22767. id: 11
  22768. }, {
  22769. rule: 'optional',
  22770. type: 'string',
  22771. name: 'id',
  22772. id: 12
  22773. }, {
  22774. rule: 'optional',
  22775. type: 'bool',
  22776. name: 'transient',
  22777. id: 13
  22778. }, {
  22779. rule: 'optional',
  22780. type: 'string',
  22781. name: 'dt',
  22782. id: 14
  22783. }, {
  22784. rule: 'optional',
  22785. type: 'string',
  22786. name: 'roomId',
  22787. id: 15
  22788. }, {
  22789. rule: 'optional',
  22790. type: 'string',
  22791. name: 'pushData',
  22792. id: 16
  22793. }, {
  22794. rule: 'optional',
  22795. type: 'bool',
  22796. name: 'will',
  22797. id: 17
  22798. }, {
  22799. rule: 'optional',
  22800. type: 'int64',
  22801. name: 'patchTimestamp',
  22802. id: 18
  22803. }, {
  22804. rule: 'optional',
  22805. type: 'bytes',
  22806. name: 'binaryMsg',
  22807. id: 19
  22808. }, {
  22809. rule: 'repeated',
  22810. type: 'string',
  22811. name: 'mentionPids',
  22812. id: 20
  22813. }, {
  22814. rule: 'optional',
  22815. type: 'bool',
  22816. name: 'mentionAll',
  22817. id: 21
  22818. }, {
  22819. rule: 'optional',
  22820. type: 'int32',
  22821. name: 'convType',
  22822. id: 22
  22823. }]
  22824. }, {
  22825. name: 'AckCommand',
  22826. syntax: 'proto2',
  22827. fields: [{
  22828. rule: 'optional',
  22829. type: 'int32',
  22830. name: 'code',
  22831. id: 1
  22832. }, {
  22833. rule: 'optional',
  22834. type: 'string',
  22835. name: 'reason',
  22836. id: 2
  22837. }, {
  22838. rule: 'optional',
  22839. type: 'string',
  22840. name: 'mid',
  22841. id: 3
  22842. }, {
  22843. rule: 'optional',
  22844. type: 'string',
  22845. name: 'cid',
  22846. id: 4
  22847. }, {
  22848. rule: 'optional',
  22849. type: 'int64',
  22850. name: 't',
  22851. id: 5
  22852. }, {
  22853. rule: 'optional',
  22854. type: 'string',
  22855. name: 'uid',
  22856. id: 6
  22857. }, {
  22858. rule: 'optional',
  22859. type: 'int64',
  22860. name: 'fromts',
  22861. id: 7
  22862. }, {
  22863. rule: 'optional',
  22864. type: 'int64',
  22865. name: 'tots',
  22866. id: 8
  22867. }, {
  22868. rule: 'optional',
  22869. type: 'string',
  22870. name: 'type',
  22871. id: 9
  22872. }, {
  22873. rule: 'repeated',
  22874. type: 'string',
  22875. name: 'ids',
  22876. id: 10
  22877. }, {
  22878. rule: 'optional',
  22879. type: 'int32',
  22880. name: 'appCode',
  22881. id: 11
  22882. }, {
  22883. rule: 'optional',
  22884. type: 'string',
  22885. name: 'appMsg',
  22886. id: 12
  22887. }]
  22888. }, {
  22889. name: 'UnreadCommand',
  22890. syntax: 'proto2',
  22891. fields: [{
  22892. rule: 'repeated',
  22893. type: 'UnreadTuple',
  22894. name: 'convs',
  22895. id: 1
  22896. }, {
  22897. rule: 'optional',
  22898. type: 'int64',
  22899. name: 'notifTime',
  22900. id: 2
  22901. }]
  22902. }, {
  22903. name: 'ConvCommand',
  22904. syntax: 'proto2',
  22905. fields: [{
  22906. rule: 'repeated',
  22907. type: 'string',
  22908. name: 'm',
  22909. id: 1
  22910. }, {
  22911. rule: 'optional',
  22912. type: 'bool',
  22913. name: 'transient',
  22914. id: 2
  22915. }, {
  22916. rule: 'optional',
  22917. type: 'bool',
  22918. name: 'unique',
  22919. id: 3
  22920. }, {
  22921. rule: 'optional',
  22922. type: 'string',
  22923. name: 'cid',
  22924. id: 4
  22925. }, {
  22926. rule: 'optional',
  22927. type: 'string',
  22928. name: 'cdate',
  22929. id: 5
  22930. }, {
  22931. rule: 'optional',
  22932. type: 'string',
  22933. name: 'initBy',
  22934. id: 6
  22935. }, {
  22936. rule: 'optional',
  22937. type: 'string',
  22938. name: 'sort',
  22939. id: 7
  22940. }, {
  22941. rule: 'optional',
  22942. type: 'int32',
  22943. name: 'limit',
  22944. id: 8
  22945. }, {
  22946. rule: 'optional',
  22947. type: 'int32',
  22948. name: 'skip',
  22949. id: 9
  22950. }, {
  22951. rule: 'optional',
  22952. type: 'int32',
  22953. name: 'flag',
  22954. id: 10
  22955. }, {
  22956. rule: 'optional',
  22957. type: 'int32',
  22958. name: 'count',
  22959. id: 11
  22960. }, {
  22961. rule: 'optional',
  22962. type: 'string',
  22963. name: 'udate',
  22964. id: 12
  22965. }, {
  22966. rule: 'optional',
  22967. type: 'int64',
  22968. name: 't',
  22969. id: 13
  22970. }, {
  22971. rule: 'optional',
  22972. type: 'string',
  22973. name: 'n',
  22974. id: 14
  22975. }, {
  22976. rule: 'optional',
  22977. type: 'string',
  22978. name: 's',
  22979. id: 15
  22980. }, {
  22981. rule: 'optional',
  22982. type: 'bool',
  22983. name: 'statusSub',
  22984. id: 16
  22985. }, {
  22986. rule: 'optional',
  22987. type: 'bool',
  22988. name: 'statusPub',
  22989. id: 17
  22990. }, {
  22991. rule: 'optional',
  22992. type: 'int32',
  22993. name: 'statusTTL',
  22994. id: 18
  22995. }, {
  22996. rule: 'optional',
  22997. type: 'string',
  22998. name: 'uniqueId',
  22999. id: 19
  23000. }, {
  23001. rule: 'optional',
  23002. type: 'string',
  23003. name: 'targetClientId',
  23004. id: 20
  23005. }, {
  23006. rule: 'optional',
  23007. type: 'int64',
  23008. name: 'maxReadTimestamp',
  23009. id: 21
  23010. }, {
  23011. rule: 'optional',
  23012. type: 'int64',
  23013. name: 'maxAckTimestamp',
  23014. id: 22
  23015. }, {
  23016. rule: 'optional',
  23017. type: 'bool',
  23018. name: 'queryAllMembers',
  23019. id: 23
  23020. }, {
  23021. rule: 'repeated',
  23022. type: 'MaxReadTuple',
  23023. name: 'maxReadTuples',
  23024. id: 24
  23025. }, {
  23026. rule: 'repeated',
  23027. type: 'string',
  23028. name: 'cids',
  23029. id: 25
  23030. }, {
  23031. rule: 'optional',
  23032. type: 'ConvMemberInfo',
  23033. name: 'info',
  23034. id: 26
  23035. }, {
  23036. rule: 'optional',
  23037. type: 'bool',
  23038. name: 'tempConv',
  23039. id: 27
  23040. }, {
  23041. rule: 'optional',
  23042. type: 'int32',
  23043. name: 'tempConvTTL',
  23044. id: 28
  23045. }, {
  23046. rule: 'repeated',
  23047. type: 'string',
  23048. name: 'tempConvIds',
  23049. id: 29
  23050. }, {
  23051. rule: 'repeated',
  23052. type: 'string',
  23053. name: 'allowedPids',
  23054. id: 30
  23055. }, {
  23056. rule: 'repeated',
  23057. type: 'ErrorCommand',
  23058. name: 'failedPids',
  23059. id: 31
  23060. }, {
  23061. rule: 'optional',
  23062. type: 'string',
  23063. name: 'next',
  23064. id: 40
  23065. }, {
  23066. rule: 'optional',
  23067. type: 'JsonObjectMessage',
  23068. name: 'results',
  23069. id: 100
  23070. }, {
  23071. rule: 'optional',
  23072. type: 'JsonObjectMessage',
  23073. name: 'where',
  23074. id: 101
  23075. }, {
  23076. rule: 'optional',
  23077. type: 'JsonObjectMessage',
  23078. name: 'attr',
  23079. id: 103
  23080. }, {
  23081. rule: 'optional',
  23082. type: 'JsonObjectMessage',
  23083. name: 'attrModified',
  23084. id: 104
  23085. }]
  23086. }, {
  23087. name: 'RoomCommand',
  23088. syntax: 'proto2',
  23089. fields: [{
  23090. rule: 'optional',
  23091. type: 'string',
  23092. name: 'roomId',
  23093. id: 1
  23094. }, {
  23095. rule: 'optional',
  23096. type: 'string',
  23097. name: 's',
  23098. id: 2
  23099. }, {
  23100. rule: 'optional',
  23101. type: 'int64',
  23102. name: 't',
  23103. id: 3
  23104. }, {
  23105. rule: 'optional',
  23106. type: 'string',
  23107. name: 'n',
  23108. id: 4
  23109. }, {
  23110. rule: 'optional',
  23111. type: 'bool',
  23112. name: 'transient',
  23113. id: 5
  23114. }, {
  23115. rule: 'repeated',
  23116. type: 'string',
  23117. name: 'roomPeerIds',
  23118. id: 6
  23119. }, {
  23120. rule: 'optional',
  23121. type: 'string',
  23122. name: 'byPeerId',
  23123. id: 7
  23124. }]
  23125. }, {
  23126. name: 'LogsCommand',
  23127. syntax: 'proto2',
  23128. fields: [{
  23129. rule: 'optional',
  23130. type: 'string',
  23131. name: 'cid',
  23132. id: 1
  23133. }, {
  23134. rule: 'optional',
  23135. type: 'int32',
  23136. name: 'l',
  23137. id: 2
  23138. }, {
  23139. rule: 'optional',
  23140. type: 'int32',
  23141. name: 'limit',
  23142. id: 3
  23143. }, {
  23144. rule: 'optional',
  23145. type: 'int64',
  23146. name: 't',
  23147. id: 4
  23148. }, {
  23149. rule: 'optional',
  23150. type: 'int64',
  23151. name: 'tt',
  23152. id: 5
  23153. }, {
  23154. rule: 'optional',
  23155. type: 'string',
  23156. name: 'tmid',
  23157. id: 6
  23158. }, {
  23159. rule: 'optional',
  23160. type: 'string',
  23161. name: 'mid',
  23162. id: 7
  23163. }, {
  23164. rule: 'optional',
  23165. type: 'string',
  23166. name: 'checksum',
  23167. id: 8
  23168. }, {
  23169. rule: 'optional',
  23170. type: 'bool',
  23171. name: 'stored',
  23172. id: 9
  23173. }, {
  23174. rule: 'optional',
  23175. type: 'QueryDirection',
  23176. name: 'direction',
  23177. id: 10,
  23178. options: {
  23179. "default": 'OLD'
  23180. }
  23181. }, {
  23182. rule: 'optional',
  23183. type: 'bool',
  23184. name: 'tIncluded',
  23185. id: 11
  23186. }, {
  23187. rule: 'optional',
  23188. type: 'bool',
  23189. name: 'ttIncluded',
  23190. id: 12
  23191. }, {
  23192. rule: 'optional',
  23193. type: 'int32',
  23194. name: 'lctype',
  23195. id: 13
  23196. }, {
  23197. rule: 'repeated',
  23198. type: 'LogItem',
  23199. name: 'logs',
  23200. id: 105
  23201. }],
  23202. enums: [{
  23203. name: 'QueryDirection',
  23204. syntax: 'proto2',
  23205. values: [{
  23206. name: 'OLD',
  23207. id: 1
  23208. }, {
  23209. name: 'NEW',
  23210. id: 2
  23211. }]
  23212. }]
  23213. }, {
  23214. name: 'RcpCommand',
  23215. syntax: 'proto2',
  23216. fields: [{
  23217. rule: 'optional',
  23218. type: 'string',
  23219. name: 'id',
  23220. id: 1
  23221. }, {
  23222. rule: 'optional',
  23223. type: 'string',
  23224. name: 'cid',
  23225. id: 2
  23226. }, {
  23227. rule: 'optional',
  23228. type: 'int64',
  23229. name: 't',
  23230. id: 3
  23231. }, {
  23232. rule: 'optional',
  23233. type: 'bool',
  23234. name: 'read',
  23235. id: 4
  23236. }, {
  23237. rule: 'optional',
  23238. type: 'string',
  23239. name: 'from',
  23240. id: 5
  23241. }]
  23242. }, {
  23243. name: 'ReadTuple',
  23244. syntax: 'proto2',
  23245. fields: [{
  23246. rule: 'required',
  23247. type: 'string',
  23248. name: 'cid',
  23249. id: 1
  23250. }, {
  23251. rule: 'optional',
  23252. type: 'int64',
  23253. name: 'timestamp',
  23254. id: 2
  23255. }, {
  23256. rule: 'optional',
  23257. type: 'string',
  23258. name: 'mid',
  23259. id: 3
  23260. }]
  23261. }, {
  23262. name: 'MaxReadTuple',
  23263. syntax: 'proto2',
  23264. fields: [{
  23265. rule: 'optional',
  23266. type: 'string',
  23267. name: 'pid',
  23268. id: 1
  23269. }, {
  23270. rule: 'optional',
  23271. type: 'int64',
  23272. name: 'maxAckTimestamp',
  23273. id: 2
  23274. }, {
  23275. rule: 'optional',
  23276. type: 'int64',
  23277. name: 'maxReadTimestamp',
  23278. id: 3
  23279. }]
  23280. }, {
  23281. name: 'ReadCommand',
  23282. syntax: 'proto2',
  23283. fields: [{
  23284. rule: 'optional',
  23285. type: 'string',
  23286. name: 'cid',
  23287. id: 1
  23288. }, {
  23289. rule: 'repeated',
  23290. type: 'string',
  23291. name: 'cids',
  23292. id: 2
  23293. }, {
  23294. rule: 'repeated',
  23295. type: 'ReadTuple',
  23296. name: 'convs',
  23297. id: 3
  23298. }]
  23299. }, {
  23300. name: 'PresenceCommand',
  23301. syntax: 'proto2',
  23302. fields: [{
  23303. rule: 'optional',
  23304. type: 'StatusType',
  23305. name: 'status',
  23306. id: 1
  23307. }, {
  23308. rule: 'repeated',
  23309. type: 'string',
  23310. name: 'sessionPeerIds',
  23311. id: 2
  23312. }, {
  23313. rule: 'optional',
  23314. type: 'string',
  23315. name: 'cid',
  23316. id: 3
  23317. }]
  23318. }, {
  23319. name: 'ReportCommand',
  23320. syntax: 'proto2',
  23321. fields: [{
  23322. rule: 'optional',
  23323. type: 'bool',
  23324. name: 'initiative',
  23325. id: 1
  23326. }, {
  23327. rule: 'optional',
  23328. type: 'string',
  23329. name: 'type',
  23330. id: 2
  23331. }, {
  23332. rule: 'optional',
  23333. type: 'string',
  23334. name: 'data',
  23335. id: 3
  23336. }]
  23337. }, {
  23338. name: 'PatchItem',
  23339. syntax: 'proto2',
  23340. fields: [{
  23341. rule: 'optional',
  23342. type: 'string',
  23343. name: 'cid',
  23344. id: 1
  23345. }, {
  23346. rule: 'optional',
  23347. type: 'string',
  23348. name: 'mid',
  23349. id: 2
  23350. }, {
  23351. rule: 'optional',
  23352. type: 'int64',
  23353. name: 'timestamp',
  23354. id: 3
  23355. }, {
  23356. rule: 'optional',
  23357. type: 'bool',
  23358. name: 'recall',
  23359. id: 4
  23360. }, {
  23361. rule: 'optional',
  23362. type: 'string',
  23363. name: 'data',
  23364. id: 5
  23365. }, {
  23366. rule: 'optional',
  23367. type: 'int64',
  23368. name: 'patchTimestamp',
  23369. id: 6
  23370. }, {
  23371. rule: 'optional',
  23372. type: 'string',
  23373. name: 'from',
  23374. id: 7
  23375. }, {
  23376. rule: 'optional',
  23377. type: 'bytes',
  23378. name: 'binaryMsg',
  23379. id: 8
  23380. }, {
  23381. rule: 'optional',
  23382. type: 'bool',
  23383. name: 'mentionAll',
  23384. id: 9
  23385. }, {
  23386. rule: 'repeated',
  23387. type: 'string',
  23388. name: 'mentionPids',
  23389. id: 10
  23390. }, {
  23391. rule: 'optional',
  23392. type: 'int64',
  23393. name: 'patchCode',
  23394. id: 11
  23395. }, {
  23396. rule: 'optional',
  23397. type: 'string',
  23398. name: 'patchReason',
  23399. id: 12
  23400. }]
  23401. }, {
  23402. name: 'PatchCommand',
  23403. syntax: 'proto2',
  23404. fields: [{
  23405. rule: 'repeated',
  23406. type: 'PatchItem',
  23407. name: 'patches',
  23408. id: 1
  23409. }, {
  23410. rule: 'optional',
  23411. type: 'int64',
  23412. name: 'lastPatchTime',
  23413. id: 2
  23414. }]
  23415. }, {
  23416. name: 'PubsubCommand',
  23417. syntax: 'proto2',
  23418. fields: [{
  23419. rule: 'optional',
  23420. type: 'string',
  23421. name: 'cid',
  23422. id: 1
  23423. }, {
  23424. rule: 'repeated',
  23425. type: 'string',
  23426. name: 'cids',
  23427. id: 2
  23428. }, {
  23429. rule: 'optional',
  23430. type: 'string',
  23431. name: 'topic',
  23432. id: 3
  23433. }, {
  23434. rule: 'optional',
  23435. type: 'string',
  23436. name: 'subtopic',
  23437. id: 4
  23438. }, {
  23439. rule: 'repeated',
  23440. type: 'string',
  23441. name: 'topics',
  23442. id: 5
  23443. }, {
  23444. rule: 'repeated',
  23445. type: 'string',
  23446. name: 'subtopics',
  23447. id: 6
  23448. }, {
  23449. rule: 'optional',
  23450. type: 'JsonObjectMessage',
  23451. name: 'results',
  23452. id: 7
  23453. }]
  23454. }, {
  23455. name: 'BlacklistCommand',
  23456. syntax: 'proto2',
  23457. fields: [{
  23458. rule: 'optional',
  23459. type: 'string',
  23460. name: 'srcCid',
  23461. id: 1
  23462. }, {
  23463. rule: 'repeated',
  23464. type: 'string',
  23465. name: 'toPids',
  23466. id: 2
  23467. }, {
  23468. rule: 'optional',
  23469. type: 'string',
  23470. name: 'srcPid',
  23471. id: 3
  23472. }, {
  23473. rule: 'repeated',
  23474. type: 'string',
  23475. name: 'toCids',
  23476. id: 4
  23477. }, {
  23478. rule: 'optional',
  23479. type: 'int32',
  23480. name: 'limit',
  23481. id: 5
  23482. }, {
  23483. rule: 'optional',
  23484. type: 'string',
  23485. name: 'next',
  23486. id: 6
  23487. }, {
  23488. rule: 'repeated',
  23489. type: 'string',
  23490. name: 'blockedPids',
  23491. id: 8
  23492. }, {
  23493. rule: 'repeated',
  23494. type: 'string',
  23495. name: 'blockedCids',
  23496. id: 9
  23497. }, {
  23498. rule: 'repeated',
  23499. type: 'string',
  23500. name: 'allowedPids',
  23501. id: 10
  23502. }, {
  23503. rule: 'repeated',
  23504. type: 'ErrorCommand',
  23505. name: 'failedPids',
  23506. id: 11
  23507. }, {
  23508. rule: 'optional',
  23509. type: 'int64',
  23510. name: 't',
  23511. id: 12
  23512. }, {
  23513. rule: 'optional',
  23514. type: 'string',
  23515. name: 'n',
  23516. id: 13
  23517. }, {
  23518. rule: 'optional',
  23519. type: 'string',
  23520. name: 's',
  23521. id: 14
  23522. }]
  23523. }, {
  23524. name: 'GenericCommand',
  23525. syntax: 'proto2',
  23526. fields: [{
  23527. rule: 'optional',
  23528. type: 'CommandType',
  23529. name: 'cmd',
  23530. id: 1
  23531. }, {
  23532. rule: 'optional',
  23533. type: 'OpType',
  23534. name: 'op',
  23535. id: 2
  23536. }, {
  23537. rule: 'optional',
  23538. type: 'string',
  23539. name: 'appId',
  23540. id: 3
  23541. }, {
  23542. rule: 'optional',
  23543. type: 'string',
  23544. name: 'peerId',
  23545. id: 4
  23546. }, {
  23547. rule: 'optional',
  23548. type: 'int32',
  23549. name: 'i',
  23550. id: 5
  23551. }, {
  23552. rule: 'optional',
  23553. type: 'string',
  23554. name: 'installationId',
  23555. id: 6
  23556. }, {
  23557. rule: 'optional',
  23558. type: 'int32',
  23559. name: 'priority',
  23560. id: 7
  23561. }, {
  23562. rule: 'optional',
  23563. type: 'int32',
  23564. name: 'service',
  23565. id: 8
  23566. }, {
  23567. rule: 'optional',
  23568. type: 'int64',
  23569. name: 'serverTs',
  23570. id: 9
  23571. }, {
  23572. rule: 'optional',
  23573. type: 'int64',
  23574. name: 'clientTs',
  23575. id: 10
  23576. }, {
  23577. rule: 'optional',
  23578. type: 'int32',
  23579. name: 'notificationType',
  23580. id: 11
  23581. }, {
  23582. rule: 'optional',
  23583. type: 'DataCommand',
  23584. name: 'dataMessage',
  23585. id: 101
  23586. }, {
  23587. rule: 'optional',
  23588. type: 'SessionCommand',
  23589. name: 'sessionMessage',
  23590. id: 102
  23591. }, {
  23592. rule: 'optional',
  23593. type: 'ErrorCommand',
  23594. name: 'errorMessage',
  23595. id: 103
  23596. }, {
  23597. rule: 'optional',
  23598. type: 'DirectCommand',
  23599. name: 'directMessage',
  23600. id: 104
  23601. }, {
  23602. rule: 'optional',
  23603. type: 'AckCommand',
  23604. name: 'ackMessage',
  23605. id: 105
  23606. }, {
  23607. rule: 'optional',
  23608. type: 'UnreadCommand',
  23609. name: 'unreadMessage',
  23610. id: 106
  23611. }, {
  23612. rule: 'optional',
  23613. type: 'ReadCommand',
  23614. name: 'readMessage',
  23615. id: 107
  23616. }, {
  23617. rule: 'optional',
  23618. type: 'RcpCommand',
  23619. name: 'rcpMessage',
  23620. id: 108
  23621. }, {
  23622. rule: 'optional',
  23623. type: 'LogsCommand',
  23624. name: 'logsMessage',
  23625. id: 109
  23626. }, {
  23627. rule: 'optional',
  23628. type: 'ConvCommand',
  23629. name: 'convMessage',
  23630. id: 110
  23631. }, {
  23632. rule: 'optional',
  23633. type: 'RoomCommand',
  23634. name: 'roomMessage',
  23635. id: 111
  23636. }, {
  23637. rule: 'optional',
  23638. type: 'PresenceCommand',
  23639. name: 'presenceMessage',
  23640. id: 112
  23641. }, {
  23642. rule: 'optional',
  23643. type: 'ReportCommand',
  23644. name: 'reportMessage',
  23645. id: 113
  23646. }, {
  23647. rule: 'optional',
  23648. type: 'PatchCommand',
  23649. name: 'patchMessage',
  23650. id: 114
  23651. }, {
  23652. rule: 'optional',
  23653. type: 'PubsubCommand',
  23654. name: 'pubsubMessage',
  23655. id: 115
  23656. }, {
  23657. rule: 'optional',
  23658. type: 'BlacklistCommand',
  23659. name: 'blacklistMessage',
  23660. id: 116
  23661. }]
  23662. }],
  23663. enums: [{
  23664. name: 'CommandType',
  23665. syntax: 'proto2',
  23666. values: [{
  23667. name: 'session',
  23668. id: 0
  23669. }, {
  23670. name: 'conv',
  23671. id: 1
  23672. }, {
  23673. name: 'direct',
  23674. id: 2
  23675. }, {
  23676. name: 'ack',
  23677. id: 3
  23678. }, {
  23679. name: 'rcp',
  23680. id: 4
  23681. }, {
  23682. name: 'unread',
  23683. id: 5
  23684. }, {
  23685. name: 'logs',
  23686. id: 6
  23687. }, {
  23688. name: 'error',
  23689. id: 7
  23690. }, {
  23691. name: 'login',
  23692. id: 8
  23693. }, {
  23694. name: 'data',
  23695. id: 9
  23696. }, {
  23697. name: 'room',
  23698. id: 10
  23699. }, {
  23700. name: 'read',
  23701. id: 11
  23702. }, {
  23703. name: 'presence',
  23704. id: 12
  23705. }, {
  23706. name: 'report',
  23707. id: 13
  23708. }, {
  23709. name: 'echo',
  23710. id: 14
  23711. }, {
  23712. name: 'loggedin',
  23713. id: 15
  23714. }, {
  23715. name: 'logout',
  23716. id: 16
  23717. }, {
  23718. name: 'loggedout',
  23719. id: 17
  23720. }, {
  23721. name: 'patch',
  23722. id: 18
  23723. }, {
  23724. name: 'pubsub',
  23725. id: 19
  23726. }, {
  23727. name: 'blacklist',
  23728. id: 20
  23729. }, {
  23730. name: 'goaway',
  23731. id: 21
  23732. }]
  23733. }, {
  23734. name: 'OpType',
  23735. syntax: 'proto2',
  23736. values: [{
  23737. name: 'open',
  23738. id: 1
  23739. }, {
  23740. name: 'add',
  23741. id: 2
  23742. }, {
  23743. name: 'remove',
  23744. id: 3
  23745. }, {
  23746. name: 'close',
  23747. id: 4
  23748. }, {
  23749. name: 'opened',
  23750. id: 5
  23751. }, {
  23752. name: 'closed',
  23753. id: 6
  23754. }, {
  23755. name: 'query',
  23756. id: 7
  23757. }, {
  23758. name: 'query_result',
  23759. id: 8
  23760. }, {
  23761. name: 'conflict',
  23762. id: 9
  23763. }, {
  23764. name: 'added',
  23765. id: 10
  23766. }, {
  23767. name: 'removed',
  23768. id: 11
  23769. }, {
  23770. name: 'refresh',
  23771. id: 12
  23772. }, {
  23773. name: 'refreshed',
  23774. id: 13
  23775. }, {
  23776. name: 'start',
  23777. id: 30
  23778. }, {
  23779. name: 'started',
  23780. id: 31
  23781. }, {
  23782. name: 'joined',
  23783. id: 32
  23784. }, {
  23785. name: 'members_joined',
  23786. id: 33
  23787. }, {
  23788. name: 'left',
  23789. id: 39
  23790. }, {
  23791. name: 'members_left',
  23792. id: 40
  23793. }, {
  23794. name: 'results',
  23795. id: 42
  23796. }, {
  23797. name: 'count',
  23798. id: 43
  23799. }, {
  23800. name: 'result',
  23801. id: 44
  23802. }, {
  23803. name: 'update',
  23804. id: 45
  23805. }, {
  23806. name: 'updated',
  23807. id: 46
  23808. }, {
  23809. name: 'mute',
  23810. id: 47
  23811. }, {
  23812. name: 'unmute',
  23813. id: 48
  23814. }, {
  23815. name: 'status',
  23816. id: 49
  23817. }, {
  23818. name: 'members',
  23819. id: 50
  23820. }, {
  23821. name: 'max_read',
  23822. id: 51
  23823. }, {
  23824. name: 'is_member',
  23825. id: 52
  23826. }, {
  23827. name: 'member_info_update',
  23828. id: 53
  23829. }, {
  23830. name: 'member_info_updated',
  23831. id: 54
  23832. }, {
  23833. name: 'member_info_changed',
  23834. id: 55
  23835. }, {
  23836. name: 'join',
  23837. id: 80
  23838. }, {
  23839. name: 'invite',
  23840. id: 81
  23841. }, {
  23842. name: 'leave',
  23843. id: 82
  23844. }, {
  23845. name: 'kick',
  23846. id: 83
  23847. }, {
  23848. name: 'reject',
  23849. id: 84
  23850. }, {
  23851. name: 'invited',
  23852. id: 85
  23853. }, {
  23854. name: 'kicked',
  23855. id: 86
  23856. }, {
  23857. name: 'upload',
  23858. id: 100
  23859. }, {
  23860. name: 'uploaded',
  23861. id: 101
  23862. }, {
  23863. name: 'subscribe',
  23864. id: 120
  23865. }, {
  23866. name: 'subscribed',
  23867. id: 121
  23868. }, {
  23869. name: 'unsubscribe',
  23870. id: 122
  23871. }, {
  23872. name: 'unsubscribed',
  23873. id: 123
  23874. }, {
  23875. name: 'is_subscribed',
  23876. id: 124
  23877. }, {
  23878. name: 'modify',
  23879. id: 150
  23880. }, {
  23881. name: 'modified',
  23882. id: 151
  23883. }, {
  23884. name: 'block',
  23885. id: 170
  23886. }, {
  23887. name: 'unblock',
  23888. id: 171
  23889. }, {
  23890. name: 'blocked',
  23891. id: 172
  23892. }, {
  23893. name: 'unblocked',
  23894. id: 173
  23895. }, {
  23896. name: 'members_blocked',
  23897. id: 174
  23898. }, {
  23899. name: 'members_unblocked',
  23900. id: 175
  23901. }, {
  23902. name: 'check_block',
  23903. id: 176
  23904. }, {
  23905. name: 'check_result',
  23906. id: 177
  23907. }, {
  23908. name: 'add_shutup',
  23909. id: 180
  23910. }, {
  23911. name: 'remove_shutup',
  23912. id: 181
  23913. }, {
  23914. name: 'query_shutup',
  23915. id: 182
  23916. }, {
  23917. name: 'shutup_added',
  23918. id: 183
  23919. }, {
  23920. name: 'shutup_removed',
  23921. id: 184
  23922. }, {
  23923. name: 'shutup_result',
  23924. id: 185
  23925. }, {
  23926. name: 'shutuped',
  23927. id: 186
  23928. }, {
  23929. name: 'unshutuped',
  23930. id: 187
  23931. }, {
  23932. name: 'members_shutuped',
  23933. id: 188
  23934. }, {
  23935. name: 'members_unshutuped',
  23936. id: 189
  23937. }, {
  23938. name: 'check_shutup',
  23939. id: 190
  23940. }]
  23941. }, {
  23942. name: 'StatusType',
  23943. syntax: 'proto2',
  23944. values: [{
  23945. name: 'on',
  23946. id: 1
  23947. }, {
  23948. name: 'off',
  23949. id: 2
  23950. }]
  23951. }],
  23952. isNamespace: true
  23953. }).build();
  23954. var _messages$push_server = messageCompiled.push_server.messages2,
  23955. JsonObjectMessage = _messages$push_server.JsonObjectMessage,
  23956. UnreadTuple = _messages$push_server.UnreadTuple,
  23957. LogItem = _messages$push_server.LogItem,
  23958. DataCommand = _messages$push_server.DataCommand,
  23959. SessionCommand = _messages$push_server.SessionCommand,
  23960. ErrorCommand = _messages$push_server.ErrorCommand,
  23961. DirectCommand = _messages$push_server.DirectCommand,
  23962. AckCommand = _messages$push_server.AckCommand,
  23963. UnreadCommand = _messages$push_server.UnreadCommand,
  23964. ConvCommand = _messages$push_server.ConvCommand,
  23965. RoomCommand = _messages$push_server.RoomCommand,
  23966. LogsCommand = _messages$push_server.LogsCommand,
  23967. RcpCommand = _messages$push_server.RcpCommand,
  23968. ReadTuple = _messages$push_server.ReadTuple,
  23969. MaxReadTuple = _messages$push_server.MaxReadTuple,
  23970. ReadCommand = _messages$push_server.ReadCommand,
  23971. PresenceCommand = _messages$push_server.PresenceCommand,
  23972. ReportCommand = _messages$push_server.ReportCommand,
  23973. GenericCommand = _messages$push_server.GenericCommand,
  23974. BlacklistCommand = _messages$push_server.BlacklistCommand,
  23975. PatchCommand = _messages$push_server.PatchCommand,
  23976. PatchItem = _messages$push_server.PatchItem,
  23977. ConvMemberInfo = _messages$push_server.ConvMemberInfo,
  23978. CommandType = _messages$push_server.CommandType,
  23979. OpType = _messages$push_server.OpType,
  23980. StatusType = _messages$push_server.StatusType;
  23981. var message = /*#__PURE__*/(0, _freeze.default)({
  23982. __proto__: null,
  23983. JsonObjectMessage: JsonObjectMessage,
  23984. UnreadTuple: UnreadTuple,
  23985. LogItem: LogItem,
  23986. DataCommand: DataCommand,
  23987. SessionCommand: SessionCommand,
  23988. ErrorCommand: ErrorCommand,
  23989. DirectCommand: DirectCommand,
  23990. AckCommand: AckCommand,
  23991. UnreadCommand: UnreadCommand,
  23992. ConvCommand: ConvCommand,
  23993. RoomCommand: RoomCommand,
  23994. LogsCommand: LogsCommand,
  23995. RcpCommand: RcpCommand,
  23996. ReadTuple: ReadTuple,
  23997. MaxReadTuple: MaxReadTuple,
  23998. ReadCommand: ReadCommand,
  23999. PresenceCommand: PresenceCommand,
  24000. ReportCommand: ReportCommand,
  24001. GenericCommand: GenericCommand,
  24002. BlacklistCommand: BlacklistCommand,
  24003. PatchCommand: PatchCommand,
  24004. PatchItem: PatchItem,
  24005. ConvMemberInfo: ConvMemberInfo,
  24006. CommandType: CommandType,
  24007. OpType: OpType,
  24008. StatusType: StatusType
  24009. });
  24010. var adapters = {};
  24011. var getAdapter = function getAdapter(name) {
  24012. var adapter = adapters[name];
  24013. if (adapter === undefined) {
  24014. throw new Error("".concat(name, " adapter is not configured"));
  24015. }
  24016. return adapter;
  24017. };
  24018. /**
  24019. * 指定 Adapters
  24020. * @function
  24021. * @memberof module:leancloud-realtime
  24022. * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
  24023. */
  24024. var setAdapters = function setAdapters(newAdapters) {
  24025. (0, _assign.default)(adapters, newAdapters);
  24026. };
  24027. /* eslint-disable */
  24028. var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
  24029. var EXPIRED = (0, _symbol.default)('expired');
  24030. var debug = d('LC:Expirable');
  24031. var Expirable = /*#__PURE__*/function () {
  24032. function Expirable(value, ttl) {
  24033. this.originalValue = value;
  24034. if (typeof ttl === 'number') {
  24035. this.expiredAt = Date.now() + ttl;
  24036. }
  24037. }
  24038. _createClass(Expirable, [{
  24039. key: "value",
  24040. get: function get() {
  24041. var expired = this.expiredAt && this.expiredAt <= Date.now();
  24042. if (expired) debug("expired: ".concat(this.originalValue));
  24043. return expired ? EXPIRED : this.originalValue;
  24044. }
  24045. }]);
  24046. return Expirable;
  24047. }();
  24048. Expirable.EXPIRED = EXPIRED;
  24049. var debug$1 = d('LC:Cache');
  24050. var Cache = /*#__PURE__*/function () {
  24051. function Cache() {
  24052. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
  24053. this.name = name;
  24054. this._map = {};
  24055. }
  24056. var _proto = Cache.prototype;
  24057. _proto.get = function get(key) {
  24058. var _context5;
  24059. var cache = this._map[key];
  24060. if (cache) {
  24061. var value = cache.value;
  24062. if (value !== Expirable.EXPIRED) {
  24063. debug$1('[%s] hit: %s', this.name, key);
  24064. return value;
  24065. }
  24066. delete this._map[key];
  24067. }
  24068. debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
  24069. return null;
  24070. };
  24071. _proto.set = function set(key, value, ttl) {
  24072. debug$1('[%s] set: %s %d', this.name, key, ttl);
  24073. this._map[key] = new Expirable(value, ttl);
  24074. };
  24075. return Cache;
  24076. }();
  24077. function ownKeys(object, enumerableOnly) {
  24078. var keys = (0, _keys.default)(object);
  24079. if (_getOwnPropertySymbols.default) {
  24080. var symbols = (0, _getOwnPropertySymbols.default)(object);
  24081. if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
  24082. return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
  24083. });
  24084. keys.push.apply(keys, symbols);
  24085. }
  24086. return keys;
  24087. }
  24088. function _objectSpread(target) {
  24089. for (var i = 1; i < arguments.length; i++) {
  24090. var source = arguments[i] != null ? arguments[i] : {};
  24091. if (i % 2) {
  24092. ownKeys(Object(source), true).forEach(function (key) {
  24093. _defineProperty(target, key, source[key]);
  24094. });
  24095. } else if (_getOwnPropertyDescriptors.default) {
  24096. (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
  24097. } else {
  24098. ownKeys(Object(source)).forEach(function (key) {
  24099. (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
  24100. });
  24101. }
  24102. }
  24103. return target;
  24104. }
  24105. /**
  24106. * 调试日志控制器
  24107. * @const
  24108. * @memberof module:leancloud-realtime
  24109. * @example
  24110. * debug.enable(); // 启用调试日志
  24111. * debug.disable(); // 关闭调试日志
  24112. */
  24113. var debug$2 = {
  24114. enable: function enable() {
  24115. var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
  24116. return d.enable(namespaces);
  24117. },
  24118. disable: d.disable
  24119. };
  24120. var tryAll = function tryAll(promiseConstructors) {
  24121. var promise = new _promise.default(promiseConstructors[0]);
  24122. if (promiseConstructors.length === 1) {
  24123. return promise;
  24124. }
  24125. return promise["catch"](function () {
  24126. return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
  24127. });
  24128. }; // eslint-disable-next-line no-sequences
  24129. var tap = function tap(interceptor) {
  24130. return function (value) {
  24131. return interceptor(value), value;
  24132. };
  24133. };
  24134. var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
  24135. var map = new _weakMap.default(); // protected property helper
  24136. var internal = function internal(object) {
  24137. if (!map.has(object)) {
  24138. map.set(object, {});
  24139. }
  24140. return map.get(object);
  24141. };
  24142. var compact = function compact(obj, filter) {
  24143. if (!isPlainObject(obj)) return obj;
  24144. var object = _objectSpread({}, obj);
  24145. (0, _keys.default)(object).forEach(function (prop) {
  24146. var value = object[prop];
  24147. if (value === filter) {
  24148. delete object[prop];
  24149. } else {
  24150. object[prop] = compact(value, filter);
  24151. }
  24152. });
  24153. return object;
  24154. }; // debug utility
  24155. var removeNull = function removeNull(obj) {
  24156. return compact(obj, null);
  24157. };
  24158. var trim = function trim(message) {
  24159. return removeNull(JSON.parse((0, _stringify.default)(message)));
  24160. };
  24161. var ensureArray = function ensureArray(target) {
  24162. if (Array.isArray(target)) {
  24163. return target;
  24164. }
  24165. if (target === undefined || target === null) {
  24166. return [];
  24167. }
  24168. return [target];
  24169. };
  24170. var isWeapp = // eslint-disable-next-line no-undef
  24171. (typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator
  24172. var isCNApp = function isCNApp(appId) {
  24173. return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
  24174. };
  24175. var equalBuffer = function equalBuffer(buffer1, buffer2) {
  24176. if (!buffer1 || !buffer2) return false;
  24177. if (buffer1.byteLength !== buffer2.byteLength) return false;
  24178. var a = new Uint8Array(buffer1);
  24179. var b = new Uint8Array(buffer2);
  24180. return !a.some(function (value, index) {
  24181. return value !== b[index];
  24182. });
  24183. };
  24184. var _class;
  24185. function ownKeys$1(object, enumerableOnly) {
  24186. var keys = (0, _keys.default)(object);
  24187. if (_getOwnPropertySymbols.default) {
  24188. var symbols = (0, _getOwnPropertySymbols.default)(object);
  24189. if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
  24190. return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
  24191. });
  24192. keys.push.apply(keys, symbols);
  24193. }
  24194. return keys;
  24195. }
  24196. function _objectSpread$1(target) {
  24197. for (var i = 1; i < arguments.length; i++) {
  24198. var source = arguments[i] != null ? arguments[i] : {};
  24199. if (i % 2) {
  24200. ownKeys$1(Object(source), true).forEach(function (key) {
  24201. _defineProperty(target, key, source[key]);
  24202. });
  24203. } else if (_getOwnPropertyDescriptors.default) {
  24204. (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
  24205. } else {
  24206. ownKeys$1(Object(source)).forEach(function (key) {
  24207. (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
  24208. });
  24209. }
  24210. }
  24211. return target;
  24212. }
  24213. var debug$3 = d('LC:WebSocketPlus');
  24214. var OPEN = 'open';
  24215. var DISCONNECT = 'disconnect';
  24216. var RECONNECT = 'reconnect';
  24217. var RETRY = 'retry';
  24218. var SCHEDULE = 'schedule';
  24219. var OFFLINE = 'offline';
  24220. var ONLINE = 'online';
  24221. var ERROR = 'error';
  24222. var MESSAGE = 'message';
  24223. var HEARTBEAT_TIME = 180000;
  24224. var TIMEOUT_TIME = 380000;
  24225. var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
  24226. return Math.min(1000 * Math.pow(2, attempt), 300000);
  24227. };
  24228. var requireConnected = function requireConnected(target, name, descriptor) {
  24229. return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
  24230. value: function requireConnectedWrapper() {
  24231. var _context7;
  24232. var _descriptor$value;
  24233. this.checkConnectionAvailability(name);
  24234. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  24235. args[_key] = arguments[_key];
  24236. }
  24237. return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
  24238. }
  24239. });
  24240. };
  24241. var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
  24242. _inheritsLoose(WebSocketPlus, _EventEmitter);
  24243. _createClass(WebSocketPlus, [{
  24244. key: "urls",
  24245. get: function get() {
  24246. return this._urls;
  24247. },
  24248. set: function set(urls) {
  24249. this._urls = ensureArray(urls);
  24250. }
  24251. }]);
  24252. function WebSocketPlus(getUrls, protocol) {
  24253. var _this;
  24254. _this = _EventEmitter.call(this) || this;
  24255. _this.init();
  24256. _this._protocol = protocol;
  24257. _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
  24258. _this._urls = urls;
  24259. return _this._open();
  24260. }).then(function () {
  24261. _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
  24262. if (global$1.addEventListener) {
  24263. _this.__pause = function () {
  24264. if (_this.can('pause')) _this.pause();
  24265. };
  24266. _this.__resume = function () {
  24267. if (_this.can('resume')) _this.resume();
  24268. };
  24269. global$1.addEventListener('offline', _this.__pause);
  24270. global$1.addEventListener('online', _this.__resume);
  24271. }
  24272. _this.open();
  24273. })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
  24274. return _this;
  24275. }
  24276. var _proto = WebSocketPlus.prototype;
  24277. _proto._open = function _open() {
  24278. var _this2 = this;
  24279. return this._createWs(this._urls, this._protocol).then(function (ws) {
  24280. var _context8;
  24281. var _this2$_urls = _toArray(_this2._urls),
  24282. first = _this2$_urls[0],
  24283. reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
  24284. _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
  24285. return ws;
  24286. });
  24287. };
  24288. _proto._createWs = function _createWs(urls, protocol) {
  24289. var _this3 = this;
  24290. return tryAll((0, _map.default)(urls).call(urls, function (url) {
  24291. return function (resolve, reject) {
  24292. var _context9;
  24293. debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
  24294. var WebSocket = getAdapter('WebSocket');
  24295. var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
  24296. ws.binaryType = _this3.binaryType || 'arraybuffer';
  24297. ws.onopen = function () {
  24298. return resolve(ws);
  24299. };
  24300. ws.onclose = function (error) {
  24301. if (error instanceof Error) {
  24302. return reject(error);
  24303. } // in browser, error event is useless
  24304. return reject(new Error("Failed to connect [".concat(url, "]")));
  24305. };
  24306. ws.onerror = ws.onclose;
  24307. };
  24308. })).then(function (ws) {
  24309. _this3._ws = ws;
  24310. _this3._ws.onclose = _this3._handleClose.bind(_this3);
  24311. _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
  24312. return ws;
  24313. });
  24314. };
  24315. _proto._destroyWs = function _destroyWs() {
  24316. var ws = this._ws;
  24317. if (!ws) return;
  24318. ws.onopen = null;
  24319. ws.onclose = null;
  24320. ws.onerror = null;
  24321. ws.onmessage = null;
  24322. this._ws = null;
  24323. ws.close();
  24324. } // eslint-disable-next-line class-methods-use-this
  24325. ;
  24326. _proto.onbeforeevent = function onbeforeevent(event, from, to) {
  24327. var _context10, _context11;
  24328. for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
  24329. payload[_key2 - 3] = arguments[_key2];
  24330. }
  24331. debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
  24332. };
  24333. _proto.onopen = function onopen() {
  24334. this.emit(OPEN);
  24335. };
  24336. _proto.onconnected = function onconnected() {
  24337. this._startConnectionKeeper();
  24338. };
  24339. _proto.onleaveconnected = function onleaveconnected(event, from, to) {
  24340. this._stopConnectionKeeper();
  24341. this._destroyWs();
  24342. if (to === 'offline' || to === 'disconnected') {
  24343. this.emit(DISCONNECT);
  24344. }
  24345. };
  24346. _proto.onpause = function onpause() {
  24347. this.emit(OFFLINE);
  24348. };
  24349. _proto.onbeforeresume = function onbeforeresume() {
  24350. this.emit(ONLINE);
  24351. };
  24352. _proto.onreconnect = function onreconnect() {
  24353. this.emit(RECONNECT);
  24354. };
  24355. _proto.ondisconnected = function ondisconnected(event, from, to) {
  24356. var _context12;
  24357. var _this4 = this;
  24358. var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  24359. var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
  24360. debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
  24361. this.emit(SCHEDULE, attempt, delay);
  24362. if (this.__scheduledRetry) {
  24363. clearTimeout(this.__scheduledRetry);
  24364. }
  24365. this.__scheduledRetry = setTimeout(function () {
  24366. if (_this4.is('disconnected')) {
  24367. _this4.retry(attempt);
  24368. }
  24369. }, delay);
  24370. };
  24371. _proto.onretry = function onretry(event, from, to) {
  24372. var _this5 = this;
  24373. var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  24374. this.emit(RETRY, attempt);
  24375. this._open().then(function () {
  24376. return _this5.can('reconnect') && _this5.reconnect();
  24377. }, function () {
  24378. return _this5.can('fail') && _this5.fail(attempt + 1);
  24379. });
  24380. };
  24381. _proto.onerror = function onerror(event, from, to, error) {
  24382. this.emit(ERROR, error);
  24383. };
  24384. _proto.onclose = function onclose() {
  24385. if (global$1.removeEventListener) {
  24386. if (this.__pause) global$1.removeEventListener('offline', this.__pause);
  24387. if (this.__resume) global$1.removeEventListener('online', this.__resume);
  24388. }
  24389. };
  24390. _proto.checkConnectionAvailability = function checkConnectionAvailability() {
  24391. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
  24392. if (!this.is('connected')) {
  24393. var _context13;
  24394. var currentState = this.current;
  24395. console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
  24396. if (this.is('disconnected') || this.is('reconnecting')) {
  24397. console.warn('disconnect and reconnect event should be handled to avoid such calls.');
  24398. }
  24399. throw new Error('Connection unavailable');
  24400. }
  24401. } // jsdoc-ignore-start
  24402. ;
  24403. _proto. // jsdoc-ignore-end
  24404. _ping = function _ping() {
  24405. debug$3('ping');
  24406. try {
  24407. this.ping();
  24408. } catch (error) {
  24409. console.warn("websocket ping error: ".concat(error.message));
  24410. }
  24411. };
  24412. _proto.ping = function ping() {
  24413. if (this._ws.ping) {
  24414. this._ws.ping();
  24415. } else {
  24416. console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
  24417. }
  24418. };
  24419. _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
  24420. var _this6 = this;
  24421. debug$3('_postponeTimeoutTimer');
  24422. this._clearTimeoutTimers();
  24423. this._timeoutTimer = setTimeout(function () {
  24424. debug$3('timeout');
  24425. _this6.disconnect();
  24426. }, TIMEOUT_TIME);
  24427. };
  24428. _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
  24429. if (this._timeoutTimer) {
  24430. clearTimeout(this._timeoutTimer);
  24431. }
  24432. };
  24433. _proto._startConnectionKeeper = function _startConnectionKeeper() {
  24434. debug$3('start connection keeper');
  24435. this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
  24436. var addListener = this._ws.addListener || this._ws.addEventListener;
  24437. if (!addListener) {
  24438. debug$3('connection keeper disabled due to the lack of #addEventListener.');
  24439. return;
  24440. }
  24441. addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
  24442. addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
  24443. this._postponeTimeoutTimer();
  24444. };
  24445. _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
  24446. debug$3('stop connection keeper'); // websockets/ws#489
  24447. var removeListener = this._ws.removeListener || this._ws.removeEventListener;
  24448. if (removeListener) {
  24449. removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
  24450. removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
  24451. this._clearTimeoutTimers();
  24452. }
  24453. if (this._heartbeatTimer) {
  24454. clearInterval(this._heartbeatTimer);
  24455. }
  24456. };
  24457. _proto._handleClose = function _handleClose(event) {
  24458. var _context14;
  24459. debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
  24460. if (this.isFinished()) return;
  24461. this.handleClose(event);
  24462. };
  24463. _proto.handleClose = function handleClose() {
  24464. // reconnect
  24465. this.disconnect();
  24466. } // jsdoc-ignore-start
  24467. ;
  24468. _proto. // jsdoc-ignore-end
  24469. send = function send(data) {
  24470. debug$3('send', data);
  24471. this._ws.send(data);
  24472. };
  24473. _proto._handleMessage = function _handleMessage(event) {
  24474. debug$3('message', event.data);
  24475. this.handleMessage(event.data);
  24476. };
  24477. _proto.handleMessage = function handleMessage(message) {
  24478. this.emit(MESSAGE, message);
  24479. };
  24480. return WebSocketPlus;
  24481. }(EventEmitter), (_applyDecoratedDescriptor(_class.prototype, "_ping", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_ping"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "send", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "send"), _class.prototype)), _class);
  24482. StateMachine.create({
  24483. target: WebSocketPlus.prototype,
  24484. initial: {
  24485. state: 'initialized',
  24486. event: 'init',
  24487. defer: true
  24488. },
  24489. terminal: 'closed',
  24490. events: [{
  24491. name: 'open',
  24492. from: 'initialized',
  24493. to: 'connected'
  24494. }, {
  24495. name: 'disconnect',
  24496. from: 'connected',
  24497. to: 'disconnected'
  24498. }, {
  24499. name: 'retry',
  24500. from: 'disconnected',
  24501. to: 'reconnecting'
  24502. }, {
  24503. name: 'fail',
  24504. from: 'reconnecting',
  24505. to: 'disconnected'
  24506. }, {
  24507. name: 'reconnect',
  24508. from: 'reconnecting',
  24509. to: 'connected'
  24510. }, {
  24511. name: 'pause',
  24512. from: ['connected', 'disconnected', 'reconnecting'],
  24513. to: 'offline'
  24514. }, {}, {
  24515. name: 'resume',
  24516. from: 'offline',
  24517. to: 'disconnected'
  24518. }, {
  24519. name: 'close',
  24520. from: ['connected', 'disconnected', 'reconnecting', 'offline'],
  24521. to: 'closed'
  24522. }, {
  24523. name: 'throw',
  24524. from: '*',
  24525. to: 'error'
  24526. }]
  24527. });
  24528. var error = (0, _freeze.default)({
  24529. 1000: {
  24530. name: 'CLOSE_NORMAL'
  24531. },
  24532. 1006: {
  24533. name: 'CLOSE_ABNORMAL'
  24534. },
  24535. 4100: {
  24536. name: 'APP_NOT_AVAILABLE',
  24537. message: 'App not exists or realtime message service is disabled.'
  24538. },
  24539. 4102: {
  24540. name: 'SIGNATURE_FAILED',
  24541. message: 'Login signature mismatch.'
  24542. },
  24543. 4103: {
  24544. name: 'INVALID_LOGIN',
  24545. message: 'Malformed clientId.'
  24546. },
  24547. 4105: {
  24548. name: 'SESSION_REQUIRED',
  24549. message: 'Message sent before session opened.'
  24550. },
  24551. 4107: {
  24552. name: 'READ_TIMEOUT'
  24553. },
  24554. 4108: {
  24555. name: 'LOGIN_TIMEOUT'
  24556. },
  24557. 4109: {
  24558. name: 'FRAME_TOO_LONG'
  24559. },
  24560. 4110: {
  24561. name: 'INVALID_ORIGIN',
  24562. message: 'Access denied by domain whitelist.'
  24563. },
  24564. 4111: {
  24565. name: 'SESSION_CONFLICT'
  24566. },
  24567. 4112: {
  24568. name: 'SESSION_TOKEN_EXPIRED'
  24569. },
  24570. 4113: {
  24571. name: 'APP_QUOTA_EXCEEDED',
  24572. message: 'The daily active users limit exceeded.'
  24573. },
  24574. 4116: {
  24575. name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
  24576. message: 'Command sent too fast.'
  24577. },
  24578. 4200: {
  24579. name: 'INTERNAL_ERROR',
  24580. message: 'Internal error, please contact LeanCloud for support.'
  24581. },
  24582. 4301: {
  24583. name: 'CONVERSATION_API_FAILED',
  24584. message: 'Upstream Conversatoin API failed, see error.detail for details.'
  24585. },
  24586. 4302: {
  24587. name: 'CONVERSATION_SIGNATURE_FAILED',
  24588. message: 'Conversation action signature mismatch.'
  24589. },
  24590. 4303: {
  24591. name: 'CONVERSATION_NOT_FOUND'
  24592. },
  24593. 4304: {
  24594. name: 'CONVERSATION_FULL'
  24595. },
  24596. 4305: {
  24597. name: 'CONVERSATION_REJECTED_BY_APP',
  24598. message: 'Conversation action rejected by hook.'
  24599. },
  24600. 4306: {
  24601. name: 'CONVERSATION_UPDATE_FAILED'
  24602. },
  24603. 4307: {
  24604. name: 'CONVERSATION_READ_ONLY'
  24605. },
  24606. 4308: {
  24607. name: 'CONVERSATION_NOT_ALLOWED'
  24608. },
  24609. 4309: {
  24610. name: 'CONVERSATION_UPDATE_REJECTED',
  24611. message: 'Conversation update rejected because the client is not a member.'
  24612. },
  24613. 4310: {
  24614. name: 'CONVERSATION_QUERY_FAILED',
  24615. message: 'Conversation query failed because it is too expansive.'
  24616. },
  24617. 4311: {
  24618. name: 'CONVERSATION_LOG_FAILED'
  24619. },
  24620. 4312: {
  24621. name: 'CONVERSATION_LOG_REJECTED',
  24622. message: 'Message query rejected because the client is not a member of the conversation.'
  24623. },
  24624. 4313: {
  24625. name: 'SYSTEM_CONVERSATION_REQUIRED'
  24626. },
  24627. 4314: {
  24628. name: 'NORMAL_CONVERSATION_REQUIRED'
  24629. },
  24630. 4315: {
  24631. name: 'CONVERSATION_BLACKLISTED',
  24632. message: 'Blacklisted in the conversation.'
  24633. },
  24634. 4316: {
  24635. name: 'TRANSIENT_CONVERSATION_REQUIRED'
  24636. },
  24637. 4317: {
  24638. name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
  24639. },
  24640. 4318: {
  24641. name: 'CONVERSATION_API_QUOTA_EXCEEDED',
  24642. message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
  24643. },
  24644. 4323: {
  24645. name: 'TEMPORARY_CONVERSATION_EXPIRED',
  24646. message: 'Temporary conversation expired or does not exist.'
  24647. },
  24648. 4401: {
  24649. name: 'INVALID_MESSAGING_TARGET',
  24650. message: 'Conversation does not exist or client is not a member.'
  24651. },
  24652. 4402: {
  24653. name: 'MESSAGE_REJECTED_BY_APP',
  24654. message: 'Message rejected by hook.'
  24655. },
  24656. 4403: {
  24657. name: 'MESSAGE_OWNERSHIP_REQUIRED'
  24658. },
  24659. 4404: {
  24660. name: 'MESSAGE_NOT_FOUND'
  24661. },
  24662. 4405: {
  24663. name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
  24664. message: 'Message update rejected by hook.'
  24665. },
  24666. 4406: {
  24667. name: 'MESSAGE_EDIT_DISABLED'
  24668. },
  24669. 4407: {
  24670. name: 'MESSAGE_RECALL_DISABLED'
  24671. },
  24672. 5130: {
  24673. name: 'OWNER_PROMOTION_NOT_ALLOWED',
  24674. message: "Updating a member's role to owner is not allowed."
  24675. }
  24676. });
  24677. var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
  24678. return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
  24679. }, {}));
  24680. var createError = function createError(_ref) {
  24681. var code = _ref.code,
  24682. reason = _ref.reason,
  24683. appCode = _ref.appCode,
  24684. detail = _ref.detail,
  24685. errorMessage = _ref.error;
  24686. var message = reason || detail || errorMessage;
  24687. var name = reason;
  24688. if (!message && error[code]) {
  24689. name = error[code].name;
  24690. message = error[code].message || name;
  24691. }
  24692. if (!message) {
  24693. message = "Unknow Error: ".concat(code);
  24694. }
  24695. var err = new Error(message);
  24696. return (0, _assign.default)(err, {
  24697. code: code,
  24698. appCode: appCode,
  24699. detail: detail,
  24700. name: name
  24701. });
  24702. };
  24703. var debug$4 = d('LC:Connection');
  24704. var COMMAND_TIMEOUT = 20000;
  24705. var EXPIRE = (0, _symbol.default)('expire');
  24706. var isIdempotentCommand = function isIdempotentCommand(command) {
  24707. return !(command.cmd === CommandType.direct || command.cmd === CommandType.session && command.op === OpType.open || command.cmd === CommandType.conv && (command.op === OpType.start || command.op === OpType.update || command.op === OpType.members));
  24708. };
  24709. var Connection = /*#__PURE__*/function (_WebSocketPlus) {
  24710. _inheritsLoose(Connection, _WebSocketPlus);
  24711. function Connection(getUrl, _ref) {
  24712. var _context16;
  24713. var _this;
  24714. var format = _ref.format,
  24715. version = _ref.version;
  24716. debug$4('initializing Connection');
  24717. var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
  24718. _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
  24719. _this._protocolFormat = format;
  24720. _this._commands = {};
  24721. _this._serialId = 0;
  24722. return _this;
  24723. }
  24724. var _proto = Connection.prototype;
  24725. _proto.send = /*#__PURE__*/function () {
  24726. var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
  24727. var _this2 = this;
  24728. var waitingForRespond,
  24729. buffer,
  24730. serialId,
  24731. duplicatedCommand,
  24732. message,
  24733. promise,
  24734. _args = arguments;
  24735. return _regeneratorRuntime.wrap(function _callee$(_context) {
  24736. var _context17, _context18;
  24737. while (1) {
  24738. switch (_context.prev = _context.next) {
  24739. case 0:
  24740. waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
  24741. if (!waitingForRespond) {
  24742. _context.next = 11;
  24743. break;
  24744. }
  24745. if (!isIdempotentCommand(command)) {
  24746. _context.next = 8;
  24747. break;
  24748. }
  24749. buffer = command.toArrayBuffer();
  24750. duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
  24751. var targetBuffer = _ref2.buffer,
  24752. targetCommand = _ref2.command;
  24753. return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
  24754. });
  24755. if (!duplicatedCommand) {
  24756. _context.next = 8;
  24757. break;
  24758. }
  24759. console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
  24760. return _context.abrupt("return", duplicatedCommand.promise);
  24761. case 8:
  24762. this._serialId += 1;
  24763. serialId = this._serialId;
  24764. command.i = serialId;
  24765. // eslint-disable-line no-param-reassign
  24766. case 11:
  24767. if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
  24768. if (this._protocolFormat === 'proto2base64') {
  24769. message = command.toBase64();
  24770. } else if (command.toArrayBuffer) {
  24771. message = command.toArrayBuffer();
  24772. }
  24773. if (message) {
  24774. _context.next = 15;
  24775. break;
  24776. }
  24777. throw new TypeError("".concat(command, " is not a GenericCommand"));
  24778. case 15:
  24779. _WebSocketPlus.prototype.send.call(this, message);
  24780. if (waitingForRespond) {
  24781. _context.next = 18;
  24782. break;
  24783. }
  24784. return _context.abrupt("return", undefined);
  24785. case 18:
  24786. promise = new _promise.default(function (resolve, reject) {
  24787. _this2._commands[serialId] = {
  24788. command: command,
  24789. buffer: buffer,
  24790. resolve: resolve,
  24791. reject: reject,
  24792. timeout: setTimeout(function () {
  24793. if (_this2._commands[serialId]) {
  24794. var _context19;
  24795. if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
  24796. reject(createError({
  24797. error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
  24798. name: 'COMMAND_TIMEOUT'
  24799. }));
  24800. delete _this2._commands[serialId];
  24801. }
  24802. }, COMMAND_TIMEOUT)
  24803. };
  24804. });
  24805. this._commands[serialId].promise = promise;
  24806. return _context.abrupt("return", promise);
  24807. case 21:
  24808. case "end":
  24809. return _context.stop();
  24810. }
  24811. }
  24812. }, _callee, this);
  24813. }));
  24814. function send(_x) {
  24815. return _send.apply(this, arguments);
  24816. }
  24817. return send;
  24818. }();
  24819. _proto.handleMessage = function handleMessage(msg) {
  24820. var message;
  24821. try {
  24822. message = GenericCommand.decode(msg);
  24823. if (debug$4.enabled) debug$4('↓ %O received', trim(message));
  24824. } catch (e) {
  24825. console.warn('Decode message failed:', e.message, msg);
  24826. return;
  24827. }
  24828. var serialId = message.i;
  24829. if (serialId) {
  24830. if (this._commands[serialId]) {
  24831. clearTimeout(this._commands[serialId].timeout);
  24832. if (message.cmd === CommandType.error) {
  24833. this._commands[serialId].reject(createError(message.errorMessage));
  24834. } else {
  24835. this._commands[serialId].resolve(message);
  24836. }
  24837. delete this._commands[serialId];
  24838. } else {
  24839. console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
  24840. }
  24841. } else {
  24842. switch (message.cmd) {
  24843. case CommandType.error:
  24844. {
  24845. this.emit(ERROR, createError(message.errorMessage));
  24846. return;
  24847. }
  24848. case CommandType.goaway:
  24849. {
  24850. this.emit(EXPIRE);
  24851. return;
  24852. }
  24853. default:
  24854. {
  24855. this.emit(MESSAGE, message);
  24856. }
  24857. }
  24858. }
  24859. };
  24860. _proto.ping = function ping() {
  24861. return this.send(new GenericCommand({
  24862. cmd: CommandType.echo
  24863. }))["catch"](function (error) {
  24864. return debug$4('ping failed:', error);
  24865. });
  24866. };
  24867. return Connection;
  24868. }(WebSocketPlus);
  24869. var debug$5 = d('LC:request');
  24870. var request = function request(_ref) {
  24871. var _ref$method = _ref.method,
  24872. method = _ref$method === void 0 ? 'GET' : _ref$method,
  24873. _url = _ref.url,
  24874. query = _ref.query,
  24875. headers = _ref.headers,
  24876. data = _ref.data,
  24877. time = _ref.timeout;
  24878. var url = _url;
  24879. if (query) {
  24880. var _context20, _context21, _context23;
  24881. var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
  24882. var _context22;
  24883. var value = query[key];
  24884. if (value === undefined) return undefined;
  24885. var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
  24886. return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
  24887. })).call(_context20, function (qs) {
  24888. return qs;
  24889. }).join('&');
  24890. url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
  24891. }
  24892. debug$5('Req: %O %O %O', method, url, {
  24893. headers: headers,
  24894. data: data
  24895. });
  24896. var request = getAdapter('request');
  24897. var promise = request(url, {
  24898. method: method,
  24899. headers: headers,
  24900. data: data
  24901. }).then(function (response) {
  24902. if (response.ok === false) {
  24903. var error = createError(response.data);
  24904. error.response = response;
  24905. throw error;
  24906. }
  24907. debug$5('Res: %O %O %O', url, response.status, response.data);
  24908. return response.data;
  24909. })["catch"](function (error) {
  24910. if (error.response) {
  24911. debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
  24912. }
  24913. throw error;
  24914. });
  24915. return time ? promiseTimeout.timeout(promise, time) : promise;
  24916. };
  24917. var applyDecorators = function applyDecorators(decorators, target) {
  24918. if (decorators) {
  24919. decorators.forEach(function (decorator) {
  24920. try {
  24921. decorator(target);
  24922. } catch (error) {
  24923. if (decorator._pluginName) {
  24924. error.message += "[".concat(decorator._pluginName, "]");
  24925. }
  24926. throw error;
  24927. }
  24928. });
  24929. }
  24930. };
  24931. var applyDispatcher = function applyDispatcher(dispatchers, payload) {
  24932. var _context24;
  24933. return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
  24934. return resultPromise.then(function (shouldDispatch) {
  24935. return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
  24936. })["catch"](function (error) {
  24937. if (dispatcher._pluginName) {
  24938. // eslint-disable-next-line no-param-reassign
  24939. error.message += "[".concat(dispatcher._pluginName, "]");
  24940. }
  24941. throw error;
  24942. });
  24943. }, _promise.default.resolve(true));
  24944. };
  24945. var version = "5.0.0-rc.7";
  24946. function ownKeys$2(object, enumerableOnly) {
  24947. var keys = (0, _keys.default)(object);
  24948. if (_getOwnPropertySymbols.default) {
  24949. var symbols = (0, _getOwnPropertySymbols.default)(object);
  24950. if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
  24951. return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
  24952. });
  24953. keys.push.apply(keys, symbols);
  24954. }
  24955. return keys;
  24956. }
  24957. function _objectSpread$2(target) {
  24958. for (var i = 1; i < arguments.length; i++) {
  24959. var source = arguments[i] != null ? arguments[i] : {};
  24960. if (i % 2) {
  24961. ownKeys$2(Object(source), true).forEach(function (key) {
  24962. _defineProperty(target, key, source[key]);
  24963. });
  24964. } else if (_getOwnPropertyDescriptors.default) {
  24965. (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
  24966. } else {
  24967. ownKeys$2(Object(source)).forEach(function (key) {
  24968. (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
  24969. });
  24970. }
  24971. }
  24972. return target;
  24973. }
  24974. var debug$6 = d('LC:Realtime');
  24975. var routerCache = new Cache('push-router');
  24976. var initializedApp = {};
  24977. var Realtime = /*#__PURE__*/function (_EventEmitter) {
  24978. _inheritsLoose(Realtime, _EventEmitter);
  24979. /**
  24980. * @extends EventEmitter
  24981. * @param {Object} options
  24982. * @param {String} options.appId
  24983. * @param {String} options.appKey (since 4.0.0)
  24984. * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
  24985. * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
  24986. * 适用于 WebSocket 实现不支持二进制数据格式的情况
  24987. * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
  24988. * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
  24989. * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
  24990. */
  24991. function Realtime(_ref) {
  24992. var _context25;
  24993. var _this2;
  24994. var plugins = _ref.plugins,
  24995. options = _objectWithoutProperties(_ref, ["plugins"]);
  24996. debug$6('initializing Realtime %s %O', version, options);
  24997. _this2 = _EventEmitter.call(this) || this;
  24998. var appId = options.appId;
  24999. if (typeof appId !== 'string') {
  25000. throw new TypeError("appId [".concat(appId, "] is not a string"));
  25001. }
  25002. if (initializedApp[appId]) {
  25003. throw new Error("App [".concat(appId, "] is already initialized."));
  25004. }
  25005. initializedApp[appId] = true;
  25006. if (typeof options.appKey !== 'string') {
  25007. throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
  25008. }
  25009. if (isCNApp(appId)) {
  25010. if (!options.server) {
  25011. throw new TypeError("server option is required for apps from CN region");
  25012. }
  25013. }
  25014. _this2._options = _objectSpread$2({
  25015. appId: undefined,
  25016. appKey: undefined,
  25017. noBinary: false,
  25018. ssl: true,
  25019. RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
  25020. }, options);
  25021. _this2._cache = new Cache('endpoints');
  25022. var _this = internal(_assertThisInitialized(_this2));
  25023. _this.clients = new _set.default();
  25024. _this.pendingClients = new _set.default();
  25025. var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
  25026. debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
  25027. return plugin.name;
  25028. }));
  25029. _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
  25030. (0, _keys.default)(plugin).forEach(function (hook) {
  25031. if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
  25032. var _context26;
  25033. if (plugin.name) {
  25034. ensureArray(plugin[hook]).forEach(function (value) {
  25035. // eslint-disable-next-line no-param-reassign
  25036. value._pluginName = plugin.name;
  25037. });
  25038. } // eslint-disable-next-line no-param-reassign
  25039. result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
  25040. }
  25041. });
  25042. return result;
  25043. }, {}); // onRealtimeCreate hook
  25044. applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
  25045. return _this2;
  25046. }
  25047. var _proto = Realtime.prototype;
  25048. _proto._request = /*#__PURE__*/function () {
  25049. var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
  25050. var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
  25051. return _regeneratorRuntime.wrap(function _callee$(_context) {
  25052. var _context27, _context28;
  25053. while (1) {
  25054. switch (_context.prev = _context.next) {
  25055. case 0:
  25056. method = _ref2.method, _url = _ref2.url, _ref2$version = _ref2.version, version = _ref2$version === void 0 ? '1.1' : _ref2$version, path = _ref2.path, query = _ref2.query, headers = _ref2.headers, data = _ref2.data;
  25057. url = _url;
  25058. if (url) {
  25059. _context.next = 9;
  25060. break;
  25061. }
  25062. _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
  25063. _context.next = 6;
  25064. return this.constructor._getServerUrls({
  25065. appId: appId,
  25066. server: server
  25067. });
  25068. case 6:
  25069. _yield$this$construct = _context.sent;
  25070. api = _yield$this$construct.api;
  25071. url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
  25072. case 9:
  25073. return _context.abrupt("return", request({
  25074. url: url,
  25075. method: method,
  25076. query: query,
  25077. headers: _objectSpread$2({
  25078. 'X-LC-Id': this._options.appId,
  25079. 'X-LC-Key': this._options.appKey
  25080. }, headers),
  25081. data: data
  25082. }));
  25083. case 10:
  25084. case "end":
  25085. return _context.stop();
  25086. }
  25087. }
  25088. }, _callee, this);
  25089. }));
  25090. function _request(_x) {
  25091. return _request2.apply(this, arguments);
  25092. }
  25093. return _request;
  25094. }();
  25095. _proto._open = function _open() {
  25096. var _this3 = this;
  25097. if (this._openPromise) return this._openPromise;
  25098. var format = 'protobuf2';
  25099. if (this._options.noBinary) {
  25100. // 不发送 binary data,fallback to base64 string
  25101. format = 'proto2base64';
  25102. }
  25103. var version = 3;
  25104. var protocol = {
  25105. format: format,
  25106. version: version
  25107. };
  25108. this._openPromise = new _promise.default(function (resolve, reject) {
  25109. debug$6('No connection established, create a new one.');
  25110. var connection = new Connection(function () {
  25111. return _this3._getRTMServers(_this3._options);
  25112. }, protocol);
  25113. connection.on(OPEN, function () {
  25114. return resolve(connection);
  25115. }).on(ERROR, function (error) {
  25116. delete _this3._openPromise;
  25117. reject(error);
  25118. }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
  25119. return _regeneratorRuntime.wrap(function _callee2$(_context2) {
  25120. while (1) {
  25121. switch (_context2.prev = _context2.next) {
  25122. case 0:
  25123. debug$6('Connection expired. Refresh endpoints.');
  25124. _this3._cache.set('endpoints', null, 0);
  25125. _context2.next = 4;
  25126. return _this3._getRTMServers(_this3._options);
  25127. case 4:
  25128. connection.urls = _context2.sent;
  25129. connection.disconnect();
  25130. case 6:
  25131. case "end":
  25132. return _context2.stop();
  25133. }
  25134. }
  25135. }, _callee2);
  25136. }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
  25137. /**
  25138. * 连接断开。
  25139. * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
  25140. * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
  25141. * @event Realtime#DISCONNECT
  25142. */
  25143. /**
  25144. * 计划在一段时间后尝试重新连接
  25145. * @event Realtime#SCHEDULE
  25146. * @param {Number} attempt 尝试重连的次数
  25147. * @param {Number} delay 延迟的毫秒数
  25148. */
  25149. /**
  25150. * 正在尝试重新连接
  25151. * @event Realtime#RETRY
  25152. * @param {Number} attempt 尝试重连的次数
  25153. */
  25154. /**
  25155. * 连接恢复正常。
  25156. * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
  25157. * @event Realtime#RECONNECT
  25158. */
  25159. /**
  25160. * 客户端连接断开
  25161. * @event IMClient#DISCONNECT
  25162. * @see Realtime#event:DISCONNECT
  25163. * @since 3.2.0
  25164. */
  25165. /**
  25166. * 计划在一段时间后尝试重新连接
  25167. * @event IMClient#SCHEDULE
  25168. * @param {Number} attempt 尝试重连的次数
  25169. * @param {Number} delay 延迟的毫秒数
  25170. * @since 3.2.0
  25171. */
  25172. /**
  25173. * 正在尝试重新连接
  25174. * @event IMClient#RETRY
  25175. * @param {Number} attempt 尝试重连的次数
  25176. * @since 3.2.0
  25177. */
  25178. /**
  25179. * 客户端进入离线状态。
  25180. * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
  25181. * @event Realtime#OFFLINE
  25182. * @since 3.4.0
  25183. */
  25184. /**
  25185. * 客户端恢复在线状态
  25186. * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
  25187. * @event Realtime#ONLINE
  25188. * @since 3.4.0
  25189. */
  25190. /**
  25191. * 进入离线状态。
  25192. * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
  25193. * @event IMClient#OFFLINE
  25194. * @since 3.4.0
  25195. */
  25196. /**
  25197. * 恢复在线状态
  25198. * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
  25199. * @event IMClient#ONLINE
  25200. * @since 3.4.0
  25201. */
  25202. // event proxy
  25203. [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
  25204. return connection.on(event, function () {
  25205. var _context29;
  25206. for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
  25207. payload[_key] = arguments[_key];
  25208. }
  25209. debug$6("".concat(event, " event emitted. %o"), payload);
  25210. _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
  25211. if (event !== RECONNECT) {
  25212. internal(_this3).clients.forEach(function (client) {
  25213. var _context30;
  25214. client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
  25215. });
  25216. }
  25217. });
  25218. }); // override handleClose
  25219. connection.handleClose = function handleClose(event) {
  25220. var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
  25221. return errorCode === event.code;
  25222. });
  25223. if (isFatal) {
  25224. // in these cases, SDK should throw.
  25225. this["throw"](createError(event));
  25226. } else {
  25227. // reconnect
  25228. this.disconnect();
  25229. }
  25230. };
  25231. internal(_this3).connection = connection;
  25232. });
  25233. return this._openPromise;
  25234. };
  25235. _proto._getRTMServers = /*#__PURE__*/function () {
  25236. var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
  25237. var info, cachedEndPoints, _info, server, secondary, ttl;
  25238. return _regeneratorRuntime.wrap(function _callee3$(_context3) {
  25239. while (1) {
  25240. switch (_context3.prev = _context3.next) {
  25241. case 0:
  25242. if (!options.RTMServers) {
  25243. _context3.next = 2;
  25244. break;
  25245. }
  25246. return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
  25247. case 2:
  25248. cachedEndPoints = this._cache.get('endpoints');
  25249. if (!cachedEndPoints) {
  25250. _context3.next = 7;
  25251. break;
  25252. }
  25253. info = cachedEndPoints;
  25254. _context3.next = 14;
  25255. break;
  25256. case 7:
  25257. _context3.next = 9;
  25258. return this.constructor._fetchRTMServers(options);
  25259. case 9:
  25260. info = _context3.sent;
  25261. _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
  25262. if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
  25263. _context3.next = 13;
  25264. break;
  25265. }
  25266. throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
  25267. case 13:
  25268. this._cache.set('endpoints', info, info.ttl * 1000);
  25269. case 14:
  25270. debug$6('endpoint info: %O', info);
  25271. return _context3.abrupt("return", [info.server, info.secondary]);
  25272. case 16:
  25273. case "end":
  25274. return _context3.stop();
  25275. }
  25276. }
  25277. }, _callee3, this);
  25278. }));
  25279. function _getRTMServers(_x2) {
  25280. return _getRTMServers2.apply(this, arguments);
  25281. }
  25282. return _getRTMServers;
  25283. }();
  25284. Realtime._getServerUrls = /*#__PURE__*/function () {
  25285. var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
  25286. var appId, server, cachedRouter, defaultProtocol;
  25287. return _regeneratorRuntime.wrap(function _callee4$(_context4) {
  25288. while (1) {
  25289. switch (_context4.prev = _context4.next) {
  25290. case 0:
  25291. appId = _ref4.appId, server = _ref4.server;
  25292. debug$6('fetch server urls');
  25293. if (!server) {
  25294. _context4.next = 6;
  25295. break;
  25296. }
  25297. if (!(typeof server !== 'string')) {
  25298. _context4.next = 5;
  25299. break;
  25300. }
  25301. return _context4.abrupt("return", server);
  25302. case 5:
  25303. return _context4.abrupt("return", {
  25304. RTMRouter: server,
  25305. api: server
  25306. });
  25307. case 6:
  25308. cachedRouter = routerCache.get(appId);
  25309. if (!cachedRouter) {
  25310. _context4.next = 9;
  25311. break;
  25312. }
  25313. return _context4.abrupt("return", cachedRouter);
  25314. case 9:
  25315. defaultProtocol = 'https://';
  25316. return _context4.abrupt("return", request({
  25317. url: 'https://app-router.com/2/route',
  25318. query: {
  25319. appId: appId
  25320. },
  25321. timeout: 20000
  25322. }).then(tap(debug$6)).then(function (_ref5) {
  25323. var _context31, _context32;
  25324. var RTMRouterServer = _ref5.rtm_router_server,
  25325. APIServer = _ref5.api_server,
  25326. _ref5$ttl = _ref5.ttl,
  25327. ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
  25328. if (!RTMRouterServer) {
  25329. throw new Error('rtm router not exists');
  25330. }
  25331. var serverUrls = {
  25332. RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
  25333. api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
  25334. };
  25335. routerCache.set(appId, serverUrls, ttl * 1000);
  25336. return serverUrls;
  25337. })["catch"](function () {
  25338. var _context33, _context34, _context35, _context36;
  25339. var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
  25340. var domain = 'lncldglobal.com';
  25341. return {
  25342. RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
  25343. api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
  25344. };
  25345. }));
  25346. case 11:
  25347. case "end":
  25348. return _context4.stop();
  25349. }
  25350. }
  25351. }, _callee4);
  25352. }));
  25353. function _getServerUrls(_x3) {
  25354. return _getServerUrls2.apply(this, arguments);
  25355. }
  25356. return _getServerUrls;
  25357. }();
  25358. Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
  25359. var appId = _ref6.appId,
  25360. ssl = _ref6.ssl,
  25361. server = _ref6.server,
  25362. RTMServerName = _ref6.RTMServerName;
  25363. debug$6('fetch endpoint info');
  25364. return this._getServerUrls({
  25365. appId: appId,
  25366. server: server
  25367. }).then(tap(debug$6)).then(function (_ref7) {
  25368. var RTMRouter = _ref7.RTMRouter;
  25369. return request({
  25370. url: "".concat(RTMRouter, "/v1/route"),
  25371. query: {
  25372. appId: appId,
  25373. secure: ssl,
  25374. features: isWeapp ? 'wechat' : undefined,
  25375. server: RTMServerName,
  25376. _t: Date.now()
  25377. },
  25378. timeout: 20000
  25379. }).then(tap(debug$6));
  25380. });
  25381. };
  25382. _proto._close = function _close() {
  25383. if (this._openPromise) {
  25384. this._openPromise.then(function (connection) {
  25385. return connection.close();
  25386. });
  25387. }
  25388. delete this._openPromise;
  25389. }
  25390. /**
  25391. * 手动进行重连。
  25392. * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
  25393. * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
  25394. */
  25395. ;
  25396. _proto.retry = function retry() {
  25397. var _internal = internal(this),
  25398. connection = _internal.connection;
  25399. if (!connection) {
  25400. throw new Error('no connection established');
  25401. }
  25402. if (connection.cannot('retry')) {
  25403. throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
  25404. }
  25405. return connection.retry();
  25406. }
  25407. /**
  25408. * 暂停,使 SDK 进入离线状态。
  25409. * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
  25410. * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
  25411. *
  25412. * @since 3.4.0
  25413. * @see Realtime#event:OFFLINE
  25414. */
  25415. ;
  25416. _proto.pause = function pause() {
  25417. // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
  25418. // 因此不像 retry,这个方法应该尽可能 loose
  25419. var _internal2 = internal(this),
  25420. connection = _internal2.connection;
  25421. if (!connection) return;
  25422. if (connection.can('pause')) connection.pause();
  25423. }
  25424. /**
  25425. * 恢复在线状态。
  25426. * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
  25427. *
  25428. * @since 3.4.0
  25429. * @see Realtime#event:ONLINE
  25430. */
  25431. ;
  25432. _proto.resume = function resume() {
  25433. // 与 pause 一样,这个方法应该尽可能 loose
  25434. var _internal3 = internal(this),
  25435. connection = _internal3.connection;
  25436. if (!connection) return;
  25437. if (connection.can('resume')) connection.resume();
  25438. };
  25439. _proto._registerPending = function _registerPending(value) {
  25440. internal(this).pendingClients.add(value);
  25441. };
  25442. _proto._deregisterPending = function _deregisterPending(client) {
  25443. internal(this).pendingClients["delete"](client);
  25444. };
  25445. _proto._register = function _register(client) {
  25446. internal(this).clients.add(client);
  25447. };
  25448. _proto._deregister = function _deregister(client) {
  25449. var _this = internal(this);
  25450. _this.clients["delete"](client);
  25451. if (_this.clients.size + _this.pendingClients.size === 0) {
  25452. this._close();
  25453. }
  25454. };
  25455. _proto._dispatchCommand = function _dispatchCommand(command) {
  25456. return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
  25457. // no plugin handled this command
  25458. if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
  25459. return false;
  25460. });
  25461. };
  25462. return Realtime;
  25463. }(EventEmitter); // For test purpose only
  25464. var polyfilledPromise = _promise.default;
  25465. exports.EventEmitter = EventEmitter;
  25466. exports.Promise = polyfilledPromise;
  25467. exports.Protocals = message;
  25468. exports.Protocols = message;
  25469. exports.Realtime = Realtime;
  25470. exports.debug = debug$2;
  25471. exports.getAdapter = getAdapter;
  25472. exports.setAdapters = setAdapters;
  25473. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  25474. /***/ }),
  25475. /* 590 */
  25476. /***/ (function(module, exports, __webpack_require__) {
  25477. module.exports = __webpack_require__(591);
  25478. /***/ }),
  25479. /* 591 */
  25480. /***/ (function(module, exports, __webpack_require__) {
  25481. var parent = __webpack_require__(592);
  25482. module.exports = parent;
  25483. /***/ }),
  25484. /* 592 */
  25485. /***/ (function(module, exports, __webpack_require__) {
  25486. __webpack_require__(593);
  25487. var path = __webpack_require__(5);
  25488. module.exports = path.Object.freeze;
  25489. /***/ }),
  25490. /* 593 */
  25491. /***/ (function(module, exports, __webpack_require__) {
  25492. var $ = __webpack_require__(0);
  25493. var FREEZING = __webpack_require__(262);
  25494. var fails = __webpack_require__(2);
  25495. var isObject = __webpack_require__(11);
  25496. var onFreeze = __webpack_require__(94).onFreeze;
  25497. // eslint-disable-next-line es-x/no-object-freeze -- safe
  25498. var $freeze = Object.freeze;
  25499. var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
  25500. // `Object.freeze` method
  25501. // https://tc39.es/ecma262/#sec-object.freeze
  25502. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
  25503. freeze: function freeze(it) {
  25504. return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
  25505. }
  25506. });
  25507. /***/ }),
  25508. /* 594 */
  25509. /***/ (function(module, exports, __webpack_require__) {
  25510. module.exports = __webpack_require__(595);
  25511. /***/ }),
  25512. /* 595 */
  25513. /***/ (function(module, exports, __webpack_require__) {
  25514. var parent = __webpack_require__(596);
  25515. module.exports = parent;
  25516. /***/ }),
  25517. /* 596 */
  25518. /***/ (function(module, exports, __webpack_require__) {
  25519. __webpack_require__(597);
  25520. var path = __webpack_require__(5);
  25521. module.exports = path.Object.getOwnPropertyDescriptors;
  25522. /***/ }),
  25523. /* 597 */
  25524. /***/ (function(module, exports, __webpack_require__) {
  25525. var $ = __webpack_require__(0);
  25526. var DESCRIPTORS = __webpack_require__(14);
  25527. var ownKeys = __webpack_require__(162);
  25528. var toIndexedObject = __webpack_require__(32);
  25529. var getOwnPropertyDescriptorModule = __webpack_require__(62);
  25530. var createProperty = __webpack_require__(91);
  25531. // `Object.getOwnPropertyDescriptors` method
  25532. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  25533. $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
  25534. getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
  25535. var O = toIndexedObject(object);
  25536. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  25537. var keys = ownKeys(O);
  25538. var result = {};
  25539. var index = 0;
  25540. var key, descriptor;
  25541. while (keys.length > index) {
  25542. descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
  25543. if (descriptor !== undefined) createProperty(result, key, descriptor);
  25544. }
  25545. return result;
  25546. }
  25547. });
  25548. /***/ }),
  25549. /* 598 */
  25550. /***/ (function(module, exports, __webpack_require__) {
  25551. module.exports = __webpack_require__(599);
  25552. /***/ }),
  25553. /* 599 */
  25554. /***/ (function(module, exports, __webpack_require__) {
  25555. var parent = __webpack_require__(600);
  25556. module.exports = parent;
  25557. /***/ }),
  25558. /* 600 */
  25559. /***/ (function(module, exports, __webpack_require__) {
  25560. __webpack_require__(601);
  25561. var path = __webpack_require__(5);
  25562. var Object = path.Object;
  25563. var defineProperties = module.exports = function defineProperties(T, D) {
  25564. return Object.defineProperties(T, D);
  25565. };
  25566. if (Object.defineProperties.sham) defineProperties.sham = true;
  25567. /***/ }),
  25568. /* 601 */
  25569. /***/ (function(module, exports, __webpack_require__) {
  25570. var $ = __webpack_require__(0);
  25571. var DESCRIPTORS = __webpack_require__(14);
  25572. var defineProperties = __webpack_require__(128).f;
  25573. // `Object.defineProperties` method
  25574. // https://tc39.es/ecma262/#sec-object.defineproperties
  25575. // eslint-disable-next-line es-x/no-object-defineproperties -- safe
  25576. $({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
  25577. defineProperties: defineProperties
  25578. });
  25579. /***/ }),
  25580. /* 602 */
  25581. /***/ (function(module, exports, __webpack_require__) {
  25582. module.exports = __webpack_require__(603);
  25583. /***/ }),
  25584. /* 603 */
  25585. /***/ (function(module, exports, __webpack_require__) {
  25586. var parent = __webpack_require__(604);
  25587. module.exports = parent;
  25588. /***/ }),
  25589. /* 604 */
  25590. /***/ (function(module, exports, __webpack_require__) {
  25591. var isPrototypeOf = __webpack_require__(19);
  25592. var method = __webpack_require__(605);
  25593. var ArrayPrototype = Array.prototype;
  25594. module.exports = function (it) {
  25595. var own = it.reduce;
  25596. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
  25597. };
  25598. /***/ }),
  25599. /* 605 */
  25600. /***/ (function(module, exports, __webpack_require__) {
  25601. __webpack_require__(606);
  25602. var entryVirtual = __webpack_require__(40);
  25603. module.exports = entryVirtual('Array').reduce;
  25604. /***/ }),
  25605. /* 606 */
  25606. /***/ (function(module, exports, __webpack_require__) {
  25607. "use strict";
  25608. var $ = __webpack_require__(0);
  25609. var $reduce = __webpack_require__(607).left;
  25610. var arrayMethodIsStrict = __webpack_require__(231);
  25611. var CHROME_VERSION = __webpack_require__(77);
  25612. var IS_NODE = __webpack_require__(107);
  25613. var STRICT_METHOD = arrayMethodIsStrict('reduce');
  25614. // Chrome 80-82 has a critical bug
  25615. // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
  25616. var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
  25617. // `Array.prototype.reduce` method
  25618. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  25619. $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
  25620. reduce: function reduce(callbackfn /* , initialValue */) {
  25621. var length = arguments.length;
  25622. return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
  25623. }
  25624. });
  25625. /***/ }),
  25626. /* 607 */
  25627. /***/ (function(module, exports, __webpack_require__) {
  25628. var aCallable = __webpack_require__(31);
  25629. var toObject = __webpack_require__(34);
  25630. var IndexedObject = __webpack_require__(95);
  25631. var lengthOfArrayLike = __webpack_require__(41);
  25632. var $TypeError = TypeError;
  25633. // `Array.prototype.{ reduce, reduceRight }` methods implementation
  25634. var createMethod = function (IS_RIGHT) {
  25635. return function (that, callbackfn, argumentsLength, memo) {
  25636. aCallable(callbackfn);
  25637. var O = toObject(that);
  25638. var self = IndexedObject(O);
  25639. var length = lengthOfArrayLike(O);
  25640. var index = IS_RIGHT ? length - 1 : 0;
  25641. var i = IS_RIGHT ? -1 : 1;
  25642. if (argumentsLength < 2) while (true) {
  25643. if (index in self) {
  25644. memo = self[index];
  25645. index += i;
  25646. break;
  25647. }
  25648. index += i;
  25649. if (IS_RIGHT ? index < 0 : length <= index) {
  25650. throw $TypeError('Reduce of empty array with no initial value');
  25651. }
  25652. }
  25653. for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
  25654. memo = callbackfn(memo, self[index], index, O);
  25655. }
  25656. return memo;
  25657. };
  25658. };
  25659. module.exports = {
  25660. // `Array.prototype.reduce` method
  25661. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  25662. left: createMethod(false),
  25663. // `Array.prototype.reduceRight` method
  25664. // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  25665. right: createMethod(true)
  25666. };
  25667. /***/ }),
  25668. /* 608 */
  25669. /***/ (function(module, exports, __webpack_require__) {
  25670. var parent = __webpack_require__(609);
  25671. __webpack_require__(39);
  25672. module.exports = parent;
  25673. /***/ }),
  25674. /* 609 */
  25675. /***/ (function(module, exports, __webpack_require__) {
  25676. __webpack_require__(38);
  25677. __webpack_require__(53);
  25678. __webpack_require__(610);
  25679. __webpack_require__(55);
  25680. var path = __webpack_require__(5);
  25681. module.exports = path.Set;
  25682. /***/ }),
  25683. /* 610 */
  25684. /***/ (function(module, exports, __webpack_require__) {
  25685. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  25686. __webpack_require__(611);
  25687. /***/ }),
  25688. /* 611 */
  25689. /***/ (function(module, exports, __webpack_require__) {
  25690. "use strict";
  25691. var collection = __webpack_require__(155);
  25692. var collectionStrong = __webpack_require__(263);
  25693. // `Set` constructor
  25694. // https://tc39.es/ecma262/#sec-set-objects
  25695. collection('Set', function (init) {
  25696. return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
  25697. }, collectionStrong);
  25698. /***/ }),
  25699. /* 612 */
  25700. /***/ (function(module, exports, __webpack_require__) {
  25701. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
  25702. Copyright 2013 Daniel Wirtz <dcode@dcode.io>
  25703. Licensed under the Apache License, Version 2.0 (the "License");
  25704. you may not use this file except in compliance with the License.
  25705. You may obtain a copy of the License at
  25706. http://www.apache.org/licenses/LICENSE-2.0
  25707. Unless required by applicable law or agreed to in writing, software
  25708. distributed under the License is distributed on an "AS IS" BASIS,
  25709. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25710. See the License for the specific language governing permissions and
  25711. limitations under the License.
  25712. */
  25713. /**
  25714. * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
  25715. * Released under the Apache License, Version 2.0
  25716. * see: https://github.com/dcodeIO/protobuf.js for details
  25717. */
  25718. (function(global, factory) {
  25719. /* AMD */ if (true)
  25720. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(613)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  25721. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  25722. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  25723. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25724. /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
  25725. module["exports"] = factory(require("bytebuffer"), true);
  25726. /* Global */ else
  25727. (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
  25728. })(this, function(ByteBuffer, isCommonJS) {
  25729. "use strict";
  25730. /**
  25731. * The ProtoBuf namespace.
  25732. * @exports ProtoBuf
  25733. * @namespace
  25734. * @expose
  25735. */
  25736. var ProtoBuf = {};
  25737. /**
  25738. * @type {!function(new: ByteBuffer, ...[*])}
  25739. * @expose
  25740. */
  25741. ProtoBuf.ByteBuffer = ByteBuffer;
  25742. /**
  25743. * @type {?function(new: Long, ...[*])}
  25744. * @expose
  25745. */
  25746. ProtoBuf.Long = ByteBuffer.Long || null;
  25747. /**
  25748. * ProtoBuf.js version.
  25749. * @type {string}
  25750. * @const
  25751. * @expose
  25752. */
  25753. ProtoBuf.VERSION = "5.0.3";
  25754. /**
  25755. * Wire types.
  25756. * @type {Object.<string,number>}
  25757. * @const
  25758. * @expose
  25759. */
  25760. ProtoBuf.WIRE_TYPES = {};
  25761. /**
  25762. * Varint wire type.
  25763. * @type {number}
  25764. * @expose
  25765. */
  25766. ProtoBuf.WIRE_TYPES.VARINT = 0;
  25767. /**
  25768. * Fixed 64 bits wire type.
  25769. * @type {number}
  25770. * @const
  25771. * @expose
  25772. */
  25773. ProtoBuf.WIRE_TYPES.BITS64 = 1;
  25774. /**
  25775. * Length delimited wire type.
  25776. * @type {number}
  25777. * @const
  25778. * @expose
  25779. */
  25780. ProtoBuf.WIRE_TYPES.LDELIM = 2;
  25781. /**
  25782. * Start group wire type.
  25783. * @type {number}
  25784. * @const
  25785. * @expose
  25786. */
  25787. ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
  25788. /**
  25789. * End group wire type.
  25790. * @type {number}
  25791. * @const
  25792. * @expose
  25793. */
  25794. ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
  25795. /**
  25796. * Fixed 32 bits wire type.
  25797. * @type {number}
  25798. * @const
  25799. * @expose
  25800. */
  25801. ProtoBuf.WIRE_TYPES.BITS32 = 5;
  25802. /**
  25803. * Packable wire types.
  25804. * @type {!Array.<number>}
  25805. * @const
  25806. * @expose
  25807. */
  25808. ProtoBuf.PACKABLE_WIRE_TYPES = [
  25809. ProtoBuf.WIRE_TYPES.VARINT,
  25810. ProtoBuf.WIRE_TYPES.BITS64,
  25811. ProtoBuf.WIRE_TYPES.BITS32
  25812. ];
  25813. /**
  25814. * Types.
  25815. * @dict
  25816. * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
  25817. * @const
  25818. * @expose
  25819. */
  25820. ProtoBuf.TYPES = {
  25821. // According to the protobuf spec.
  25822. "int32": {
  25823. name: "int32",
  25824. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25825. defaultValue: 0
  25826. },
  25827. "uint32": {
  25828. name: "uint32",
  25829. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25830. defaultValue: 0
  25831. },
  25832. "sint32": {
  25833. name: "sint32",
  25834. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25835. defaultValue: 0
  25836. },
  25837. "int64": {
  25838. name: "int64",
  25839. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25840. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
  25841. },
  25842. "uint64": {
  25843. name: "uint64",
  25844. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25845. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
  25846. },
  25847. "sint64": {
  25848. name: "sint64",
  25849. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25850. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
  25851. },
  25852. "bool": {
  25853. name: "bool",
  25854. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25855. defaultValue: false
  25856. },
  25857. "double": {
  25858. name: "double",
  25859. wireType: ProtoBuf.WIRE_TYPES.BITS64,
  25860. defaultValue: 0
  25861. },
  25862. "string": {
  25863. name: "string",
  25864. wireType: ProtoBuf.WIRE_TYPES.LDELIM,
  25865. defaultValue: ""
  25866. },
  25867. "bytes": {
  25868. name: "bytes",
  25869. wireType: ProtoBuf.WIRE_TYPES.LDELIM,
  25870. defaultValue: null // overridden in the code, must be a unique instance
  25871. },
  25872. "fixed32": {
  25873. name: "fixed32",
  25874. wireType: ProtoBuf.WIRE_TYPES.BITS32,
  25875. defaultValue: 0
  25876. },
  25877. "sfixed32": {
  25878. name: "sfixed32",
  25879. wireType: ProtoBuf.WIRE_TYPES.BITS32,
  25880. defaultValue: 0
  25881. },
  25882. "fixed64": {
  25883. name: "fixed64",
  25884. wireType: ProtoBuf.WIRE_TYPES.BITS64,
  25885. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
  25886. },
  25887. "sfixed64": {
  25888. name: "sfixed64",
  25889. wireType: ProtoBuf.WIRE_TYPES.BITS64,
  25890. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
  25891. },
  25892. "float": {
  25893. name: "float",
  25894. wireType: ProtoBuf.WIRE_TYPES.BITS32,
  25895. defaultValue: 0
  25896. },
  25897. "enum": {
  25898. name: "enum",
  25899. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  25900. defaultValue: 0
  25901. },
  25902. "message": {
  25903. name: "message",
  25904. wireType: ProtoBuf.WIRE_TYPES.LDELIM,
  25905. defaultValue: null
  25906. },
  25907. "group": {
  25908. name: "group",
  25909. wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
  25910. defaultValue: null
  25911. }
  25912. };
  25913. /**
  25914. * Valid map key types.
  25915. * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
  25916. * @const
  25917. * @expose
  25918. */
  25919. ProtoBuf.MAP_KEY_TYPES = [
  25920. ProtoBuf.TYPES["int32"],
  25921. ProtoBuf.TYPES["sint32"],
  25922. ProtoBuf.TYPES["sfixed32"],
  25923. ProtoBuf.TYPES["uint32"],
  25924. ProtoBuf.TYPES["fixed32"],
  25925. ProtoBuf.TYPES["int64"],
  25926. ProtoBuf.TYPES["sint64"],
  25927. ProtoBuf.TYPES["sfixed64"],
  25928. ProtoBuf.TYPES["uint64"],
  25929. ProtoBuf.TYPES["fixed64"],
  25930. ProtoBuf.TYPES["bool"],
  25931. ProtoBuf.TYPES["string"],
  25932. ProtoBuf.TYPES["bytes"]
  25933. ];
  25934. /**
  25935. * Minimum field id.
  25936. * @type {number}
  25937. * @const
  25938. * @expose
  25939. */
  25940. ProtoBuf.ID_MIN = 1;
  25941. /**
  25942. * Maximum field id.
  25943. * @type {number}
  25944. * @const
  25945. * @expose
  25946. */
  25947. ProtoBuf.ID_MAX = 0x1FFFFFFF;
  25948. /**
  25949. * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
  25950. * Must be set prior to parsing.
  25951. * @type {boolean}
  25952. * @expose
  25953. */
  25954. ProtoBuf.convertFieldsToCamelCase = false;
  25955. /**
  25956. * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
  25957. * setting this to `false` prior to building messages.
  25958. * @type {boolean}
  25959. * @expose
  25960. */
  25961. ProtoBuf.populateAccessors = true;
  25962. /**
  25963. * By default, messages are populated with default values if a field is not present on the wire. To disable
  25964. * this behavior, set this setting to `false`.
  25965. * @type {boolean}
  25966. * @expose
  25967. */
  25968. ProtoBuf.populateDefaults = true;
  25969. /**
  25970. * @alias ProtoBuf.Util
  25971. * @expose
  25972. */
  25973. ProtoBuf.Util = (function() {
  25974. "use strict";
  25975. /**
  25976. * ProtoBuf utilities.
  25977. * @exports ProtoBuf.Util
  25978. * @namespace
  25979. */
  25980. var Util = {};
  25981. /**
  25982. * Flag if running in node or not.
  25983. * @type {boolean}
  25984. * @const
  25985. * @expose
  25986. */
  25987. Util.IS_NODE = !!(
  25988. typeof process === 'object' && process+'' === '[object process]' && !process['browser']
  25989. );
  25990. /**
  25991. * Constructs a XMLHttpRequest object.
  25992. * @return {XMLHttpRequest}
  25993. * @throws {Error} If XMLHttpRequest is not supported
  25994. * @expose
  25995. */
  25996. Util.XHR = function() {
  25997. // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
  25998. var XMLHttpFactories = [
  25999. function () {return new XMLHttpRequest()},
  26000. function () {return new ActiveXObject("Msxml2.XMLHTTP")},
  26001. function () {return new ActiveXObject("Msxml3.XMLHTTP")},
  26002. function () {return new ActiveXObject("Microsoft.XMLHTTP")}
  26003. ];
  26004. /** @type {?XMLHttpRequest} */
  26005. var xhr = null;
  26006. for (var i=0;i<XMLHttpFactories.length;i++) {
  26007. try { xhr = XMLHttpFactories[i](); }
  26008. catch (e) { continue; }
  26009. break;
  26010. }
  26011. if (!xhr)
  26012. throw Error("XMLHttpRequest is not supported");
  26013. return xhr;
  26014. };
  26015. /**
  26016. * Fetches a resource.
  26017. * @param {string} path Resource path
  26018. * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
  26019. * be fetched synchronously. If the request failed, contents will be null.
  26020. * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
  26021. * @expose
  26022. */
  26023. Util.fetch = function(path, callback) {
  26024. if (callback && typeof callback != 'function')
  26025. callback = null;
  26026. if (Util.IS_NODE) {
  26027. var fs = __webpack_require__(615);
  26028. if (callback) {
  26029. fs.readFile(path, function(err, data) {
  26030. if (err)
  26031. callback(null);
  26032. else
  26033. callback(""+data);
  26034. });
  26035. } else
  26036. try {
  26037. return fs.readFileSync(path);
  26038. } catch (e) {
  26039. return null;
  26040. }
  26041. } else {
  26042. var xhr = Util.XHR();
  26043. xhr.open('GET', path, callback ? true : false);
  26044. // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
  26045. xhr.setRequestHeader('Accept', 'text/plain');
  26046. if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
  26047. if (callback) {
  26048. xhr.onreadystatechange = function() {
  26049. if (xhr.readyState != 4) return;
  26050. if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
  26051. callback(xhr.responseText);
  26052. else
  26053. callback(null);
  26054. };
  26055. if (xhr.readyState == 4)
  26056. return;
  26057. xhr.send(null);
  26058. } else {
  26059. xhr.send(null);
  26060. if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
  26061. return xhr.responseText;
  26062. return null;
  26063. }
  26064. }
  26065. };
  26066. /**
  26067. * Converts a string to camel case.
  26068. * @param {string} str
  26069. * @returns {string}
  26070. * @expose
  26071. */
  26072. Util.toCamelCase = function(str) {
  26073. return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
  26074. return $1.toUpperCase();
  26075. });
  26076. };
  26077. return Util;
  26078. })();
  26079. /**
  26080. * Language expressions.
  26081. * @type {!Object.<string,!RegExp>}
  26082. * @expose
  26083. */
  26084. ProtoBuf.Lang = {
  26085. // Characters always ending a statement
  26086. DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
  26087. // Field rules
  26088. RULE: /^(?:required|optional|repeated|map)$/,
  26089. // Field types
  26090. TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
  26091. // Names
  26092. NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
  26093. // Type definitions
  26094. TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
  26095. // Type references
  26096. TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
  26097. // Fully qualified type references
  26098. FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
  26099. // All numbers
  26100. NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
  26101. // Decimal numbers
  26102. NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
  26103. // Hexadecimal numbers
  26104. NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
  26105. // Octal numbers
  26106. NUMBER_OCT: /^0[0-7]+$/,
  26107. // Floating point numbers
  26108. NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
  26109. // Booleans
  26110. BOOL: /^(?:true|false)$/i,
  26111. // Id numbers
  26112. ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
  26113. // Negative id numbers (enum values)
  26114. NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
  26115. // Whitespaces
  26116. WHITESPACE: /\s/,
  26117. // All strings
  26118. STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
  26119. // Double quoted strings
  26120. STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
  26121. // Single quoted strings
  26122. STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
  26123. };
  26124. /**
  26125. * @alias ProtoBuf.Reflect
  26126. * @expose
  26127. */
  26128. ProtoBuf.Reflect = (function(ProtoBuf) {
  26129. "use strict";
  26130. /**
  26131. * Reflection types.
  26132. * @exports ProtoBuf.Reflect
  26133. * @namespace
  26134. */
  26135. var Reflect = {};
  26136. /**
  26137. * Constructs a Reflect base class.
  26138. * @exports ProtoBuf.Reflect.T
  26139. * @constructor
  26140. * @abstract
  26141. * @param {!ProtoBuf.Builder} builder Builder reference
  26142. * @param {?ProtoBuf.Reflect.T} parent Parent object
  26143. * @param {string} name Object name
  26144. */
  26145. var T = function(builder, parent, name) {
  26146. /**
  26147. * Builder reference.
  26148. * @type {!ProtoBuf.Builder}
  26149. * @expose
  26150. */
  26151. this.builder = builder;
  26152. /**
  26153. * Parent object.
  26154. * @type {?ProtoBuf.Reflect.T}
  26155. * @expose
  26156. */
  26157. this.parent = parent;
  26158. /**
  26159. * Object name in namespace.
  26160. * @type {string}
  26161. * @expose
  26162. */
  26163. this.name = name;
  26164. /**
  26165. * Fully qualified class name
  26166. * @type {string}
  26167. * @expose
  26168. */
  26169. this.className;
  26170. };
  26171. /**
  26172. * @alias ProtoBuf.Reflect.T.prototype
  26173. * @inner
  26174. */
  26175. var TPrototype = T.prototype;
  26176. /**
  26177. * Returns the fully qualified name of this object.
  26178. * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
  26179. * @expose
  26180. */
  26181. TPrototype.fqn = function() {
  26182. var name = this.name,
  26183. ptr = this;
  26184. do {
  26185. ptr = ptr.parent;
  26186. if (ptr == null)
  26187. break;
  26188. name = ptr.name+"."+name;
  26189. } while (true);
  26190. return name;
  26191. };
  26192. /**
  26193. * Returns a string representation of this Reflect object (its fully qualified name).
  26194. * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
  26195. * @return String representation
  26196. * @expose
  26197. */
  26198. TPrototype.toString = function(includeClass) {
  26199. return (includeClass ? this.className + " " : "") + this.fqn();
  26200. };
  26201. /**
  26202. * Builds this type.
  26203. * @throws {Error} If this type cannot be built directly
  26204. * @expose
  26205. */
  26206. TPrototype.build = function() {
  26207. throw Error(this.toString(true)+" cannot be built directly");
  26208. };
  26209. /**
  26210. * @alias ProtoBuf.Reflect.T
  26211. * @expose
  26212. */
  26213. Reflect.T = T;
  26214. /**
  26215. * Constructs a new Namespace.
  26216. * @exports ProtoBuf.Reflect.Namespace
  26217. * @param {!ProtoBuf.Builder} builder Builder reference
  26218. * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
  26219. * @param {string} name Namespace name
  26220. * @param {Object.<string,*>=} options Namespace options
  26221. * @param {string?} syntax The syntax level of this definition (e.g., proto3)
  26222. * @constructor
  26223. * @extends ProtoBuf.Reflect.T
  26224. */
  26225. var Namespace = function(builder, parent, name, options, syntax) {
  26226. T.call(this, builder, parent, name);
  26227. /**
  26228. * @override
  26229. */
  26230. this.className = "Namespace";
  26231. /**
  26232. * Children inside the namespace.
  26233. * @type {!Array.<ProtoBuf.Reflect.T>}
  26234. */
  26235. this.children = [];
  26236. /**
  26237. * Options.
  26238. * @type {!Object.<string, *>}
  26239. */
  26240. this.options = options || {};
  26241. /**
  26242. * Syntax level (e.g., proto2 or proto3).
  26243. * @type {!string}
  26244. */
  26245. this.syntax = syntax || "proto2";
  26246. };
  26247. /**
  26248. * @alias ProtoBuf.Reflect.Namespace.prototype
  26249. * @inner
  26250. */
  26251. var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
  26252. /**
  26253. * Returns an array of the namespace's children.
  26254. * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
  26255. * @return {Array.<ProtoBuf.Reflect.T>}
  26256. * @expose
  26257. */
  26258. NamespacePrototype.getChildren = function(type) {
  26259. type = type || null;
  26260. if (type == null)
  26261. return this.children.slice();
  26262. var children = [];
  26263. for (var i=0, k=this.children.length; i<k; ++i)
  26264. if (this.children[i] instanceof type)
  26265. children.push(this.children[i]);
  26266. return children;
  26267. };
  26268. /**
  26269. * Adds a child to the namespace.
  26270. * @param {ProtoBuf.Reflect.T} child Child
  26271. * @throws {Error} If the child cannot be added (duplicate)
  26272. * @expose
  26273. */
  26274. NamespacePrototype.addChild = function(child) {
  26275. var other;
  26276. if (other = this.getChild(child.name)) {
  26277. // Try to revert camelcase transformation on collision
  26278. if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
  26279. other.name = other.originalName; // Revert previous first (effectively keeps both originals)
  26280. else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
  26281. child.name = child.originalName;
  26282. else
  26283. throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
  26284. }
  26285. this.children.push(child);
  26286. };
  26287. /**
  26288. * Gets a child by its name or id.
  26289. * @param {string|number} nameOrId Child name or id
  26290. * @return {?ProtoBuf.Reflect.T} The child or null if not found
  26291. * @expose
  26292. */
  26293. NamespacePrototype.getChild = function(nameOrId) {
  26294. var key = typeof nameOrId === 'number' ? 'id' : 'name';
  26295. for (var i=0, k=this.children.length; i<k; ++i)
  26296. if (this.children[i][key] === nameOrId)
  26297. return this.children[i];
  26298. return null;
  26299. };
  26300. /**
  26301. * Resolves a reflect object inside of this namespace.
  26302. * @param {string|!Array.<string>} qn Qualified name to resolve
  26303. * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
  26304. * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
  26305. * @expose
  26306. */
  26307. NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
  26308. var part = typeof qn === 'string' ? qn.split(".") : qn,
  26309. ptr = this,
  26310. i = 0;
  26311. if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
  26312. while (ptr.parent !== null)
  26313. ptr = ptr.parent;
  26314. i++;
  26315. }
  26316. var child;
  26317. do {
  26318. do {
  26319. if (!(ptr instanceof Reflect.Namespace)) {
  26320. ptr = null;
  26321. break;
  26322. }
  26323. child = ptr.getChild(part[i]);
  26324. if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
  26325. ptr = null;
  26326. break;
  26327. }
  26328. ptr = child; i++;
  26329. } while (i < part.length);
  26330. if (ptr != null)
  26331. break; // Found
  26332. // Else search the parent
  26333. if (this.parent !== null)
  26334. return this.parent.resolve(qn, excludeNonNamespace);
  26335. } while (ptr != null);
  26336. return ptr;
  26337. };
  26338. /**
  26339. * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
  26340. * @param {!ProtoBuf.Reflect.T} t Reflection type
  26341. * @returns {string} The shortest qualified name or, if there is none, the fqn
  26342. * @expose
  26343. */
  26344. NamespacePrototype.qn = function(t) {
  26345. var part = [], ptr = t;
  26346. do {
  26347. part.unshift(ptr.name);
  26348. ptr = ptr.parent;
  26349. } while (ptr !== null);
  26350. for (var len=1; len <= part.length; len++) {
  26351. var qn = part.slice(part.length-len);
  26352. if (t === this.resolve(qn, t instanceof Reflect.Namespace))
  26353. return qn.join(".");
  26354. }
  26355. return t.fqn();
  26356. };
  26357. /**
  26358. * Builds the namespace and returns the runtime counterpart.
  26359. * @return {Object.<string,Function|Object>} Runtime namespace
  26360. * @expose
  26361. */
  26362. NamespacePrototype.build = function() {
  26363. /** @dict */
  26364. var ns = {};
  26365. var children = this.children;
  26366. for (var i=0, k=children.length, child; i<k; ++i) {
  26367. child = children[i];
  26368. if (child instanceof Namespace)
  26369. ns[child.name] = child.build();
  26370. }
  26371. if (Object.defineProperty)
  26372. Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
  26373. return ns;
  26374. };
  26375. /**
  26376. * Builds the namespace's '$options' property.
  26377. * @return {Object.<string,*>}
  26378. */
  26379. NamespacePrototype.buildOpt = function() {
  26380. var opt = {},
  26381. keys = Object.keys(this.options);
  26382. for (var i=0, k=keys.length; i<k; ++i) {
  26383. var key = keys[i],
  26384. val = this.options[keys[i]];
  26385. // TODO: Options are not resolved, yet.
  26386. // if (val instanceof Namespace) {
  26387. // opt[key] = val.build();
  26388. // } else {
  26389. opt[key] = val;
  26390. // }
  26391. }
  26392. return opt;
  26393. };
  26394. /**
  26395. * Gets the value assigned to the option with the specified name.
  26396. * @param {string=} name Returns the option value if specified, otherwise all options are returned.
  26397. * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
  26398. */
  26399. NamespacePrototype.getOption = function(name) {
  26400. if (typeof name === 'undefined')
  26401. return this.options;
  26402. return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
  26403. };
  26404. /**
  26405. * @alias ProtoBuf.Reflect.Namespace
  26406. * @expose
  26407. */
  26408. Reflect.Namespace = Namespace;
  26409. /**
  26410. * Constructs a new Element implementation that checks and converts values for a
  26411. * particular field type, as appropriate.
  26412. *
  26413. * An Element represents a single value: either the value of a singular field,
  26414. * or a value contained in one entry of a repeated field or map field. This
  26415. * class does not implement these higher-level concepts; it only encapsulates
  26416. * the low-level typechecking and conversion.
  26417. *
  26418. * @exports ProtoBuf.Reflect.Element
  26419. * @param {{name: string, wireType: number}} type Resolved data type
  26420. * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
  26421. * (e.g. submessage field).
  26422. * @param {boolean} isMapKey Is this element a Map key? The value will be
  26423. * converted to string form if so.
  26424. * @param {string} syntax Syntax level of defining message type, e.g.,
  26425. * proto2 or proto3.
  26426. * @param {string} name Name of the field containing this element (for error
  26427. * messages)
  26428. * @constructor
  26429. */
  26430. var Element = function(type, resolvedType, isMapKey, syntax, name) {
  26431. /**
  26432. * Element type, as a string (e.g., int32).
  26433. * @type {{name: string, wireType: number}}
  26434. */
  26435. this.type = type;
  26436. /**
  26437. * Element type reference to submessage or enum definition, if needed.
  26438. * @type {ProtoBuf.Reflect.T|null}
  26439. */
  26440. this.resolvedType = resolvedType;
  26441. /**
  26442. * Element is a map key.
  26443. * @type {boolean}
  26444. */
  26445. this.isMapKey = isMapKey;
  26446. /**
  26447. * Syntax level of defining message type, e.g., proto2 or proto3.
  26448. * @type {string}
  26449. */
  26450. this.syntax = syntax;
  26451. /**
  26452. * Name of the field containing this element (for error messages)
  26453. * @type {string}
  26454. */
  26455. this.name = name;
  26456. if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
  26457. throw Error("Invalid map key type: " + type.name);
  26458. };
  26459. var ElementPrototype = Element.prototype;
  26460. /**
  26461. * Obtains a (new) default value for the specified type.
  26462. * @param type {string|{name: string, wireType: number}} Field type
  26463. * @returns {*} Default value
  26464. * @inner
  26465. */
  26466. function mkDefault(type) {
  26467. if (typeof type === 'string')
  26468. type = ProtoBuf.TYPES[type];
  26469. if (typeof type.defaultValue === 'undefined')
  26470. throw Error("default value for type "+type.name+" is not supported");
  26471. if (type == ProtoBuf.TYPES["bytes"])
  26472. return new ByteBuffer(0);
  26473. return type.defaultValue;
  26474. }
  26475. /**
  26476. * Returns the default value for this field in proto3.
  26477. * @function
  26478. * @param type {string|{name: string, wireType: number}} the field type
  26479. * @returns {*} Default value
  26480. */
  26481. Element.defaultFieldValue = mkDefault;
  26482. /**
  26483. * Makes a Long from a value.
  26484. * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
  26485. * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
  26486. * strings and numbers
  26487. * @returns {!Long}
  26488. * @throws {Error} If the value cannot be converted to a Long
  26489. * @inner
  26490. */
  26491. function mkLong(value, unsigned) {
  26492. if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
  26493. && value.low === value.low && value.high === value.high)
  26494. return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
  26495. if (typeof value === 'string')
  26496. return ProtoBuf.Long.fromString(value, unsigned || false, 10);
  26497. if (typeof value === 'number')
  26498. return ProtoBuf.Long.fromNumber(value, unsigned || false);
  26499. throw Error("not convertible to Long");
  26500. }
  26501. ElementPrototype.toString = function() {
  26502. return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
  26503. }
  26504. /**
  26505. * Checks if the given value can be set for an element of this type (singular
  26506. * field or one element of a repeated field or map).
  26507. * @param {*} value Value to check
  26508. * @return {*} Verified, maybe adjusted, value
  26509. * @throws {Error} If the value cannot be verified for this element slot
  26510. * @expose
  26511. */
  26512. ElementPrototype.verifyValue = function(value) {
  26513. var self = this;
  26514. function fail(val, msg) {
  26515. throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
  26516. }
  26517. switch (this.type) {
  26518. // Signed 32bit
  26519. case ProtoBuf.TYPES["int32"]:
  26520. case ProtoBuf.TYPES["sint32"]:
  26521. case ProtoBuf.TYPES["sfixed32"]:
  26522. // Account for !NaN: value === value
  26523. if (typeof value !== 'number' || (value === value && value % 1 !== 0))
  26524. fail(typeof value, "not an integer");
  26525. return value > 4294967295 ? value | 0 : value;
  26526. // Unsigned 32bit
  26527. case ProtoBuf.TYPES["uint32"]:
  26528. case ProtoBuf.TYPES["fixed32"]:
  26529. if (typeof value !== 'number' || (value === value && value % 1 !== 0))
  26530. fail(typeof value, "not an integer");
  26531. return value < 0 ? value >>> 0 : value;
  26532. // Signed 64bit
  26533. case ProtoBuf.TYPES["int64"]:
  26534. case ProtoBuf.TYPES["sint64"]:
  26535. case ProtoBuf.TYPES["sfixed64"]: {
  26536. if (ProtoBuf.Long)
  26537. try {
  26538. return mkLong(value, false);
  26539. } catch (e) {
  26540. fail(typeof value, e.message);
  26541. }
  26542. else
  26543. fail(typeof value, "requires Long.js");
  26544. }
  26545. // Unsigned 64bit
  26546. case ProtoBuf.TYPES["uint64"]:
  26547. case ProtoBuf.TYPES["fixed64"]: {
  26548. if (ProtoBuf.Long)
  26549. try {
  26550. return mkLong(value, true);
  26551. } catch (e) {
  26552. fail(typeof value, e.message);
  26553. }
  26554. else
  26555. fail(typeof value, "requires Long.js");
  26556. }
  26557. // Bool
  26558. case ProtoBuf.TYPES["bool"]:
  26559. if (typeof value !== 'boolean')
  26560. fail(typeof value, "not a boolean");
  26561. return value;
  26562. // Float
  26563. case ProtoBuf.TYPES["float"]:
  26564. case ProtoBuf.TYPES["double"]:
  26565. if (typeof value !== 'number')
  26566. fail(typeof value, "not a number");
  26567. return value;
  26568. // Length-delimited string
  26569. case ProtoBuf.TYPES["string"]:
  26570. if (typeof value !== 'string' && !(value && value instanceof String))
  26571. fail(typeof value, "not a string");
  26572. return ""+value; // Convert String object to string
  26573. // Length-delimited bytes
  26574. case ProtoBuf.TYPES["bytes"]:
  26575. if (ByteBuffer.isByteBuffer(value))
  26576. return value;
  26577. return ByteBuffer.wrap(value, "base64");
  26578. // Constant enum value
  26579. case ProtoBuf.TYPES["enum"]: {
  26580. var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
  26581. for (i=0; i<values.length; i++)
  26582. if (values[i].name == value)
  26583. return values[i].id;
  26584. else if (values[i].id == value)
  26585. return values[i].id;
  26586. if (this.syntax === 'proto3') {
  26587. // proto3: just make sure it's an integer.
  26588. if (typeof value !== 'number' || (value === value && value % 1 !== 0))
  26589. fail(typeof value, "not an integer");
  26590. if (value > 4294967295 || value < 0)
  26591. fail(typeof value, "not in range for uint32")
  26592. return value;
  26593. } else {
  26594. // proto2 requires enum values to be valid.
  26595. fail(value, "not a valid enum value");
  26596. }
  26597. }
  26598. // Embedded message
  26599. case ProtoBuf.TYPES["group"]:
  26600. case ProtoBuf.TYPES["message"]: {
  26601. if (!value || typeof value !== 'object')
  26602. fail(typeof value, "object expected");
  26603. if (value instanceof this.resolvedType.clazz)
  26604. return value;
  26605. if (value instanceof ProtoBuf.Builder.Message) {
  26606. // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
  26607. var obj = {};
  26608. for (var i in value)
  26609. if (value.hasOwnProperty(i))
  26610. obj[i] = value[i];
  26611. value = obj;
  26612. }
  26613. // Else let's try to construct one from a key-value object
  26614. return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
  26615. }
  26616. }
  26617. // We should never end here
  26618. throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
  26619. };
  26620. /**
  26621. * Calculates the byte length of an element on the wire.
  26622. * @param {number} id Field number
  26623. * @param {*} value Field value
  26624. * @returns {number} Byte length
  26625. * @throws {Error} If the value cannot be calculated
  26626. * @expose
  26627. */
  26628. ElementPrototype.calculateLength = function(id, value) {
  26629. if (value === null) return 0; // Nothing to encode
  26630. // Tag has already been written
  26631. var n;
  26632. switch (this.type) {
  26633. case ProtoBuf.TYPES["int32"]:
  26634. return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
  26635. case ProtoBuf.TYPES["uint32"]:
  26636. return ByteBuffer.calculateVarint32(value);
  26637. case ProtoBuf.TYPES["sint32"]:
  26638. return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
  26639. case ProtoBuf.TYPES["fixed32"]:
  26640. case ProtoBuf.TYPES["sfixed32"]:
  26641. case ProtoBuf.TYPES["float"]:
  26642. return 4;
  26643. case ProtoBuf.TYPES["int64"]:
  26644. case ProtoBuf.TYPES["uint64"]:
  26645. return ByteBuffer.calculateVarint64(value);
  26646. case ProtoBuf.TYPES["sint64"]:
  26647. return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
  26648. case ProtoBuf.TYPES["fixed64"]:
  26649. case ProtoBuf.TYPES["sfixed64"]:
  26650. return 8;
  26651. case ProtoBuf.TYPES["bool"]:
  26652. return 1;
  26653. case ProtoBuf.TYPES["enum"]:
  26654. return ByteBuffer.calculateVarint32(value);
  26655. case ProtoBuf.TYPES["double"]:
  26656. return 8;
  26657. case ProtoBuf.TYPES["string"]:
  26658. n = ByteBuffer.calculateUTF8Bytes(value);
  26659. return ByteBuffer.calculateVarint32(n) + n;
  26660. case ProtoBuf.TYPES["bytes"]:
  26661. if (value.remaining() < 0)
  26662. throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
  26663. return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
  26664. case ProtoBuf.TYPES["message"]:
  26665. n = this.resolvedType.calculate(value);
  26666. return ByteBuffer.calculateVarint32(n) + n;
  26667. case ProtoBuf.TYPES["group"]:
  26668. n = this.resolvedType.calculate(value);
  26669. return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
  26670. }
  26671. // We should never end here
  26672. throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
  26673. };
  26674. /**
  26675. * Encodes a value to the specified buffer. Does not encode the key.
  26676. * @param {number} id Field number
  26677. * @param {*} value Field value
  26678. * @param {ByteBuffer} buffer ByteBuffer to encode to
  26679. * @return {ByteBuffer} The ByteBuffer for chaining
  26680. * @throws {Error} If the value cannot be encoded
  26681. * @expose
  26682. */
  26683. ElementPrototype.encodeValue = function(id, value, buffer) {
  26684. if (value === null) return buffer; // Nothing to encode
  26685. // Tag has already been written
  26686. switch (this.type) {
  26687. // 32bit signed varint
  26688. case ProtoBuf.TYPES["int32"]:
  26689. // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
  26690. // long – it is, effectively, treated like a very large unsigned integer." (see #122)
  26691. if (value < 0)
  26692. buffer.writeVarint64(value);
  26693. else
  26694. buffer.writeVarint32(value);
  26695. break;
  26696. // 32bit unsigned varint
  26697. case ProtoBuf.TYPES["uint32"]:
  26698. buffer.writeVarint32(value);
  26699. break;
  26700. // 32bit varint zig-zag
  26701. case ProtoBuf.TYPES["sint32"]:
  26702. buffer.writeVarint32ZigZag(value);
  26703. break;
  26704. // Fixed unsigned 32bit
  26705. case ProtoBuf.TYPES["fixed32"]:
  26706. buffer.writeUint32(value);
  26707. break;
  26708. // Fixed signed 32bit
  26709. case ProtoBuf.TYPES["sfixed32"]:
  26710. buffer.writeInt32(value);
  26711. break;
  26712. // 64bit varint as-is
  26713. case ProtoBuf.TYPES["int64"]:
  26714. case ProtoBuf.TYPES["uint64"]:
  26715. buffer.writeVarint64(value); // throws
  26716. break;
  26717. // 64bit varint zig-zag
  26718. case ProtoBuf.TYPES["sint64"]:
  26719. buffer.writeVarint64ZigZag(value); // throws
  26720. break;
  26721. // Fixed unsigned 64bit
  26722. case ProtoBuf.TYPES["fixed64"]:
  26723. buffer.writeUint64(value); // throws
  26724. break;
  26725. // Fixed signed 64bit
  26726. case ProtoBuf.TYPES["sfixed64"]:
  26727. buffer.writeInt64(value); // throws
  26728. break;
  26729. // Bool
  26730. case ProtoBuf.TYPES["bool"]:
  26731. if (typeof value === 'string')
  26732. buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
  26733. else
  26734. buffer.writeVarint32(value ? 1 : 0);
  26735. break;
  26736. // Constant enum value
  26737. case ProtoBuf.TYPES["enum"]:
  26738. buffer.writeVarint32(value);
  26739. break;
  26740. // 32bit float
  26741. case ProtoBuf.TYPES["float"]:
  26742. buffer.writeFloat32(value);
  26743. break;
  26744. // 64bit float
  26745. case ProtoBuf.TYPES["double"]:
  26746. buffer.writeFloat64(value);
  26747. break;
  26748. // Length-delimited string
  26749. case ProtoBuf.TYPES["string"]:
  26750. buffer.writeVString(value);
  26751. break;
  26752. // Length-delimited bytes
  26753. case ProtoBuf.TYPES["bytes"]:
  26754. if (value.remaining() < 0)
  26755. throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
  26756. var prevOffset = value.offset;
  26757. buffer.writeVarint32(value.remaining());
  26758. buffer.append(value);
  26759. value.offset = prevOffset;
  26760. break;
  26761. // Embedded message
  26762. case ProtoBuf.TYPES["message"]:
  26763. var bb = new ByteBuffer().LE();
  26764. this.resolvedType.encode(value, bb);
  26765. buffer.writeVarint32(bb.offset);
  26766. buffer.append(bb.flip());
  26767. break;
  26768. // Legacy group
  26769. case ProtoBuf.TYPES["group"]:
  26770. this.resolvedType.encode(value, buffer);
  26771. buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
  26772. break;
  26773. default:
  26774. // We should never end here
  26775. throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
  26776. }
  26777. return buffer;
  26778. };
  26779. /**
  26780. * Decode one element value from the specified buffer.
  26781. * @param {ByteBuffer} buffer ByteBuffer to decode from
  26782. * @param {number} wireType The field wire type
  26783. * @param {number} id The field number
  26784. * @return {*} Decoded value
  26785. * @throws {Error} If the field cannot be decoded
  26786. * @expose
  26787. */
  26788. ElementPrototype.decode = function(buffer, wireType, id) {
  26789. if (wireType != this.type.wireType)
  26790. throw Error("Unexpected wire type for element");
  26791. var value, nBytes;
  26792. switch (this.type) {
  26793. // 32bit signed varint
  26794. case ProtoBuf.TYPES["int32"]:
  26795. return buffer.readVarint32() | 0;
  26796. // 32bit unsigned varint
  26797. case ProtoBuf.TYPES["uint32"]:
  26798. return buffer.readVarint32() >>> 0;
  26799. // 32bit signed varint zig-zag
  26800. case ProtoBuf.TYPES["sint32"]:
  26801. return buffer.readVarint32ZigZag() | 0;
  26802. // Fixed 32bit unsigned
  26803. case ProtoBuf.TYPES["fixed32"]:
  26804. return buffer.readUint32() >>> 0;
  26805. case ProtoBuf.TYPES["sfixed32"]:
  26806. return buffer.readInt32() | 0;
  26807. // 64bit signed varint
  26808. case ProtoBuf.TYPES["int64"]:
  26809. return buffer.readVarint64();
  26810. // 64bit unsigned varint
  26811. case ProtoBuf.TYPES["uint64"]:
  26812. return buffer.readVarint64().toUnsigned();
  26813. // 64bit signed varint zig-zag
  26814. case ProtoBuf.TYPES["sint64"]:
  26815. return buffer.readVarint64ZigZag();
  26816. // Fixed 64bit unsigned
  26817. case ProtoBuf.TYPES["fixed64"]:
  26818. return buffer.readUint64();
  26819. // Fixed 64bit signed
  26820. case ProtoBuf.TYPES["sfixed64"]:
  26821. return buffer.readInt64();
  26822. // Bool varint
  26823. case ProtoBuf.TYPES["bool"]:
  26824. return !!buffer.readVarint32();
  26825. // Constant enum value (varint)
  26826. case ProtoBuf.TYPES["enum"]:
  26827. // The following Builder.Message#set will already throw
  26828. return buffer.readVarint32();
  26829. // 32bit float
  26830. case ProtoBuf.TYPES["float"]:
  26831. return buffer.readFloat();
  26832. // 64bit float
  26833. case ProtoBuf.TYPES["double"]:
  26834. return buffer.readDouble();
  26835. // Length-delimited string
  26836. case ProtoBuf.TYPES["string"]:
  26837. return buffer.readVString();
  26838. // Length-delimited bytes
  26839. case ProtoBuf.TYPES["bytes"]: {
  26840. nBytes = buffer.readVarint32();
  26841. if (buffer.remaining() < nBytes)
  26842. throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
  26843. value = buffer.clone(); // Offset already set
  26844. value.limit = value.offset+nBytes;
  26845. buffer.offset += nBytes;
  26846. return value;
  26847. }
  26848. // Length-delimited embedded message
  26849. case ProtoBuf.TYPES["message"]: {
  26850. nBytes = buffer.readVarint32();
  26851. return this.resolvedType.decode(buffer, nBytes);
  26852. }
  26853. // Legacy group
  26854. case ProtoBuf.TYPES["group"]:
  26855. return this.resolvedType.decode(buffer, -1, id);
  26856. }
  26857. // We should never end here
  26858. throw Error("[INTERNAL] Illegal decode type");
  26859. };
  26860. /**
  26861. * Converts a value from a string to the canonical element type.
  26862. *
  26863. * Legal only when isMapKey is true.
  26864. *
  26865. * @param {string} str The string value
  26866. * @returns {*} The value
  26867. */
  26868. ElementPrototype.valueFromString = function(str) {
  26869. if (!this.isMapKey) {
  26870. throw Error("valueFromString() called on non-map-key element");
  26871. }
  26872. switch (this.type) {
  26873. case ProtoBuf.TYPES["int32"]:
  26874. case ProtoBuf.TYPES["sint32"]:
  26875. case ProtoBuf.TYPES["sfixed32"]:
  26876. case ProtoBuf.TYPES["uint32"]:
  26877. case ProtoBuf.TYPES["fixed32"]:
  26878. return this.verifyValue(parseInt(str));
  26879. case ProtoBuf.TYPES["int64"]:
  26880. case ProtoBuf.TYPES["sint64"]:
  26881. case ProtoBuf.TYPES["sfixed64"]:
  26882. case ProtoBuf.TYPES["uint64"]:
  26883. case ProtoBuf.TYPES["fixed64"]:
  26884. // Long-based fields support conversions from string already.
  26885. return this.verifyValue(str);
  26886. case ProtoBuf.TYPES["bool"]:
  26887. return str === "true";
  26888. case ProtoBuf.TYPES["string"]:
  26889. return this.verifyValue(str);
  26890. case ProtoBuf.TYPES["bytes"]:
  26891. return ByteBuffer.fromBinary(str);
  26892. }
  26893. };
  26894. /**
  26895. * Converts a value from the canonical element type to a string.
  26896. *
  26897. * It should be the case that `valueFromString(valueToString(val))` returns
  26898. * a value equivalent to `verifyValue(val)` for every legal value of `val`
  26899. * according to this element type.
  26900. *
  26901. * This may be used when the element must be stored or used as a string,
  26902. * e.g., as a map key on an Object.
  26903. *
  26904. * Legal only when isMapKey is true.
  26905. *
  26906. * @param {*} val The value
  26907. * @returns {string} The string form of the value.
  26908. */
  26909. ElementPrototype.valueToString = function(value) {
  26910. if (!this.isMapKey) {
  26911. throw Error("valueToString() called on non-map-key element");
  26912. }
  26913. if (this.type === ProtoBuf.TYPES["bytes"]) {
  26914. return value.toString("binary");
  26915. } else {
  26916. return value.toString();
  26917. }
  26918. };
  26919. /**
  26920. * @alias ProtoBuf.Reflect.Element
  26921. * @expose
  26922. */
  26923. Reflect.Element = Element;
  26924. /**
  26925. * Constructs a new Message.
  26926. * @exports ProtoBuf.Reflect.Message
  26927. * @param {!ProtoBuf.Builder} builder Builder reference
  26928. * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
  26929. * @param {string} name Message name
  26930. * @param {Object.<string,*>=} options Message options
  26931. * @param {boolean=} isGroup `true` if this is a legacy group
  26932. * @param {string?} syntax The syntax level of this definition (e.g., proto3)
  26933. * @constructor
  26934. * @extends ProtoBuf.Reflect.Namespace
  26935. */
  26936. var Message = function(builder, parent, name, options, isGroup, syntax) {
  26937. Namespace.call(this, builder, parent, name, options, syntax);
  26938. /**
  26939. * @override
  26940. */
  26941. this.className = "Message";
  26942. /**
  26943. * Extensions range.
  26944. * @type {!Array.<number>|undefined}
  26945. * @expose
  26946. */
  26947. this.extensions = undefined;
  26948. /**
  26949. * Runtime message class.
  26950. * @type {?function(new:ProtoBuf.Builder.Message)}
  26951. * @expose
  26952. */
  26953. this.clazz = null;
  26954. /**
  26955. * Whether this is a legacy group or not.
  26956. * @type {boolean}
  26957. * @expose
  26958. */
  26959. this.isGroup = !!isGroup;
  26960. // The following cached collections are used to efficiently iterate over or look up fields when decoding.
  26961. /**
  26962. * Cached fields.
  26963. * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
  26964. * @private
  26965. */
  26966. this._fields = null;
  26967. /**
  26968. * Cached fields by id.
  26969. * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
  26970. * @private
  26971. */
  26972. this._fieldsById = null;
  26973. /**
  26974. * Cached fields by name.
  26975. * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
  26976. * @private
  26977. */
  26978. this._fieldsByName = null;
  26979. };
  26980. /**
  26981. * @alias ProtoBuf.Reflect.Message.prototype
  26982. * @inner
  26983. */
  26984. var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
  26985. /**
  26986. * Builds the message and returns the runtime counterpart, which is a fully functional class.
  26987. * @see ProtoBuf.Builder.Message
  26988. * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
  26989. * @return {ProtoBuf.Reflect.Message} Message class
  26990. * @throws {Error} If the message cannot be built
  26991. * @expose
  26992. */
  26993. MessagePrototype.build = function(rebuild) {
  26994. if (this.clazz && !rebuild)
  26995. return this.clazz;
  26996. // Create the runtime Message class in its own scope
  26997. var clazz = (function(ProtoBuf, T) {
  26998. var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
  26999. oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
  27000. /**
  27001. * Constructs a new runtime Message.
  27002. * @name ProtoBuf.Builder.Message
  27003. * @class Barebone of all runtime messages.
  27004. * @param {!Object.<string,*>|string} values Preset values
  27005. * @param {...string} var_args
  27006. * @constructor
  27007. * @throws {Error} If the message cannot be created
  27008. */
  27009. var Message = function(values, var_args) {
  27010. ProtoBuf.Builder.Message.call(this);
  27011. // Create virtual oneof properties
  27012. for (var i=0, k=oneofs.length; i<k; ++i)
  27013. this[oneofs[i].name] = null;
  27014. // Create fields and set default values
  27015. for (i=0, k=fields.length; i<k; ++i) {
  27016. var field = fields[i];
  27017. this[field.name] =
  27018. field.repeated ? [] :
  27019. (field.map ? new ProtoBuf.Map(field) : null);
  27020. if ((field.required || T.syntax === 'proto3') &&
  27021. field.defaultValue !== null)
  27022. this[field.name] = field.defaultValue;
  27023. }
  27024. if (arguments.length > 0) {
  27025. var value;
  27026. // Set field values from a values object
  27027. if (arguments.length === 1 && values !== null && typeof values === 'object' &&
  27028. /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
  27029. /* not a repeated field */ !Array.isArray(values) &&
  27030. /* not a Map */ !(values instanceof ProtoBuf.Map) &&
  27031. /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
  27032. /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
  27033. /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
  27034. this.$set(values);
  27035. } else // Set field values from arguments, in declaration order
  27036. for (i=0, k=arguments.length; i<k; ++i)
  27037. if (typeof (value = arguments[i]) !== 'undefined')
  27038. this.$set(fields[i].name, value); // May throw
  27039. }
  27040. };
  27041. /**
  27042. * @alias ProtoBuf.Builder.Message.prototype
  27043. * @inner
  27044. */
  27045. var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
  27046. /**
  27047. * Adds a value to a repeated field.
  27048. * @name ProtoBuf.Builder.Message#add
  27049. * @function
  27050. * @param {string} key Field name
  27051. * @param {*} value Value to add
  27052. * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
  27053. * @returns {!ProtoBuf.Builder.Message} this
  27054. * @throws {Error} If the value cannot be added
  27055. * @expose
  27056. */
  27057. MessagePrototype.add = function(key, value, noAssert) {
  27058. var field = T._fieldsByName[key];
  27059. if (!noAssert) {
  27060. if (!field)
  27061. throw Error(this+"#"+key+" is undefined");
  27062. if (!(field instanceof ProtoBuf.Reflect.Message.Field))
  27063. throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
  27064. if (!field.repeated)
  27065. throw Error(this+"#"+key+" is not a repeated field");
  27066. value = field.verifyValue(value, true);
  27067. }
  27068. if (this[key] === null)
  27069. this[key] = [];
  27070. this[key].push(value);
  27071. return this;
  27072. };
  27073. /**
  27074. * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
  27075. * @name ProtoBuf.Builder.Message#$add
  27076. * @function
  27077. * @param {string} key Field name
  27078. * @param {*} value Value to add
  27079. * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
  27080. * @returns {!ProtoBuf.Builder.Message} this
  27081. * @throws {Error} If the value cannot be added
  27082. * @expose
  27083. */
  27084. MessagePrototype.$add = MessagePrototype.add;
  27085. /**
  27086. * Sets a field's value.
  27087. * @name ProtoBuf.Builder.Message#set
  27088. * @function
  27089. * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
  27090. * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
  27091. * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
  27092. * @returns {!ProtoBuf.Builder.Message} this
  27093. * @throws {Error} If the value cannot be set
  27094. * @expose
  27095. */
  27096. MessagePrototype.set = function(keyOrObj, value, noAssert) {
  27097. if (keyOrObj && typeof keyOrObj === 'object') {
  27098. noAssert = value;
  27099. for (var ikey in keyOrObj) {
  27100. // Check if virtual oneof field - don't set these
  27101. if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
  27102. this.$set(ikey, value, noAssert);
  27103. }
  27104. return this;
  27105. }
  27106. var field = T._fieldsByName[keyOrObj];
  27107. if (!noAssert) {
  27108. if (!field)
  27109. throw Error(this+"#"+keyOrObj+" is not a field: undefined");
  27110. if (!(field instanceof ProtoBuf.Reflect.Message.Field))
  27111. throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
  27112. this[field.name] = (value = field.verifyValue(value)); // May throw
  27113. } else
  27114. this[keyOrObj] = value;
  27115. if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
  27116. var currentField = this[field.oneof.name]; // Virtual field references currently set field
  27117. if (value !== null) {
  27118. if (currentField !== null && currentField !== field.name)
  27119. this[currentField] = null; // Clear currently set field
  27120. this[field.oneof.name] = field.name; // Point virtual field at this field
  27121. } else if (/* value === null && */currentField === keyOrObj)
  27122. this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
  27123. }
  27124. return this;
  27125. };
  27126. /**
  27127. * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
  27128. * @name ProtoBuf.Builder.Message#$set
  27129. * @function
  27130. * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
  27131. * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
  27132. * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
  27133. * @throws {Error} If the value cannot be set
  27134. * @expose
  27135. */
  27136. MessagePrototype.$set = MessagePrototype.set;
  27137. /**
  27138. * Gets a field's value.
  27139. * @name ProtoBuf.Builder.Message#get
  27140. * @function
  27141. * @param {string} key Key
  27142. * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
  27143. * @return {*} Value
  27144. * @throws {Error} If there is no such field
  27145. * @expose
  27146. */
  27147. MessagePrototype.get = function(key, noAssert) {
  27148. if (noAssert)
  27149. return this[key];
  27150. var field = T._fieldsByName[key];
  27151. if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
  27152. throw Error(this+"#"+key+" is not a field: undefined");
  27153. if (!(field instanceof ProtoBuf.Reflect.Message.Field))
  27154. throw Error(this+"#"+key+" is not a field: "+field.toString(true));
  27155. return this[field.name];
  27156. };
  27157. /**
  27158. * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
  27159. * @name ProtoBuf.Builder.Message#$get
  27160. * @function
  27161. * @param {string} key Key
  27162. * @return {*} Value
  27163. * @throws {Error} If there is no such field
  27164. * @expose
  27165. */
  27166. MessagePrototype.$get = MessagePrototype.get;
  27167. // Getters and setters
  27168. for (var i=0; i<fields.length; i++) {
  27169. var field = fields[i];
  27170. // no setters for extension fields as these are named by their fqn
  27171. if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
  27172. continue;
  27173. if (T.builder.options['populateAccessors'])
  27174. (function(field) {
  27175. // set/get[SomeValue]
  27176. var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
  27177. return match.toUpperCase().replace('_','');
  27178. });
  27179. Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
  27180. // set/get_[some_value] FIXME: Do we really need these?
  27181. var name = field.originalName.replace(/([A-Z])/g, function(match) {
  27182. return "_"+match;
  27183. });
  27184. /**
  27185. * The current field's unbound setter function.
  27186. * @function
  27187. * @param {*} value
  27188. * @param {boolean=} noAssert
  27189. * @returns {!ProtoBuf.Builder.Message}
  27190. * @inner
  27191. */
  27192. var setter = function(value, noAssert) {
  27193. this[field.name] = noAssert ? value : field.verifyValue(value);
  27194. return this;
  27195. };
  27196. /**
  27197. * The current field's unbound getter function.
  27198. * @function
  27199. * @returns {*}
  27200. * @inner
  27201. */
  27202. var getter = function() {
  27203. return this[field.name];
  27204. };
  27205. if (T.getChild("set"+Name) === null)
  27206. /**
  27207. * Sets a value. This method is present for each field, but only if there is no name conflict with
  27208. * another field.
  27209. * @name ProtoBuf.Builder.Message#set[SomeField]
  27210. * @function
  27211. * @param {*} value Value to set
  27212. * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
  27213. * @returns {!ProtoBuf.Builder.Message} this
  27214. * @abstract
  27215. * @throws {Error} If the value cannot be set
  27216. */
  27217. MessagePrototype["set"+Name] = setter;
  27218. if (T.getChild("set_"+name) === null)
  27219. /**
  27220. * Sets a value. This method is present for each field, but only if there is no name conflict with
  27221. * another field.
  27222. * @name ProtoBuf.Builder.Message#set_[some_field]
  27223. * @function
  27224. * @param {*} value Value to set
  27225. * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
  27226. * @returns {!ProtoBuf.Builder.Message} this
  27227. * @abstract
  27228. * @throws {Error} If the value cannot be set
  27229. */
  27230. MessagePrototype["set_"+name] = setter;
  27231. if (T.getChild("get"+Name) === null)
  27232. /**
  27233. * Gets a value. This method is present for each field, but only if there is no name conflict with
  27234. * another field.
  27235. * @name ProtoBuf.Builder.Message#get[SomeField]
  27236. * @function
  27237. * @abstract
  27238. * @return {*} The value
  27239. */
  27240. MessagePrototype["get"+Name] = getter;
  27241. if (T.getChild("get_"+name) === null)
  27242. /**
  27243. * Gets a value. This method is present for each field, but only if there is no name conflict with
  27244. * another field.
  27245. * @name ProtoBuf.Builder.Message#get_[some_field]
  27246. * @function
  27247. * @return {*} The value
  27248. * @abstract
  27249. */
  27250. MessagePrototype["get_"+name] = getter;
  27251. })(field);
  27252. }
  27253. // En-/decoding
  27254. /**
  27255. * Encodes the message.
  27256. * @name ProtoBuf.Builder.Message#$encode
  27257. * @function
  27258. * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
  27259. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  27260. * @return {!ByteBuffer} Encoded message as a ByteBuffer
  27261. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27262. * returns the encoded ByteBuffer in the `encoded` property on the error.
  27263. * @expose
  27264. * @see ProtoBuf.Builder.Message#encode64
  27265. * @see ProtoBuf.Builder.Message#encodeHex
  27266. * @see ProtoBuf.Builder.Message#encodeAB
  27267. */
  27268. MessagePrototype.encode = function(buffer, noVerify) {
  27269. if (typeof buffer === 'boolean')
  27270. noVerify = buffer,
  27271. buffer = undefined;
  27272. var isNew = false;
  27273. if (!buffer)
  27274. buffer = new ByteBuffer(),
  27275. isNew = true;
  27276. var le = buffer.littleEndian;
  27277. try {
  27278. T.encode(this, buffer.LE(), noVerify);
  27279. return (isNew ? buffer.flip() : buffer).LE(le);
  27280. } catch (e) {
  27281. buffer.LE(le);
  27282. throw(e);
  27283. }
  27284. };
  27285. /**
  27286. * Encodes a message using the specified data payload.
  27287. * @param {!Object.<string,*>} data Data payload
  27288. * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
  27289. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  27290. * @return {!ByteBuffer} Encoded message as a ByteBuffer
  27291. * @expose
  27292. */
  27293. Message.encode = function(data, buffer, noVerify) {
  27294. return new Message(data).encode(buffer, noVerify);
  27295. };
  27296. /**
  27297. * Calculates the byte length of the message.
  27298. * @name ProtoBuf.Builder.Message#calculate
  27299. * @function
  27300. * @returns {number} Byte length
  27301. * @throws {Error} If the message cannot be calculated or if required fields are missing.
  27302. * @expose
  27303. */
  27304. MessagePrototype.calculate = function() {
  27305. return T.calculate(this);
  27306. };
  27307. /**
  27308. * Encodes the varint32 length-delimited message.
  27309. * @name ProtoBuf.Builder.Message#encodeDelimited
  27310. * @function
  27311. * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
  27312. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  27313. * @return {!ByteBuffer} Encoded message as a ByteBuffer
  27314. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27315. * returns the encoded ByteBuffer in the `encoded` property on the error.
  27316. * @expose
  27317. */
  27318. MessagePrototype.encodeDelimited = function(buffer, noVerify) {
  27319. var isNew = false;
  27320. if (!buffer)
  27321. buffer = new ByteBuffer(),
  27322. isNew = true;
  27323. var enc = new ByteBuffer().LE();
  27324. T.encode(this, enc, noVerify).flip();
  27325. buffer.writeVarint32(enc.remaining());
  27326. buffer.append(enc);
  27327. return isNew ? buffer.flip() : buffer;
  27328. };
  27329. /**
  27330. * Directly encodes the message to an ArrayBuffer.
  27331. * @name ProtoBuf.Builder.Message#encodeAB
  27332. * @function
  27333. * @return {ArrayBuffer} Encoded message as ArrayBuffer
  27334. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27335. * returns the encoded ArrayBuffer in the `encoded` property on the error.
  27336. * @expose
  27337. */
  27338. MessagePrototype.encodeAB = function() {
  27339. try {
  27340. return this.encode().toArrayBuffer();
  27341. } catch (e) {
  27342. if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
  27343. throw(e);
  27344. }
  27345. };
  27346. /**
  27347. * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
  27348. * @name ProtoBuf.Builder.Message#toArrayBuffer
  27349. * @function
  27350. * @return {ArrayBuffer} Encoded message as ArrayBuffer
  27351. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27352. * returns the encoded ArrayBuffer in the `encoded` property on the error.
  27353. * @expose
  27354. */
  27355. MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
  27356. /**
  27357. * Directly encodes the message to a node Buffer.
  27358. * @name ProtoBuf.Builder.Message#encodeNB
  27359. * @function
  27360. * @return {!Buffer}
  27361. * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
  27362. * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
  27363. * @expose
  27364. */
  27365. MessagePrototype.encodeNB = function() {
  27366. try {
  27367. return this.encode().toBuffer();
  27368. } catch (e) {
  27369. if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
  27370. throw(e);
  27371. }
  27372. };
  27373. /**
  27374. * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
  27375. * @name ProtoBuf.Builder.Message#toBuffer
  27376. * @function
  27377. * @return {!Buffer}
  27378. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27379. * returns the encoded node Buffer in the `encoded` property on the error.
  27380. * @expose
  27381. */
  27382. MessagePrototype.toBuffer = MessagePrototype.encodeNB;
  27383. /**
  27384. * Directly encodes the message to a base64 encoded string.
  27385. * @name ProtoBuf.Builder.Message#encode64
  27386. * @function
  27387. * @return {string} Base64 encoded string
  27388. * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
  27389. * still returns the encoded base64 string in the `encoded` property on the error.
  27390. * @expose
  27391. */
  27392. MessagePrototype.encode64 = function() {
  27393. try {
  27394. return this.encode().toBase64();
  27395. } catch (e) {
  27396. if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
  27397. throw(e);
  27398. }
  27399. };
  27400. /**
  27401. * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
  27402. * @name ProtoBuf.Builder.Message#toBase64
  27403. * @function
  27404. * @return {string} Base64 encoded string
  27405. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27406. * returns the encoded base64 string in the `encoded` property on the error.
  27407. * @expose
  27408. */
  27409. MessagePrototype.toBase64 = MessagePrototype.encode64;
  27410. /**
  27411. * Directly encodes the message to a hex encoded string.
  27412. * @name ProtoBuf.Builder.Message#encodeHex
  27413. * @function
  27414. * @return {string} Hex encoded string
  27415. * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
  27416. * still returns the encoded hex string in the `encoded` property on the error.
  27417. * @expose
  27418. */
  27419. MessagePrototype.encodeHex = function() {
  27420. try {
  27421. return this.encode().toHex();
  27422. } catch (e) {
  27423. if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
  27424. throw(e);
  27425. }
  27426. };
  27427. /**
  27428. * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
  27429. * @name ProtoBuf.Builder.Message#toHex
  27430. * @function
  27431. * @return {string} Hex encoded string
  27432. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  27433. * returns the encoded hex string in the `encoded` property on the error.
  27434. * @expose
  27435. */
  27436. MessagePrototype.toHex = MessagePrototype.encodeHex;
  27437. /**
  27438. * Clones a message object or field value to a raw object.
  27439. * @param {*} obj Object to clone
  27440. * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
  27441. * @param {boolean} longsAsStrings Whether to encode longs as strings
  27442. * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
  27443. * @returns {*} Cloned object
  27444. * @inner
  27445. */
  27446. function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
  27447. if (obj === null || typeof obj !== 'object') {
  27448. // Convert enum values to their respective names
  27449. if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
  27450. var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
  27451. if (name !== null)
  27452. return name;
  27453. }
  27454. // Pass-through string, number, boolean, null...
  27455. return obj;
  27456. }
  27457. // Convert ByteBuffers to raw buffer or strings
  27458. if (ByteBuffer.isByteBuffer(obj))
  27459. return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
  27460. // Convert Longs to proper objects or strings
  27461. if (ProtoBuf.Long.isLong(obj))
  27462. return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
  27463. var clone;
  27464. // Clone arrays
  27465. if (Array.isArray(obj)) {
  27466. clone = [];
  27467. obj.forEach(function(v, k) {
  27468. clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
  27469. });
  27470. return clone;
  27471. }
  27472. clone = {};
  27473. // Convert maps to objects
  27474. if (obj instanceof ProtoBuf.Map) {
  27475. var it = obj.entries();
  27476. for (var e = it.next(); !e.done; e = it.next())
  27477. clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
  27478. return clone;
  27479. }
  27480. // Everything else is a non-null object
  27481. var type = obj.$type,
  27482. field = undefined;
  27483. for (var i in obj)
  27484. if (obj.hasOwnProperty(i)) {
  27485. if (type && (field = type.getChild(i)))
  27486. clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
  27487. else
  27488. clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
  27489. }
  27490. return clone;
  27491. }
  27492. /**
  27493. * Returns the message's raw payload.
  27494. * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
  27495. * @param {boolean} longsAsStrings Whether to encode longs as strings
  27496. * @returns {Object.<string,*>} Raw payload
  27497. * @expose
  27498. */
  27499. MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
  27500. return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
  27501. };
  27502. /**
  27503. * Encodes a message to JSON.
  27504. * @returns {string} JSON string
  27505. * @expose
  27506. */
  27507. MessagePrototype.encodeJSON = function() {
  27508. return JSON.stringify(
  27509. cloneRaw(this,
  27510. /* binary-as-base64 */ true,
  27511. /* longs-as-strings */ true,
  27512. this.$type
  27513. )
  27514. );
  27515. };
  27516. /**
  27517. * Decodes a message from the specified buffer or string.
  27518. * @name ProtoBuf.Builder.Message.decode
  27519. * @function
  27520. * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
  27521. * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
  27522. * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
  27523. * @return {!ProtoBuf.Builder.Message} Decoded message
  27524. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  27525. * returns the decoded message with missing fields in the `decoded` property on the error.
  27526. * @expose
  27527. * @see ProtoBuf.Builder.Message.decode64
  27528. * @see ProtoBuf.Builder.Message.decodeHex
  27529. */
  27530. Message.decode = function(buffer, length, enc) {
  27531. if (typeof length === 'string')
  27532. enc = length,
  27533. length = -1;
  27534. if (typeof buffer === 'string')
  27535. buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
  27536. else if (!ByteBuffer.isByteBuffer(buffer))
  27537. buffer = ByteBuffer.wrap(buffer); // May throw
  27538. var le = buffer.littleEndian;
  27539. try {
  27540. var msg = T.decode(buffer.LE(), length);
  27541. buffer.LE(le);
  27542. return msg;
  27543. } catch (e) {
  27544. buffer.LE(le);
  27545. throw(e);
  27546. }
  27547. };
  27548. /**
  27549. * Decodes a varint32 length-delimited message from the specified buffer or string.
  27550. * @name ProtoBuf.Builder.Message.decodeDelimited
  27551. * @function
  27552. * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
  27553. * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
  27554. * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
  27555. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  27556. * returns the decoded message with missing fields in the `decoded` property on the error.
  27557. * @expose
  27558. */
  27559. Message.decodeDelimited = function(buffer, enc) {
  27560. if (typeof buffer === 'string')
  27561. buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
  27562. else if (!ByteBuffer.isByteBuffer(buffer))
  27563. buffer = ByteBuffer.wrap(buffer); // May throw
  27564. if (buffer.remaining() < 1)
  27565. return null;
  27566. var off = buffer.offset,
  27567. len = buffer.readVarint32();
  27568. if (buffer.remaining() < len) {
  27569. buffer.offset = off;
  27570. return null;
  27571. }
  27572. try {
  27573. var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
  27574. buffer.offset += len;
  27575. return msg;
  27576. } catch (err) {
  27577. buffer.offset += len;
  27578. throw err;
  27579. }
  27580. };
  27581. /**
  27582. * Decodes the message from the specified base64 encoded string.
  27583. * @name ProtoBuf.Builder.Message.decode64
  27584. * @function
  27585. * @param {string} str String to decode from
  27586. * @return {!ProtoBuf.Builder.Message} Decoded message
  27587. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  27588. * returns the decoded message with missing fields in the `decoded` property on the error.
  27589. * @expose
  27590. */
  27591. Message.decode64 = function(str) {
  27592. return Message.decode(str, "base64");
  27593. };
  27594. /**
  27595. * Decodes the message from the specified hex encoded string.
  27596. * @name ProtoBuf.Builder.Message.decodeHex
  27597. * @function
  27598. * @param {string} str String to decode from
  27599. * @return {!ProtoBuf.Builder.Message} Decoded message
  27600. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  27601. * returns the decoded message with missing fields in the `decoded` property on the error.
  27602. * @expose
  27603. */
  27604. Message.decodeHex = function(str) {
  27605. return Message.decode(str, "hex");
  27606. };
  27607. /**
  27608. * Decodes the message from a JSON string.
  27609. * @name ProtoBuf.Builder.Message.decodeJSON
  27610. * @function
  27611. * @param {string} str String to decode from
  27612. * @return {!ProtoBuf.Builder.Message} Decoded message
  27613. * @throws {Error} If the message cannot be decoded or if required fields are
  27614. * missing.
  27615. * @expose
  27616. */
  27617. Message.decodeJSON = function(str) {
  27618. return new Message(JSON.parse(str));
  27619. };
  27620. // Utility
  27621. /**
  27622. * Returns a string representation of this Message.
  27623. * @name ProtoBuf.Builder.Message#toString
  27624. * @function
  27625. * @return {string} String representation as of ".Fully.Qualified.MessageName"
  27626. * @expose
  27627. */
  27628. MessagePrototype.toString = function() {
  27629. return T.toString();
  27630. };
  27631. // Properties
  27632. /**
  27633. * Message options.
  27634. * @name ProtoBuf.Builder.Message.$options
  27635. * @type {Object.<string,*>}
  27636. * @expose
  27637. */
  27638. var $optionsS; // cc needs this
  27639. /**
  27640. * Message options.
  27641. * @name ProtoBuf.Builder.Message#$options
  27642. * @type {Object.<string,*>}
  27643. * @expose
  27644. */
  27645. var $options;
  27646. /**
  27647. * Reflection type.
  27648. * @name ProtoBuf.Builder.Message.$type
  27649. * @type {!ProtoBuf.Reflect.Message}
  27650. * @expose
  27651. */
  27652. var $typeS;
  27653. /**
  27654. * Reflection type.
  27655. * @name ProtoBuf.Builder.Message#$type
  27656. * @type {!ProtoBuf.Reflect.Message}
  27657. * @expose
  27658. */
  27659. var $type;
  27660. if (Object.defineProperty)
  27661. Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
  27662. Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
  27663. Object.defineProperty(Message, "$type", { "value": T }),
  27664. Object.defineProperty(MessagePrototype, "$type", { "value": T });
  27665. return Message;
  27666. })(ProtoBuf, this);
  27667. // Static enums and prototyped sub-messages / cached collections
  27668. this._fields = [];
  27669. this._fieldsById = {};
  27670. this._fieldsByName = {};
  27671. this._oneofsByName = {};
  27672. for (var i=0, k=this.children.length, child; i<k; i++) {
  27673. child = this.children[i];
  27674. if (child instanceof Enum || child instanceof Message || child instanceof Service) {
  27675. if (clazz.hasOwnProperty(child.name))
  27676. throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
  27677. clazz[child.name] = child.build();
  27678. } else if (child instanceof Message.Field)
  27679. child.build(),
  27680. this._fields.push(child),
  27681. this._fieldsById[child.id] = child,
  27682. this._fieldsByName[child.name] = child;
  27683. else if (child instanceof Message.OneOf) {
  27684. this._oneofsByName[child.name] = child;
  27685. }
  27686. else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
  27687. throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
  27688. }
  27689. return this.clazz = clazz;
  27690. };
  27691. /**
  27692. * Encodes a runtime message's contents to the specified buffer.
  27693. * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
  27694. * @param {ByteBuffer} buffer ByteBuffer to write to
  27695. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  27696. * @return {ByteBuffer} The ByteBuffer for chaining
  27697. * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
  27698. * @expose
  27699. */
  27700. MessagePrototype.encode = function(message, buffer, noVerify) {
  27701. var fieldMissing = null,
  27702. field;
  27703. for (var i=0, k=this._fields.length, val; i<k; ++i) {
  27704. field = this._fields[i];
  27705. val = message[field.name];
  27706. if (field.required && val === null) {
  27707. if (fieldMissing === null)
  27708. fieldMissing = field;
  27709. } else
  27710. field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
  27711. }
  27712. if (fieldMissing !== null) {
  27713. var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
  27714. err["encoded"] = buffer; // Still expose what we got
  27715. throw(err);
  27716. }
  27717. return buffer;
  27718. };
  27719. /**
  27720. * Calculates a runtime message's byte length.
  27721. * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
  27722. * @returns {number} Byte length
  27723. * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
  27724. * @expose
  27725. */
  27726. MessagePrototype.calculate = function(message) {
  27727. for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
  27728. field = this._fields[i];
  27729. val = message[field.name];
  27730. if (field.required && val === null)
  27731. throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
  27732. else
  27733. n += field.calculate(val, message);
  27734. }
  27735. return n;
  27736. };
  27737. /**
  27738. * Skips all data until the end of the specified group has been reached.
  27739. * @param {number} expectedId Expected GROUPEND id
  27740. * @param {!ByteBuffer} buf ByteBuffer
  27741. * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
  27742. * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
  27743. * @inner
  27744. */
  27745. function skipTillGroupEnd(expectedId, buf) {
  27746. var tag = buf.readVarint32(), // Throws on OOB
  27747. wireType = tag & 0x07,
  27748. id = tag >>> 3;
  27749. switch (wireType) {
  27750. case ProtoBuf.WIRE_TYPES.VARINT:
  27751. do tag = buf.readUint8();
  27752. while ((tag & 0x80) === 0x80);
  27753. break;
  27754. case ProtoBuf.WIRE_TYPES.BITS64:
  27755. buf.offset += 8;
  27756. break;
  27757. case ProtoBuf.WIRE_TYPES.LDELIM:
  27758. tag = buf.readVarint32(); // reads the varint
  27759. buf.offset += tag; // skips n bytes
  27760. break;
  27761. case ProtoBuf.WIRE_TYPES.STARTGROUP:
  27762. skipTillGroupEnd(id, buf);
  27763. break;
  27764. case ProtoBuf.WIRE_TYPES.ENDGROUP:
  27765. if (id === expectedId)
  27766. return false;
  27767. else
  27768. throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
  27769. case ProtoBuf.WIRE_TYPES.BITS32:
  27770. buf.offset += 4;
  27771. break;
  27772. default:
  27773. throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
  27774. }
  27775. return true;
  27776. }
  27777. /**
  27778. * Decodes an encoded message and returns the decoded message.
  27779. * @param {ByteBuffer} buffer ByteBuffer to decode from
  27780. * @param {number=} length Message length. Defaults to decode all remaining data.
  27781. * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
  27782. * @return {ProtoBuf.Builder.Message} Decoded message
  27783. * @throws {Error} If the message cannot be decoded
  27784. * @expose
  27785. */
  27786. MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
  27787. if (typeof length !== 'number')
  27788. length = -1;
  27789. var start = buffer.offset,
  27790. msg = new (this.clazz)(),
  27791. tag, wireType, id, field;
  27792. while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
  27793. tag = buffer.readVarint32();
  27794. wireType = tag & 0x07;
  27795. id = tag >>> 3;
  27796. if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
  27797. if (id !== expectedGroupEndId)
  27798. throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
  27799. break;
  27800. }
  27801. if (!(field = this._fieldsById[id])) {
  27802. // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
  27803. switch (wireType) {
  27804. case ProtoBuf.WIRE_TYPES.VARINT:
  27805. buffer.readVarint32();
  27806. break;
  27807. case ProtoBuf.WIRE_TYPES.BITS32:
  27808. buffer.offset += 4;
  27809. break;
  27810. case ProtoBuf.WIRE_TYPES.BITS64:
  27811. buffer.offset += 8;
  27812. break;
  27813. case ProtoBuf.WIRE_TYPES.LDELIM:
  27814. var len = buffer.readVarint32();
  27815. buffer.offset += len;
  27816. break;
  27817. case ProtoBuf.WIRE_TYPES.STARTGROUP:
  27818. while (skipTillGroupEnd(id, buffer)) {}
  27819. break;
  27820. default:
  27821. throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
  27822. }
  27823. continue;
  27824. }
  27825. if (field.repeated && !field.options["packed"]) {
  27826. msg[field.name].push(field.decode(wireType, buffer));
  27827. } else if (field.map) {
  27828. var keyval = field.decode(wireType, buffer);
  27829. msg[field.name].set(keyval[0], keyval[1]);
  27830. } else {
  27831. msg[field.name] = field.decode(wireType, buffer);
  27832. if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
  27833. var currentField = msg[field.oneof.name]; // Virtual field references currently set field
  27834. if (currentField !== null && currentField !== field.name)
  27835. msg[currentField] = null; // Clear currently set field
  27836. msg[field.oneof.name] = field.name; // Point virtual field at this field
  27837. }
  27838. }
  27839. }
  27840. // Check if all required fields are present and set default values for optional fields that are not
  27841. for (var i=0, k=this._fields.length; i<k; ++i) {
  27842. field = this._fields[i];
  27843. if (msg[field.name] === null) {
  27844. if (this.syntax === "proto3") { // Proto3 sets default values by specification
  27845. msg[field.name] = field.defaultValue;
  27846. } else if (field.required) {
  27847. var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
  27848. err["decoded"] = msg; // Still expose what we got
  27849. throw(err);
  27850. } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
  27851. msg[field.name] = field.defaultValue;
  27852. }
  27853. }
  27854. return msg;
  27855. };
  27856. /**
  27857. * @alias ProtoBuf.Reflect.Message
  27858. * @expose
  27859. */
  27860. Reflect.Message = Message;
  27861. /**
  27862. * Constructs a new Message Field.
  27863. * @exports ProtoBuf.Reflect.Message.Field
  27864. * @param {!ProtoBuf.Builder} builder Builder reference
  27865. * @param {!ProtoBuf.Reflect.Message} message Message reference
  27866. * @param {string} rule Rule, one of requried, optional, repeated
  27867. * @param {string?} keytype Key data type, if any.
  27868. * @param {string} type Data type, e.g. int32
  27869. * @param {string} name Field name
  27870. * @param {number} id Unique field id
  27871. * @param {Object.<string,*>=} options Options
  27872. * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
  27873. * @param {string?} syntax The syntax level of this definition (e.g., proto3)
  27874. * @constructor
  27875. * @extends ProtoBuf.Reflect.T
  27876. */
  27877. var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
  27878. T.call(this, builder, message, name);
  27879. /**
  27880. * @override
  27881. */
  27882. this.className = "Message.Field";
  27883. /**
  27884. * Message field required flag.
  27885. * @type {boolean}
  27886. * @expose
  27887. */
  27888. this.required = rule === "required";
  27889. /**
  27890. * Message field repeated flag.
  27891. * @type {boolean}
  27892. * @expose
  27893. */
  27894. this.repeated = rule === "repeated";
  27895. /**
  27896. * Message field map flag.
  27897. * @type {boolean}
  27898. * @expose
  27899. */
  27900. this.map = rule === "map";
  27901. /**
  27902. * Message field key type. Type reference string if unresolved, protobuf
  27903. * type if resolved. Valid only if this.map === true, null otherwise.
  27904. * @type {string|{name: string, wireType: number}|null}
  27905. * @expose
  27906. */
  27907. this.keyType = keytype || null;
  27908. /**
  27909. * Message field type. Type reference string if unresolved, protobuf type if
  27910. * resolved. In a map field, this is the value type.
  27911. * @type {string|{name: string, wireType: number}}
  27912. * @expose
  27913. */
  27914. this.type = type;
  27915. /**
  27916. * Resolved type reference inside the global namespace.
  27917. * @type {ProtoBuf.Reflect.T|null}
  27918. * @expose
  27919. */
  27920. this.resolvedType = null;
  27921. /**
  27922. * Unique message field id.
  27923. * @type {number}
  27924. * @expose
  27925. */
  27926. this.id = id;
  27927. /**
  27928. * Message field options.
  27929. * @type {!Object.<string,*>}
  27930. * @dict
  27931. * @expose
  27932. */
  27933. this.options = options || {};
  27934. /**
  27935. * Default value.
  27936. * @type {*}
  27937. * @expose
  27938. */
  27939. this.defaultValue = null;
  27940. /**
  27941. * Enclosing OneOf.
  27942. * @type {?ProtoBuf.Reflect.Message.OneOf}
  27943. * @expose
  27944. */
  27945. this.oneof = oneof || null;
  27946. /**
  27947. * Syntax level of this definition (e.g., proto3).
  27948. * @type {string}
  27949. * @expose
  27950. */
  27951. this.syntax = syntax || 'proto2';
  27952. /**
  27953. * Original field name.
  27954. * @type {string}
  27955. * @expose
  27956. */
  27957. this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
  27958. /**
  27959. * Element implementation. Created in build() after types are resolved.
  27960. * @type {ProtoBuf.Element}
  27961. * @expose
  27962. */
  27963. this.element = null;
  27964. /**
  27965. * Key element implementation, for map fields. Created in build() after
  27966. * types are resolved.
  27967. * @type {ProtoBuf.Element}
  27968. * @expose
  27969. */
  27970. this.keyElement = null;
  27971. // Convert field names to camel case notation if the override is set
  27972. if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
  27973. this.name = ProtoBuf.Util.toCamelCase(this.name);
  27974. };
  27975. /**
  27976. * @alias ProtoBuf.Reflect.Message.Field.prototype
  27977. * @inner
  27978. */
  27979. var FieldPrototype = Field.prototype = Object.create(T.prototype);
  27980. /**
  27981. * Builds the field.
  27982. * @override
  27983. * @expose
  27984. */
  27985. FieldPrototype.build = function() {
  27986. this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
  27987. if (this.map)
  27988. this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
  27989. // In proto3, fields do not have field presence, and every field is set to
  27990. // its type's default value ("", 0, 0.0, or false).
  27991. if (this.syntax === 'proto3' && !this.repeated && !this.map)
  27992. this.defaultValue = Element.defaultFieldValue(this.type);
  27993. // Otherwise, default values are present when explicitly specified
  27994. else if (typeof this.options['default'] !== 'undefined')
  27995. this.defaultValue = this.verifyValue(this.options['default']);
  27996. };
  27997. /**
  27998. * Checks if the given value can be set for this field.
  27999. * @param {*} value Value to check
  28000. * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
  28001. * @return {*} Verified, maybe adjusted, value
  28002. * @throws {Error} If the value cannot be set for this field
  28003. * @expose
  28004. */
  28005. FieldPrototype.verifyValue = function(value, skipRepeated) {
  28006. skipRepeated = skipRepeated || false;
  28007. var self = this;
  28008. function fail(val, msg) {
  28009. throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
  28010. }
  28011. if (value === null) { // NULL values for optional fields
  28012. if (this.required)
  28013. fail(typeof value, "required");
  28014. if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
  28015. fail(typeof value, "proto3 field without field presence cannot be null");
  28016. return null;
  28017. }
  28018. var i;
  28019. if (this.repeated && !skipRepeated) { // Repeated values as arrays
  28020. if (!Array.isArray(value))
  28021. value = [value];
  28022. var res = [];
  28023. for (i=0; i<value.length; i++)
  28024. res.push(this.element.verifyValue(value[i]));
  28025. return res;
  28026. }
  28027. if (this.map && !skipRepeated) { // Map values as objects
  28028. if (!(value instanceof ProtoBuf.Map)) {
  28029. // If not already a Map, attempt to convert.
  28030. if (!(value instanceof Object)) {
  28031. fail(typeof value,
  28032. "expected ProtoBuf.Map or raw object for map field");
  28033. }
  28034. return new ProtoBuf.Map(this, value);
  28035. } else {
  28036. return value;
  28037. }
  28038. }
  28039. // All non-repeated fields expect no array
  28040. if (!this.repeated && Array.isArray(value))
  28041. fail(typeof value, "no array expected");
  28042. return this.element.verifyValue(value);
  28043. };
  28044. /**
  28045. * Determines whether the field will have a presence on the wire given its
  28046. * value.
  28047. * @param {*} value Verified field value
  28048. * @param {!ProtoBuf.Builder.Message} message Runtime message
  28049. * @return {boolean} Whether the field will be present on the wire
  28050. */
  28051. FieldPrototype.hasWirePresence = function(value, message) {
  28052. if (this.syntax !== 'proto3')
  28053. return (value !== null);
  28054. if (this.oneof && message[this.oneof.name] === this.name)
  28055. return true;
  28056. switch (this.type) {
  28057. case ProtoBuf.TYPES["int32"]:
  28058. case ProtoBuf.TYPES["sint32"]:
  28059. case ProtoBuf.TYPES["sfixed32"]:
  28060. case ProtoBuf.TYPES["uint32"]:
  28061. case ProtoBuf.TYPES["fixed32"]:
  28062. return value !== 0;
  28063. case ProtoBuf.TYPES["int64"]:
  28064. case ProtoBuf.TYPES["sint64"]:
  28065. case ProtoBuf.TYPES["sfixed64"]:
  28066. case ProtoBuf.TYPES["uint64"]:
  28067. case ProtoBuf.TYPES["fixed64"]:
  28068. return value.low !== 0 || value.high !== 0;
  28069. case ProtoBuf.TYPES["bool"]:
  28070. return value;
  28071. case ProtoBuf.TYPES["float"]:
  28072. case ProtoBuf.TYPES["double"]:
  28073. return value !== 0.0;
  28074. case ProtoBuf.TYPES["string"]:
  28075. return value.length > 0;
  28076. case ProtoBuf.TYPES["bytes"]:
  28077. return value.remaining() > 0;
  28078. case ProtoBuf.TYPES["enum"]:
  28079. return value !== 0;
  28080. case ProtoBuf.TYPES["message"]:
  28081. return value !== null;
  28082. default:
  28083. return true;
  28084. }
  28085. };
  28086. /**
  28087. * Encodes the specified field value to the specified buffer.
  28088. * @param {*} value Verified field value
  28089. * @param {ByteBuffer} buffer ByteBuffer to encode to
  28090. * @param {!ProtoBuf.Builder.Message} message Runtime message
  28091. * @return {ByteBuffer} The ByteBuffer for chaining
  28092. * @throws {Error} If the field cannot be encoded
  28093. * @expose
  28094. */
  28095. FieldPrototype.encode = function(value, buffer, message) {
  28096. if (this.type === null || typeof this.type !== 'object')
  28097. throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
  28098. if (value === null || (this.repeated && value.length == 0))
  28099. return buffer; // Optional omitted
  28100. try {
  28101. if (this.repeated) {
  28102. var i;
  28103. // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
  28104. // types) can be declared 'packed'."
  28105. if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
  28106. // "All of the elements of the field are packed into a single key-value pair with wire type 2
  28107. // (length-delimited). Each element is encoded the same way it would be normally, except without a
  28108. // tag preceding it."
  28109. buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  28110. buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
  28111. var start = buffer.offset; // Remember where the contents begin
  28112. for (i=0; i<value.length; i++)
  28113. this.element.encodeValue(this.id, value[i], buffer);
  28114. var len = buffer.offset-start,
  28115. varintLen = ByteBuffer.calculateVarint32(len);
  28116. if (varintLen > 1) { // We need to move the contents
  28117. var contents = buffer.slice(start, buffer.offset);
  28118. start += varintLen-1;
  28119. buffer.offset = start;
  28120. buffer.append(contents);
  28121. }
  28122. buffer.writeVarint32(len, start-varintLen);
  28123. } else {
  28124. // "If your message definition has repeated elements (without the [packed=true] option), the encoded
  28125. // message has zero or more key-value pairs with the same tag number"
  28126. for (i=0; i<value.length; i++)
  28127. buffer.writeVarint32((this.id << 3) | this.type.wireType),
  28128. this.element.encodeValue(this.id, value[i], buffer);
  28129. }
  28130. } else if (this.map) {
  28131. // Write out each map entry as a submessage.
  28132. value.forEach(function(val, key, m) {
  28133. // Compute the length of the submessage (key, val) pair.
  28134. var length =
  28135. ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
  28136. this.keyElement.calculateLength(1, key) +
  28137. ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
  28138. this.element.calculateLength(2, val);
  28139. // Submessage with wire type of length-delimited.
  28140. buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  28141. buffer.writeVarint32(length);
  28142. // Write out the key and val.
  28143. buffer.writeVarint32((1 << 3) | this.keyType.wireType);
  28144. this.keyElement.encodeValue(1, key, buffer);
  28145. buffer.writeVarint32((2 << 3) | this.type.wireType);
  28146. this.element.encodeValue(2, val, buffer);
  28147. }, this);
  28148. } else {
  28149. if (this.hasWirePresence(value, message)) {
  28150. buffer.writeVarint32((this.id << 3) | this.type.wireType);
  28151. this.element.encodeValue(this.id, value, buffer);
  28152. }
  28153. }
  28154. } catch (e) {
  28155. throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
  28156. }
  28157. return buffer;
  28158. };
  28159. /**
  28160. * Calculates the length of this field's value on the network level.
  28161. * @param {*} value Field value
  28162. * @param {!ProtoBuf.Builder.Message} message Runtime message
  28163. * @returns {number} Byte length
  28164. * @expose
  28165. */
  28166. FieldPrototype.calculate = function(value, message) {
  28167. value = this.verifyValue(value); // May throw
  28168. if (this.type === null || typeof this.type !== 'object')
  28169. throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
  28170. if (value === null || (this.repeated && value.length == 0))
  28171. return 0; // Optional omitted
  28172. var n = 0;
  28173. try {
  28174. if (this.repeated) {
  28175. var i, ni;
  28176. if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
  28177. n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  28178. ni = 0;
  28179. for (i=0; i<value.length; i++)
  28180. ni += this.element.calculateLength(this.id, value[i]);
  28181. n += ByteBuffer.calculateVarint32(ni);
  28182. n += ni;
  28183. } else {
  28184. for (i=0; i<value.length; i++)
  28185. n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
  28186. n += this.element.calculateLength(this.id, value[i]);
  28187. }
  28188. } else if (this.map) {
  28189. // Each map entry becomes a submessage.
  28190. value.forEach(function(val, key, m) {
  28191. // Compute the length of the submessage (key, val) pair.
  28192. var length =
  28193. ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
  28194. this.keyElement.calculateLength(1, key) +
  28195. ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
  28196. this.element.calculateLength(2, val);
  28197. n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  28198. n += ByteBuffer.calculateVarint32(length);
  28199. n += length;
  28200. }, this);
  28201. } else {
  28202. if (this.hasWirePresence(value, message)) {
  28203. n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
  28204. n += this.element.calculateLength(this.id, value);
  28205. }
  28206. }
  28207. } catch (e) {
  28208. throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
  28209. }
  28210. return n;
  28211. };
  28212. /**
  28213. * Decode the field value from the specified buffer.
  28214. * @param {number} wireType Leading wire type
  28215. * @param {ByteBuffer} buffer ByteBuffer to decode from
  28216. * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
  28217. * @return {*} Decoded value: array for packed repeated fields, [key, value] for
  28218. * map fields, or an individual value otherwise.
  28219. * @throws {Error} If the field cannot be decoded
  28220. * @expose
  28221. */
  28222. FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
  28223. var value, nBytes;
  28224. // We expect wireType to match the underlying type's wireType unless we see
  28225. // a packed repeated field, or unless this is a map field.
  28226. var wireTypeOK =
  28227. (!this.map && wireType == this.type.wireType) ||
  28228. (!skipRepeated && this.repeated && this.options["packed"] &&
  28229. wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
  28230. (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
  28231. if (!wireTypeOK)
  28232. throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
  28233. // Handle packed repeated fields.
  28234. if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
  28235. if (!skipRepeated) {
  28236. nBytes = buffer.readVarint32();
  28237. nBytes = buffer.offset + nBytes; // Limit
  28238. var values = [];
  28239. while (buffer.offset < nBytes)
  28240. values.push(this.decode(this.type.wireType, buffer, true));
  28241. return values;
  28242. }
  28243. // Read the next value otherwise...
  28244. }
  28245. // Handle maps.
  28246. if (this.map) {
  28247. // Read one (key, value) submessage, and return [key, value]
  28248. var key = Element.defaultFieldValue(this.keyType);
  28249. value = Element.defaultFieldValue(this.type);
  28250. // Read the length
  28251. nBytes = buffer.readVarint32();
  28252. if (buffer.remaining() < nBytes)
  28253. throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
  28254. // Get a sub-buffer of this key/value submessage
  28255. var msgbuf = buffer.clone();
  28256. msgbuf.limit = msgbuf.offset + nBytes;
  28257. buffer.offset += nBytes;
  28258. while (msgbuf.remaining() > 0) {
  28259. var tag = msgbuf.readVarint32();
  28260. wireType = tag & 0x07;
  28261. var id = tag >>> 3;
  28262. if (id === 1) {
  28263. key = this.keyElement.decode(msgbuf, wireType, id);
  28264. } else if (id === 2) {
  28265. value = this.element.decode(msgbuf, wireType, id);
  28266. } else {
  28267. throw Error("Unexpected tag in map field key/value submessage");
  28268. }
  28269. }
  28270. return [key, value];
  28271. }
  28272. // Handle singular and non-packed repeated field values.
  28273. return this.element.decode(buffer, wireType, this.id);
  28274. };
  28275. /**
  28276. * @alias ProtoBuf.Reflect.Message.Field
  28277. * @expose
  28278. */
  28279. Reflect.Message.Field = Field;
  28280. /**
  28281. * Constructs a new Message ExtensionField.
  28282. * @exports ProtoBuf.Reflect.Message.ExtensionField
  28283. * @param {!ProtoBuf.Builder} builder Builder reference
  28284. * @param {!ProtoBuf.Reflect.Message} message Message reference
  28285. * @param {string} rule Rule, one of requried, optional, repeated
  28286. * @param {string} type Data type, e.g. int32
  28287. * @param {string} name Field name
  28288. * @param {number} id Unique field id
  28289. * @param {!Object.<string,*>=} options Options
  28290. * @constructor
  28291. * @extends ProtoBuf.Reflect.Message.Field
  28292. */
  28293. var ExtensionField = function(builder, message, rule, type, name, id, options) {
  28294. Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
  28295. /**
  28296. * Extension reference.
  28297. * @type {!ProtoBuf.Reflect.Extension}
  28298. * @expose
  28299. */
  28300. this.extension;
  28301. };
  28302. // Extends Field
  28303. ExtensionField.prototype = Object.create(Field.prototype);
  28304. /**
  28305. * @alias ProtoBuf.Reflect.Message.ExtensionField
  28306. * @expose
  28307. */
  28308. Reflect.Message.ExtensionField = ExtensionField;
  28309. /**
  28310. * Constructs a new Message OneOf.
  28311. * @exports ProtoBuf.Reflect.Message.OneOf
  28312. * @param {!ProtoBuf.Builder} builder Builder reference
  28313. * @param {!ProtoBuf.Reflect.Message} message Message reference
  28314. * @param {string} name OneOf name
  28315. * @constructor
  28316. * @extends ProtoBuf.Reflect.T
  28317. */
  28318. var OneOf = function(builder, message, name) {
  28319. T.call(this, builder, message, name);
  28320. /**
  28321. * Enclosed fields.
  28322. * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
  28323. * @expose
  28324. */
  28325. this.fields = [];
  28326. };
  28327. /**
  28328. * @alias ProtoBuf.Reflect.Message.OneOf
  28329. * @expose
  28330. */
  28331. Reflect.Message.OneOf = OneOf;
  28332. /**
  28333. * Constructs a new Enum.
  28334. * @exports ProtoBuf.Reflect.Enum
  28335. * @param {!ProtoBuf.Builder} builder Builder reference
  28336. * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
  28337. * @param {string} name Enum name
  28338. * @param {Object.<string,*>=} options Enum options
  28339. * @param {string?} syntax The syntax level (e.g., proto3)
  28340. * @constructor
  28341. * @extends ProtoBuf.Reflect.Namespace
  28342. */
  28343. var Enum = function(builder, parent, name, options, syntax) {
  28344. Namespace.call(this, builder, parent, name, options, syntax);
  28345. /**
  28346. * @override
  28347. */
  28348. this.className = "Enum";
  28349. /**
  28350. * Runtime enum object.
  28351. * @type {Object.<string,number>|null}
  28352. * @expose
  28353. */
  28354. this.object = null;
  28355. };
  28356. /**
  28357. * Gets the string name of an enum value.
  28358. * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
  28359. * @param {number} value Enum value
  28360. * @returns {?string} Name or `null` if not present
  28361. * @expose
  28362. */
  28363. Enum.getName = function(enm, value) {
  28364. var keys = Object.keys(enm);
  28365. for (var i=0, key; i<keys.length; ++i)
  28366. if (enm[key = keys[i]] === value)
  28367. return key;
  28368. return null;
  28369. };
  28370. /**
  28371. * @alias ProtoBuf.Reflect.Enum.prototype
  28372. * @inner
  28373. */
  28374. var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
  28375. /**
  28376. * Builds this enum and returns the runtime counterpart.
  28377. * @param {boolean} rebuild Whether to rebuild or not, defaults to false
  28378. * @returns {!Object.<string,number>}
  28379. * @expose
  28380. */
  28381. EnumPrototype.build = function(rebuild) {
  28382. if (this.object && !rebuild)
  28383. return this.object;
  28384. var enm = new ProtoBuf.Builder.Enum(),
  28385. values = this.getChildren(Enum.Value);
  28386. for (var i=0, k=values.length; i<k; ++i)
  28387. enm[values[i]['name']] = values[i]['id'];
  28388. if (Object.defineProperty)
  28389. Object.defineProperty(enm, '$options', {
  28390. "value": this.buildOpt(),
  28391. "enumerable": false
  28392. });
  28393. return this.object = enm;
  28394. };
  28395. /**
  28396. * @alias ProtoBuf.Reflect.Enum
  28397. * @expose
  28398. */
  28399. Reflect.Enum = Enum;
  28400. /**
  28401. * Constructs a new Enum Value.
  28402. * @exports ProtoBuf.Reflect.Enum.Value
  28403. * @param {!ProtoBuf.Builder} builder Builder reference
  28404. * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
  28405. * @param {string} name Field name
  28406. * @param {number} id Unique field id
  28407. * @constructor
  28408. * @extends ProtoBuf.Reflect.T
  28409. */
  28410. var Value = function(builder, enm, name, id) {
  28411. T.call(this, builder, enm, name);
  28412. /**
  28413. * @override
  28414. */
  28415. this.className = "Enum.Value";
  28416. /**
  28417. * Unique enum value id.
  28418. * @type {number}
  28419. * @expose
  28420. */
  28421. this.id = id;
  28422. };
  28423. // Extends T
  28424. Value.prototype = Object.create(T.prototype);
  28425. /**
  28426. * @alias ProtoBuf.Reflect.Enum.Value
  28427. * @expose
  28428. */
  28429. Reflect.Enum.Value = Value;
  28430. /**
  28431. * An extension (field).
  28432. * @exports ProtoBuf.Reflect.Extension
  28433. * @constructor
  28434. * @param {!ProtoBuf.Builder} builder Builder reference
  28435. * @param {!ProtoBuf.Reflect.T} parent Parent object
  28436. * @param {string} name Object name
  28437. * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
  28438. */
  28439. var Extension = function(builder, parent, name, field) {
  28440. T.call(this, builder, parent, name);
  28441. /**
  28442. * Extended message field.
  28443. * @type {!ProtoBuf.Reflect.Message.Field}
  28444. * @expose
  28445. */
  28446. this.field = field;
  28447. };
  28448. // Extends T
  28449. Extension.prototype = Object.create(T.prototype);
  28450. /**
  28451. * @alias ProtoBuf.Reflect.Extension
  28452. * @expose
  28453. */
  28454. Reflect.Extension = Extension;
  28455. /**
  28456. * Constructs a new Service.
  28457. * @exports ProtoBuf.Reflect.Service
  28458. * @param {!ProtoBuf.Builder} builder Builder reference
  28459. * @param {!ProtoBuf.Reflect.Namespace} root Root
  28460. * @param {string} name Service name
  28461. * @param {Object.<string,*>=} options Options
  28462. * @constructor
  28463. * @extends ProtoBuf.Reflect.Namespace
  28464. */
  28465. var Service = function(builder, root, name, options) {
  28466. Namespace.call(this, builder, root, name, options);
  28467. /**
  28468. * @override
  28469. */
  28470. this.className = "Service";
  28471. /**
  28472. * Built runtime service class.
  28473. * @type {?function(new:ProtoBuf.Builder.Service)}
  28474. */
  28475. this.clazz = null;
  28476. };
  28477. /**
  28478. * @alias ProtoBuf.Reflect.Service.prototype
  28479. * @inner
  28480. */
  28481. var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
  28482. /**
  28483. * Builds the service and returns the runtime counterpart, which is a fully functional class.
  28484. * @see ProtoBuf.Builder.Service
  28485. * @param {boolean=} rebuild Whether to rebuild or not
  28486. * @return {Function} Service class
  28487. * @throws {Error} If the message cannot be built
  28488. * @expose
  28489. */
  28490. ServicePrototype.build = function(rebuild) {
  28491. if (this.clazz && !rebuild)
  28492. return this.clazz;
  28493. // Create the runtime Service class in its own scope
  28494. return this.clazz = (function(ProtoBuf, T) {
  28495. /**
  28496. * Constructs a new runtime Service.
  28497. * @name ProtoBuf.Builder.Service
  28498. * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
  28499. * @class Barebone of all runtime services.
  28500. * @constructor
  28501. * @throws {Error} If the service cannot be created
  28502. */
  28503. var Service = function(rpcImpl) {
  28504. ProtoBuf.Builder.Service.call(this);
  28505. /**
  28506. * Service implementation.
  28507. * @name ProtoBuf.Builder.Service#rpcImpl
  28508. * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
  28509. * @expose
  28510. */
  28511. this.rpcImpl = rpcImpl || function(name, msg, callback) {
  28512. // This is what a user has to implement: A function receiving the method name, the actual message to
  28513. // send (type checked) and the callback that's either provided with the error as its first
  28514. // argument or null and the actual response message.
  28515. setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
  28516. };
  28517. };
  28518. /**
  28519. * @alias ProtoBuf.Builder.Service.prototype
  28520. * @inner
  28521. */
  28522. var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
  28523. /**
  28524. * Asynchronously performs an RPC call using the given RPC implementation.
  28525. * @name ProtoBuf.Builder.Service.[Method]
  28526. * @function
  28527. * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
  28528. * @param {ProtoBuf.Builder.Message} req Request
  28529. * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
  28530. * the error if any and the response either as a pre-parsed message or as its raw bytes
  28531. * @abstract
  28532. */
  28533. /**
  28534. * Asynchronously performs an RPC call using the instance's RPC implementation.
  28535. * @name ProtoBuf.Builder.Service#[Method]
  28536. * @function
  28537. * @param {ProtoBuf.Builder.Message} req Request
  28538. * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
  28539. * the error if any and the response either as a pre-parsed message or as its raw bytes
  28540. * @abstract
  28541. */
  28542. var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
  28543. for (var i=0; i<rpc.length; i++) {
  28544. (function(method) {
  28545. // service#Method(message, callback)
  28546. ServicePrototype[method.name] = function(req, callback) {
  28547. try {
  28548. try {
  28549. // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
  28550. req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
  28551. } catch (err) {
  28552. if (!(err instanceof TypeError))
  28553. throw err;
  28554. }
  28555. if (req === null || typeof req !== 'object')
  28556. throw Error("Illegal arguments");
  28557. if (!(req instanceof method.resolvedRequestType.clazz))
  28558. req = new method.resolvedRequestType.clazz(req);
  28559. this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
  28560. if (err) {
  28561. callback(err);
  28562. return;
  28563. }
  28564. // Coalesce to empty string when service response has empty content
  28565. if (res === null)
  28566. res = ''
  28567. try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
  28568. if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
  28569. callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
  28570. return;
  28571. }
  28572. callback(null, res);
  28573. });
  28574. } catch (err) {
  28575. setTimeout(callback.bind(this, err), 0);
  28576. }
  28577. };
  28578. // Service.Method(rpcImpl, message, callback)
  28579. Service[method.name] = function(rpcImpl, req, callback) {
  28580. new Service(rpcImpl)[method.name](req, callback);
  28581. };
  28582. if (Object.defineProperty)
  28583. Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
  28584. Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
  28585. })(rpc[i]);
  28586. }
  28587. // Properties
  28588. /**
  28589. * Service options.
  28590. * @name ProtoBuf.Builder.Service.$options
  28591. * @type {Object.<string,*>}
  28592. * @expose
  28593. */
  28594. var $optionsS; // cc needs this
  28595. /**
  28596. * Service options.
  28597. * @name ProtoBuf.Builder.Service#$options
  28598. * @type {Object.<string,*>}
  28599. * @expose
  28600. */
  28601. var $options;
  28602. /**
  28603. * Reflection type.
  28604. * @name ProtoBuf.Builder.Service.$type
  28605. * @type {!ProtoBuf.Reflect.Service}
  28606. * @expose
  28607. */
  28608. var $typeS;
  28609. /**
  28610. * Reflection type.
  28611. * @name ProtoBuf.Builder.Service#$type
  28612. * @type {!ProtoBuf.Reflect.Service}
  28613. * @expose
  28614. */
  28615. var $type;
  28616. if (Object.defineProperty)
  28617. Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
  28618. Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
  28619. Object.defineProperty(Service, "$type", { "value": T }),
  28620. Object.defineProperty(ServicePrototype, "$type", { "value": T });
  28621. return Service;
  28622. })(ProtoBuf, this);
  28623. };
  28624. /**
  28625. * @alias ProtoBuf.Reflect.Service
  28626. * @expose
  28627. */
  28628. Reflect.Service = Service;
  28629. /**
  28630. * Abstract service method.
  28631. * @exports ProtoBuf.Reflect.Service.Method
  28632. * @param {!ProtoBuf.Builder} builder Builder reference
  28633. * @param {!ProtoBuf.Reflect.Service} svc Service
  28634. * @param {string} name Method name
  28635. * @param {Object.<string,*>=} options Options
  28636. * @constructor
  28637. * @extends ProtoBuf.Reflect.T
  28638. */
  28639. var Method = function(builder, svc, name, options) {
  28640. T.call(this, builder, svc, name);
  28641. /**
  28642. * @override
  28643. */
  28644. this.className = "Service.Method";
  28645. /**
  28646. * Options.
  28647. * @type {Object.<string, *>}
  28648. * @expose
  28649. */
  28650. this.options = options || {};
  28651. };
  28652. /**
  28653. * @alias ProtoBuf.Reflect.Service.Method.prototype
  28654. * @inner
  28655. */
  28656. var MethodPrototype = Method.prototype = Object.create(T.prototype);
  28657. /**
  28658. * Builds the method's '$options' property.
  28659. * @name ProtoBuf.Reflect.Service.Method#buildOpt
  28660. * @function
  28661. * @return {Object.<string,*>}
  28662. */
  28663. MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
  28664. /**
  28665. * @alias ProtoBuf.Reflect.Service.Method
  28666. * @expose
  28667. */
  28668. Reflect.Service.Method = Method;
  28669. /**
  28670. * RPC service method.
  28671. * @exports ProtoBuf.Reflect.Service.RPCMethod
  28672. * @param {!ProtoBuf.Builder} builder Builder reference
  28673. * @param {!ProtoBuf.Reflect.Service} svc Service
  28674. * @param {string} name Method name
  28675. * @param {string} request Request message name
  28676. * @param {string} response Response message name
  28677. * @param {boolean} request_stream Whether requests are streamed
  28678. * @param {boolean} response_stream Whether responses are streamed
  28679. * @param {Object.<string,*>=} options Options
  28680. * @constructor
  28681. * @extends ProtoBuf.Reflect.Service.Method
  28682. */
  28683. var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
  28684. Method.call(this, builder, svc, name, options);
  28685. /**
  28686. * @override
  28687. */
  28688. this.className = "Service.RPCMethod";
  28689. /**
  28690. * Request message name.
  28691. * @type {string}
  28692. * @expose
  28693. */
  28694. this.requestName = request;
  28695. /**
  28696. * Response message name.
  28697. * @type {string}
  28698. * @expose
  28699. */
  28700. this.responseName = response;
  28701. /**
  28702. * Whether requests are streamed
  28703. * @type {bool}
  28704. * @expose
  28705. */
  28706. this.requestStream = request_stream;
  28707. /**
  28708. * Whether responses are streamed
  28709. * @type {bool}
  28710. * @expose
  28711. */
  28712. this.responseStream = response_stream;
  28713. /**
  28714. * Resolved request message type.
  28715. * @type {ProtoBuf.Reflect.Message}
  28716. * @expose
  28717. */
  28718. this.resolvedRequestType = null;
  28719. /**
  28720. * Resolved response message type.
  28721. * @type {ProtoBuf.Reflect.Message}
  28722. * @expose
  28723. */
  28724. this.resolvedResponseType = null;
  28725. };
  28726. // Extends Method
  28727. RPCMethod.prototype = Object.create(Method.prototype);
  28728. /**
  28729. * @alias ProtoBuf.Reflect.Service.RPCMethod
  28730. * @expose
  28731. */
  28732. Reflect.Service.RPCMethod = RPCMethod;
  28733. return Reflect;
  28734. })(ProtoBuf);
  28735. /**
  28736. * @alias ProtoBuf.Builder
  28737. * @expose
  28738. */
  28739. ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
  28740. "use strict";
  28741. /**
  28742. * Constructs a new Builder.
  28743. * @exports ProtoBuf.Builder
  28744. * @class Provides the functionality to build protocol messages.
  28745. * @param {Object.<string,*>=} options Options
  28746. * @constructor
  28747. */
  28748. var Builder = function(options) {
  28749. /**
  28750. * Namespace.
  28751. * @type {ProtoBuf.Reflect.Namespace}
  28752. * @expose
  28753. */
  28754. this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
  28755. /**
  28756. * Namespace pointer.
  28757. * @type {ProtoBuf.Reflect.T}
  28758. * @expose
  28759. */
  28760. this.ptr = this.ns;
  28761. /**
  28762. * Resolved flag.
  28763. * @type {boolean}
  28764. * @expose
  28765. */
  28766. this.resolved = false;
  28767. /**
  28768. * The current building result.
  28769. * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
  28770. * @expose
  28771. */
  28772. this.result = null;
  28773. /**
  28774. * Imported files.
  28775. * @type {Array.<string>}
  28776. * @expose
  28777. */
  28778. this.files = {};
  28779. /**
  28780. * Import root override.
  28781. * @type {?string}
  28782. * @expose
  28783. */
  28784. this.importRoot = null;
  28785. /**
  28786. * Options.
  28787. * @type {!Object.<string, *>}
  28788. * @expose
  28789. */
  28790. this.options = options || {};
  28791. };
  28792. /**
  28793. * @alias ProtoBuf.Builder.prototype
  28794. * @inner
  28795. */
  28796. var BuilderPrototype = Builder.prototype;
  28797. // ----- Definition tests -----
  28798. /**
  28799. * Tests if a definition most likely describes a message.
  28800. * @param {!Object} def
  28801. * @returns {boolean}
  28802. * @expose
  28803. */
  28804. Builder.isMessage = function(def) {
  28805. // Messages require a string name
  28806. if (typeof def["name"] !== 'string')
  28807. return false;
  28808. // Messages do not contain values (enum) or rpc methods (service)
  28809. if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
  28810. return false;
  28811. return true;
  28812. };
  28813. /**
  28814. * Tests if a definition most likely describes a message field.
  28815. * @param {!Object} def
  28816. * @returns {boolean}
  28817. * @expose
  28818. */
  28819. Builder.isMessageField = function(def) {
  28820. // Message fields require a string rule, name and type and an id
  28821. if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
  28822. return false;
  28823. return true;
  28824. };
  28825. /**
  28826. * Tests if a definition most likely describes an enum.
  28827. * @param {!Object} def
  28828. * @returns {boolean}
  28829. * @expose
  28830. */
  28831. Builder.isEnum = function(def) {
  28832. // Enums require a string name
  28833. if (typeof def["name"] !== 'string')
  28834. return false;
  28835. // Enums require at least one value
  28836. if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
  28837. return false;
  28838. return true;
  28839. };
  28840. /**
  28841. * Tests if a definition most likely describes a service.
  28842. * @param {!Object} def
  28843. * @returns {boolean}
  28844. * @expose
  28845. */
  28846. Builder.isService = function(def) {
  28847. // Services require a string name and an rpc object
  28848. if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
  28849. return false;
  28850. return true;
  28851. };
  28852. /**
  28853. * Tests if a definition most likely describes an extended message
  28854. * @param {!Object} def
  28855. * @returns {boolean}
  28856. * @expose
  28857. */
  28858. Builder.isExtend = function(def) {
  28859. // Extends rquire a string ref
  28860. if (typeof def["ref"] !== 'string')
  28861. return false;
  28862. return true;
  28863. };
  28864. // ----- Building -----
  28865. /**
  28866. * Resets the pointer to the root namespace.
  28867. * @returns {!ProtoBuf.Builder} this
  28868. * @expose
  28869. */
  28870. BuilderPrototype.reset = function() {
  28871. this.ptr = this.ns;
  28872. return this;
  28873. };
  28874. /**
  28875. * Defines a namespace on top of the current pointer position and places the pointer on it.
  28876. * @param {string} namespace
  28877. * @return {!ProtoBuf.Builder} this
  28878. * @expose
  28879. */
  28880. BuilderPrototype.define = function(namespace) {
  28881. if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
  28882. throw Error("illegal namespace: "+namespace);
  28883. namespace.split(".").forEach(function(part) {
  28884. var ns = this.ptr.getChild(part);
  28885. if (ns === null) // Keep existing
  28886. this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
  28887. this.ptr = ns;
  28888. }, this);
  28889. return this;
  28890. };
  28891. /**
  28892. * Creates the specified definitions at the current pointer position.
  28893. * @param {!Array.<!Object>} defs Messages, enums or services to create
  28894. * @returns {!ProtoBuf.Builder} this
  28895. * @throws {Error} If a message definition is invalid
  28896. * @expose
  28897. */
  28898. BuilderPrototype.create = function(defs) {
  28899. if (!defs)
  28900. return this; // Nothing to create
  28901. if (!Array.isArray(defs))
  28902. defs = [defs];
  28903. else {
  28904. if (defs.length === 0)
  28905. return this;
  28906. defs = defs.slice();
  28907. }
  28908. // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
  28909. var stack = [defs];
  28910. while (stack.length > 0) {
  28911. defs = stack.pop();
  28912. if (!Array.isArray(defs)) // Stack always contains entire namespaces
  28913. throw Error("not a valid namespace: "+JSON.stringify(defs));
  28914. while (defs.length > 0) {
  28915. var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
  28916. if (Builder.isMessage(def)) {
  28917. var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
  28918. // Create OneOfs
  28919. var oneofs = {};
  28920. if (def["oneofs"])
  28921. Object.keys(def["oneofs"]).forEach(function(name) {
  28922. obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
  28923. }, this);
  28924. // Create fields
  28925. if (def["fields"])
  28926. def["fields"].forEach(function(fld) {
  28927. if (obj.getChild(fld["id"]|0) !== null)
  28928. throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
  28929. if (fld["options"] && typeof fld["options"] !== 'object')
  28930. throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
  28931. var oneof = null;
  28932. if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
  28933. throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
  28934. fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
  28935. if (oneof)
  28936. oneof.fields.push(fld);
  28937. obj.addChild(fld);
  28938. }, this);
  28939. // Push children to stack
  28940. var subObj = [];
  28941. if (def["enums"])
  28942. def["enums"].forEach(function(enm) {
  28943. subObj.push(enm);
  28944. });
  28945. if (def["messages"])
  28946. def["messages"].forEach(function(msg) {
  28947. subObj.push(msg);
  28948. });
  28949. if (def["services"])
  28950. def["services"].forEach(function(svc) {
  28951. subObj.push(svc);
  28952. });
  28953. // Set extension ranges
  28954. if (def["extensions"]) {
  28955. if (typeof def["extensions"][0] === 'number') // pre 5.0.1
  28956. obj.extensions = [ def["extensions"] ];
  28957. else
  28958. obj.extensions = def["extensions"];
  28959. }
  28960. // Create on top of current namespace
  28961. this.ptr.addChild(obj);
  28962. if (subObj.length > 0) {
  28963. stack.push(defs); // Push the current level back
  28964. defs = subObj; // Continue processing sub level
  28965. subObj = null;
  28966. this.ptr = obj; // And move the pointer to this namespace
  28967. obj = null;
  28968. continue;
  28969. }
  28970. subObj = null;
  28971. } else if (Builder.isEnum(def)) {
  28972. obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
  28973. def["values"].forEach(function(val) {
  28974. obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
  28975. }, this);
  28976. this.ptr.addChild(obj);
  28977. } else if (Builder.isService(def)) {
  28978. obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
  28979. Object.keys(def["rpc"]).forEach(function(name) {
  28980. var mtd = def["rpc"][name];
  28981. obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
  28982. }, this);
  28983. this.ptr.addChild(obj);
  28984. } else if (Builder.isExtend(def)) {
  28985. obj = this.ptr.resolve(def["ref"], true);
  28986. if (obj) {
  28987. def["fields"].forEach(function(fld) {
  28988. if (obj.getChild(fld['id']|0) !== null)
  28989. throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
  28990. // Check if field id is allowed to be extended
  28991. if (obj.extensions) {
  28992. var valid = false;
  28993. obj.extensions.forEach(function(range) {
  28994. if (fld["id"] >= range[0] && fld["id"] <= range[1])
  28995. valid = true;
  28996. });
  28997. if (!valid)
  28998. throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
  28999. }
  29000. // Convert extension field names to camel case notation if the override is set
  29001. var name = fld["name"];
  29002. if (this.options['convertFieldsToCamelCase'])
  29003. name = ProtoBuf.Util.toCamelCase(name);
  29004. // see #161: Extensions use their fully qualified name as their runtime key and...
  29005. var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
  29006. // ...are added on top of the current namespace as an extension which is used for
  29007. // resolving their type later on (the extension always keeps the original name to
  29008. // prevent naming collisions)
  29009. var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
  29010. field.extension = ext;
  29011. this.ptr.addChild(ext);
  29012. obj.addChild(field);
  29013. }, this);
  29014. } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
  29015. throw Error("extended message "+def["ref"]+" is not defined");
  29016. } else
  29017. throw Error("not a valid definition: "+JSON.stringify(def));
  29018. def = null;
  29019. obj = null;
  29020. }
  29021. // Break goes here
  29022. defs = null;
  29023. this.ptr = this.ptr.parent; // Namespace done, continue at parent
  29024. }
  29025. this.resolved = false; // Require re-resolve
  29026. this.result = null; // Require re-build
  29027. return this;
  29028. };
  29029. /**
  29030. * Propagates syntax to all children.
  29031. * @param {!Object} parent
  29032. * @inner
  29033. */
  29034. function propagateSyntax(parent) {
  29035. if (parent['messages']) {
  29036. parent['messages'].forEach(function(child) {
  29037. child["syntax"] = parent["syntax"];
  29038. propagateSyntax(child);
  29039. });
  29040. }
  29041. if (parent['enums']) {
  29042. parent['enums'].forEach(function(child) {
  29043. child["syntax"] = parent["syntax"];
  29044. });
  29045. }
  29046. }
  29047. /**
  29048. * Imports another definition into this builder.
  29049. * @param {Object.<string,*>} json Parsed import
  29050. * @param {(string|{root: string, file: string})=} filename Imported file name
  29051. * @returns {!ProtoBuf.Builder} this
  29052. * @throws {Error} If the definition or file cannot be imported
  29053. * @expose
  29054. */
  29055. BuilderPrototype["import"] = function(json, filename) {
  29056. var delim = '/';
  29057. // Make sure to skip duplicate imports
  29058. if (typeof filename === 'string') {
  29059. if (ProtoBuf.Util.IS_NODE)
  29060. filename = __webpack_require__(117)['resolve'](filename);
  29061. if (this.files[filename] === true)
  29062. return this.reset();
  29063. this.files[filename] = true;
  29064. } else if (typeof filename === 'object') { // Object with root, file.
  29065. var root = filename.root;
  29066. if (ProtoBuf.Util.IS_NODE)
  29067. root = __webpack_require__(117)['resolve'](root);
  29068. if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
  29069. delim = '\\';
  29070. var fname;
  29071. if (ProtoBuf.Util.IS_NODE)
  29072. fname = __webpack_require__(117)['join'](root, filename.file);
  29073. else
  29074. fname = root + delim + filename.file;
  29075. if (this.files[fname] === true)
  29076. return this.reset();
  29077. this.files[fname] = true;
  29078. }
  29079. // Import imports
  29080. if (json['imports'] && json['imports'].length > 0) {
  29081. var importRoot,
  29082. resetRoot = false;
  29083. if (typeof filename === 'object') { // If an import root is specified, override
  29084. this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
  29085. importRoot = this.importRoot;
  29086. filename = filename["file"];
  29087. if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
  29088. delim = '\\';
  29089. } else if (typeof filename === 'string') {
  29090. if (this.importRoot) // If import root is overridden, use it
  29091. importRoot = this.importRoot;
  29092. else { // Otherwise compute from filename
  29093. if (filename.indexOf("/") >= 0) { // Unix
  29094. importRoot = filename.replace(/\/[^\/]*$/, "");
  29095. if (/* /file.proto */ importRoot === "")
  29096. importRoot = "/";
  29097. } else if (filename.indexOf("\\") >= 0) { // Windows
  29098. importRoot = filename.replace(/\\[^\\]*$/, "");
  29099. delim = '\\';
  29100. } else
  29101. importRoot = ".";
  29102. }
  29103. } else
  29104. importRoot = null;
  29105. for (var i=0; i<json['imports'].length; i++) {
  29106. if (typeof json['imports'][i] === 'string') { // Import file
  29107. if (!importRoot)
  29108. throw Error("cannot determine import root");
  29109. var importFilename = json['imports'][i];
  29110. if (importFilename === "google/protobuf/descriptor.proto")
  29111. continue; // Not needed and therefore not used
  29112. if (ProtoBuf.Util.IS_NODE)
  29113. importFilename = __webpack_require__(117)['join'](importRoot, importFilename);
  29114. else
  29115. importFilename = importRoot + delim + importFilename;
  29116. if (this.files[importFilename] === true)
  29117. continue; // Already imported
  29118. if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
  29119. importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
  29120. var contents = ProtoBuf.Util.fetch(importFilename);
  29121. if (contents === null)
  29122. throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
  29123. if (/\.json$/i.test(importFilename)) // Always possible
  29124. this["import"](JSON.parse(contents+""), importFilename); // May throw
  29125. else
  29126. this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
  29127. } else // Import structure
  29128. if (!filename)
  29129. this["import"](json['imports'][i]);
  29130. else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
  29131. this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
  29132. else // Without extension: Append _importN to make it unique
  29133. this["import"](json['imports'][i], filename+"_import"+i);
  29134. }
  29135. if (resetRoot) // Reset import root override when all imports are done
  29136. this.importRoot = null;
  29137. }
  29138. // Import structures
  29139. if (json['package'])
  29140. this.define(json['package']);
  29141. if (json['syntax'])
  29142. propagateSyntax(json);
  29143. var base = this.ptr;
  29144. if (json['options'])
  29145. Object.keys(json['options']).forEach(function(key) {
  29146. base.options[key] = json['options'][key];
  29147. });
  29148. if (json['messages'])
  29149. this.create(json['messages']),
  29150. this.ptr = base;
  29151. if (json['enums'])
  29152. this.create(json['enums']),
  29153. this.ptr = base;
  29154. if (json['services'])
  29155. this.create(json['services']),
  29156. this.ptr = base;
  29157. if (json['extends'])
  29158. this.create(json['extends']);
  29159. return this.reset();
  29160. };
  29161. /**
  29162. * Resolves all namespace objects.
  29163. * @throws {Error} If a type cannot be resolved
  29164. * @returns {!ProtoBuf.Builder} this
  29165. * @expose
  29166. */
  29167. BuilderPrototype.resolveAll = function() {
  29168. // Resolve all reflected objects
  29169. var res;
  29170. if (this.ptr == null || typeof this.ptr.type === 'object')
  29171. return this; // Done (already resolved)
  29172. if (this.ptr instanceof Reflect.Namespace) { // Resolve children
  29173. this.ptr.children.forEach(function(child) {
  29174. this.ptr = child;
  29175. this.resolveAll();
  29176. }, this);
  29177. } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
  29178. if (!Lang.TYPE.test(this.ptr.type)) {
  29179. if (!Lang.TYPEREF.test(this.ptr.type))
  29180. throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
  29181. res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
  29182. if (!res)
  29183. throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
  29184. this.ptr.resolvedType = res;
  29185. if (res instanceof Reflect.Enum) {
  29186. this.ptr.type = ProtoBuf.TYPES["enum"];
  29187. if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
  29188. throw Error("proto3 message cannot reference proto2 enum");
  29189. }
  29190. else if (res instanceof Reflect.Message)
  29191. this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
  29192. else
  29193. throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
  29194. } else
  29195. this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
  29196. // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
  29197. // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
  29198. if (this.ptr.map) {
  29199. if (!Lang.TYPE.test(this.ptr.keyType))
  29200. throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
  29201. this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
  29202. }
  29203. // If it's a repeated and packable field then proto3 mandates it should be packed by
  29204. // default
  29205. if (
  29206. this.ptr.syntax === 'proto3' &&
  29207. this.ptr.repeated && this.ptr.options.packed === undefined &&
  29208. ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
  29209. ) {
  29210. this.ptr.options.packed = true;
  29211. }
  29212. } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
  29213. if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
  29214. res = this.ptr.parent.resolve(this.ptr.requestName, true);
  29215. if (!res || !(res instanceof ProtoBuf.Reflect.Message))
  29216. throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
  29217. this.ptr.resolvedRequestType = res;
  29218. res = this.ptr.parent.resolve(this.ptr.responseName, true);
  29219. if (!res || !(res instanceof ProtoBuf.Reflect.Message))
  29220. throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
  29221. this.ptr.resolvedResponseType = res;
  29222. } else // Should not happen as nothing else is implemented
  29223. throw Error("illegal service type in "+this.ptr.toString(true));
  29224. } else if (
  29225. !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
  29226. !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
  29227. !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
  29228. )
  29229. throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
  29230. return this.reset();
  29231. };
  29232. /**
  29233. * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
  29234. * return the built package.
  29235. * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
  29236. * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
  29237. * @throws {Error} If a type could not be resolved
  29238. * @expose
  29239. */
  29240. BuilderPrototype.build = function(path) {
  29241. this.reset();
  29242. if (!this.resolved)
  29243. this.resolveAll(),
  29244. this.resolved = true,
  29245. this.result = null; // Require re-build
  29246. if (this.result === null) // (Re-)Build
  29247. this.result = this.ns.build();
  29248. if (!path)
  29249. return this.result;
  29250. var part = typeof path === 'string' ? path.split(".") : path,
  29251. ptr = this.result; // Build namespace pointer (no hasChild etc.)
  29252. for (var i=0; i<part.length; i++)
  29253. if (ptr[part[i]])
  29254. ptr = ptr[part[i]];
  29255. else {
  29256. ptr = null;
  29257. break;
  29258. }
  29259. return ptr;
  29260. };
  29261. /**
  29262. * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
  29263. * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
  29264. * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
  29265. * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
  29266. */
  29267. BuilderPrototype.lookup = function(path, excludeNonNamespace) {
  29268. return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
  29269. };
  29270. /**
  29271. * Returns a string representation of this object.
  29272. * @return {string} String representation as of "Builder"
  29273. * @expose
  29274. */
  29275. BuilderPrototype.toString = function() {
  29276. return "Builder";
  29277. };
  29278. // ----- Base classes -----
  29279. // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
  29280. /**
  29281. * @alias ProtoBuf.Builder.Message
  29282. */
  29283. Builder.Message = function() {};
  29284. /**
  29285. * @alias ProtoBuf.Builder.Enum
  29286. */
  29287. Builder.Enum = function() {};
  29288. /**
  29289. * @alias ProtoBuf.Builder.Message
  29290. */
  29291. Builder.Service = function() {};
  29292. return Builder;
  29293. })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
  29294. /**
  29295. * @alias ProtoBuf.Map
  29296. * @expose
  29297. */
  29298. ProtoBuf.Map = (function(ProtoBuf, Reflect) {
  29299. "use strict";
  29300. /**
  29301. * Constructs a new Map. A Map is a container that is used to implement map
  29302. * fields on message objects. It closely follows the ES6 Map API; however,
  29303. * it is distinct because we do not want to depend on external polyfills or
  29304. * on ES6 itself.
  29305. *
  29306. * @exports ProtoBuf.Map
  29307. * @param {!ProtoBuf.Reflect.Field} field Map field
  29308. * @param {Object.<string,*>=} contents Initial contents
  29309. * @constructor
  29310. */
  29311. var Map = function(field, contents) {
  29312. if (!field.map)
  29313. throw Error("field is not a map");
  29314. /**
  29315. * The field corresponding to this map.
  29316. * @type {!ProtoBuf.Reflect.Field}
  29317. */
  29318. this.field = field;
  29319. /**
  29320. * Element instance corresponding to key type.
  29321. * @type {!ProtoBuf.Reflect.Element}
  29322. */
  29323. this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
  29324. /**
  29325. * Element instance corresponding to value type.
  29326. * @type {!ProtoBuf.Reflect.Element}
  29327. */
  29328. this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
  29329. /**
  29330. * Internal map: stores mapping of (string form of key) -> (key, value)
  29331. * pair.
  29332. *
  29333. * We provide map semantics for arbitrary key types, but we build on top
  29334. * of an Object, which has only string keys. In order to avoid the need
  29335. * to convert a string key back to its native type in many situations,
  29336. * we store the native key value alongside the value. Thus, we only need
  29337. * a one-way mapping from a key type to its string form that guarantees
  29338. * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
  29339. * === K2).
  29340. *
  29341. * @type {!Object<string, {key: *, value: *}>}
  29342. */
  29343. this.map = {};
  29344. /**
  29345. * Returns the number of elements in the map.
  29346. */
  29347. Object.defineProperty(this, "size", {
  29348. get: function() { return Object.keys(this.map).length; }
  29349. });
  29350. // Fill initial contents from a raw object.
  29351. if (contents) {
  29352. var keys = Object.keys(contents);
  29353. for (var i = 0; i < keys.length; i++) {
  29354. var key = this.keyElem.valueFromString(keys[i]);
  29355. var val = this.valueElem.verifyValue(contents[keys[i]]);
  29356. this.map[this.keyElem.valueToString(key)] =
  29357. { key: key, value: val };
  29358. }
  29359. }
  29360. };
  29361. var MapPrototype = Map.prototype;
  29362. /**
  29363. * Helper: return an iterator over an array.
  29364. * @param {!Array<*>} arr the array
  29365. * @returns {!Object} an iterator
  29366. * @inner
  29367. */
  29368. function arrayIterator(arr) {
  29369. var idx = 0;
  29370. return {
  29371. next: function() {
  29372. if (idx < arr.length)
  29373. return { done: false, value: arr[idx++] };
  29374. return { done: true };
  29375. }
  29376. }
  29377. }
  29378. /**
  29379. * Clears the map.
  29380. */
  29381. MapPrototype.clear = function() {
  29382. this.map = {};
  29383. };
  29384. /**
  29385. * Deletes a particular key from the map.
  29386. * @returns {boolean} Whether any entry with this key was deleted.
  29387. */
  29388. MapPrototype["delete"] = function(key) {
  29389. var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
  29390. var hadKey = keyValue in this.map;
  29391. delete this.map[keyValue];
  29392. return hadKey;
  29393. };
  29394. /**
  29395. * Returns an iterator over [key, value] pairs in the map.
  29396. * @returns {Object} The iterator
  29397. */
  29398. MapPrototype.entries = function() {
  29399. var entries = [];
  29400. var strKeys = Object.keys(this.map);
  29401. for (var i = 0, entry; i < strKeys.length; i++)
  29402. entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
  29403. return arrayIterator(entries);
  29404. };
  29405. /**
  29406. * Returns an iterator over keys in the map.
  29407. * @returns {Object} The iterator
  29408. */
  29409. MapPrototype.keys = function() {
  29410. var keys = [];
  29411. var strKeys = Object.keys(this.map);
  29412. for (var i = 0; i < strKeys.length; i++)
  29413. keys.push(this.map[strKeys[i]].key);
  29414. return arrayIterator(keys);
  29415. };
  29416. /**
  29417. * Returns an iterator over values in the map.
  29418. * @returns {!Object} The iterator
  29419. */
  29420. MapPrototype.values = function() {
  29421. var values = [];
  29422. var strKeys = Object.keys(this.map);
  29423. for (var i = 0; i < strKeys.length; i++)
  29424. values.push(this.map[strKeys[i]].value);
  29425. return arrayIterator(values);
  29426. };
  29427. /**
  29428. * Iterates over entries in the map, calling a function on each.
  29429. * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
  29430. * @param {Object=} thisArg The `this` value for the callback
  29431. */
  29432. MapPrototype.forEach = function(cb, thisArg) {
  29433. var strKeys = Object.keys(this.map);
  29434. for (var i = 0, entry; i < strKeys.length; i++)
  29435. cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
  29436. };
  29437. /**
  29438. * Sets a key in the map to the given value.
  29439. * @param {*} key The key
  29440. * @param {*} value The value
  29441. * @returns {!ProtoBuf.Map} The map instance
  29442. */
  29443. MapPrototype.set = function(key, value) {
  29444. var keyValue = this.keyElem.verifyValue(key);
  29445. var valValue = this.valueElem.verifyValue(value);
  29446. this.map[this.keyElem.valueToString(keyValue)] =
  29447. { key: keyValue, value: valValue };
  29448. return this;
  29449. };
  29450. /**
  29451. * Gets the value corresponding to a key in the map.
  29452. * @param {*} key The key
  29453. * @returns {*|undefined} The value, or `undefined` if key not present
  29454. */
  29455. MapPrototype.get = function(key) {
  29456. var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
  29457. if (!(keyValue in this.map))
  29458. return undefined;
  29459. return this.map[keyValue].value;
  29460. };
  29461. /**
  29462. * Determines whether the given key is present in the map.
  29463. * @param {*} key The key
  29464. * @returns {boolean} `true` if the key is present
  29465. */
  29466. MapPrototype.has = function(key) {
  29467. var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
  29468. return (keyValue in this.map);
  29469. };
  29470. return Map;
  29471. })(ProtoBuf, ProtoBuf.Reflect);
  29472. /**
  29473. * Constructs a new empty Builder.
  29474. * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
  29475. * @return {!ProtoBuf.Builder} Builder
  29476. * @expose
  29477. */
  29478. ProtoBuf.newBuilder = function(options) {
  29479. options = options || {};
  29480. if (typeof options['convertFieldsToCamelCase'] === 'undefined')
  29481. options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
  29482. if (typeof options['populateAccessors'] === 'undefined')
  29483. options['populateAccessors'] = ProtoBuf.populateAccessors;
  29484. return new ProtoBuf.Builder(options);
  29485. };
  29486. /**
  29487. * Loads a .json definition and returns the Builder.
  29488. * @param {!*|string} json JSON definition
  29489. * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
  29490. * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
  29491. * @return {ProtoBuf.Builder} Builder to create new messages
  29492. * @throws {Error} If the definition cannot be parsed or built
  29493. * @expose
  29494. */
  29495. ProtoBuf.loadJson = function(json, builder, filename) {
  29496. if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
  29497. filename = builder,
  29498. builder = null;
  29499. if (!builder || typeof builder !== 'object')
  29500. builder = ProtoBuf.newBuilder();
  29501. if (typeof json === 'string')
  29502. json = JSON.parse(json);
  29503. builder["import"](json, filename);
  29504. builder.resolveAll();
  29505. return builder;
  29506. };
  29507. /**
  29508. * Loads a .json file and returns the Builder.
  29509. * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
  29510. * an overridden 'root' path for all imported files.
  29511. * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
  29512. * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
  29513. * file will be read synchronously and this function will return the Builder.
  29514. * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
  29515. * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
  29516. * request has failed), else undefined
  29517. * @expose
  29518. */
  29519. ProtoBuf.loadJsonFile = function(filename, callback, builder) {
  29520. if (callback && typeof callback === 'object')
  29521. builder = callback,
  29522. callback = null;
  29523. else if (!callback || typeof callback !== 'function')
  29524. callback = null;
  29525. if (callback)
  29526. return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
  29527. if (contents === null) {
  29528. callback(Error("Failed to fetch file"));
  29529. return;
  29530. }
  29531. try {
  29532. callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
  29533. } catch (e) {
  29534. callback(e);
  29535. }
  29536. });
  29537. var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
  29538. return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
  29539. };
  29540. return ProtoBuf;
  29541. });
  29542. /***/ }),
  29543. /* 613 */
  29544. /***/ (function(module, exports, __webpack_require__) {
  29545. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
  29546. Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
  29547. Licensed under the Apache License, Version 2.0 (the "License");
  29548. you may not use this file except in compliance with the License.
  29549. You may obtain a copy of the License at
  29550. http://www.apache.org/licenses/LICENSE-2.0
  29551. Unless required by applicable law or agreed to in writing, software
  29552. distributed under the License is distributed on an "AS IS" BASIS,
  29553. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  29554. See the License for the specific language governing permissions and
  29555. limitations under the License.
  29556. */
  29557. /**
  29558. * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
  29559. * Backing buffer: ArrayBuffer, Accessor: Uint8Array
  29560. * Released under the Apache License, Version 2.0
  29561. * see: https://github.com/dcodeIO/bytebuffer.js for details
  29562. */
  29563. (function(global, factory) {
  29564. /* AMD */ if (true)
  29565. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(614)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  29566. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  29567. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  29568. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  29569. /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
  29570. module['exports'] = (function() {
  29571. var Long; try { Long = require("long"); } catch (e) {}
  29572. return factory(Long);
  29573. })();
  29574. /* Global */ else
  29575. (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
  29576. })(this, function(Long) {
  29577. "use strict";
  29578. /**
  29579. * Constructs a new ByteBuffer.
  29580. * @class The swiss army knife for binary data in JavaScript.
  29581. * @exports ByteBuffer
  29582. * @constructor
  29583. * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
  29584. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  29585. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  29586. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  29587. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  29588. * @expose
  29589. */
  29590. var ByteBuffer = function(capacity, littleEndian, noAssert) {
  29591. if (typeof capacity === 'undefined')
  29592. capacity = ByteBuffer.DEFAULT_CAPACITY;
  29593. if (typeof littleEndian === 'undefined')
  29594. littleEndian = ByteBuffer.DEFAULT_ENDIAN;
  29595. if (typeof noAssert === 'undefined')
  29596. noAssert = ByteBuffer.DEFAULT_NOASSERT;
  29597. if (!noAssert) {
  29598. capacity = capacity | 0;
  29599. if (capacity < 0)
  29600. throw RangeError("Illegal capacity");
  29601. littleEndian = !!littleEndian;
  29602. noAssert = !!noAssert;
  29603. }
  29604. /**
  29605. * Backing ArrayBuffer.
  29606. * @type {!ArrayBuffer}
  29607. * @expose
  29608. */
  29609. this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
  29610. /**
  29611. * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
  29612. * @type {?Uint8Array}
  29613. * @expose
  29614. */
  29615. this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
  29616. /**
  29617. * Absolute read/write offset.
  29618. * @type {number}
  29619. * @expose
  29620. * @see ByteBuffer#flip
  29621. * @see ByteBuffer#clear
  29622. */
  29623. this.offset = 0;
  29624. /**
  29625. * Marked offset.
  29626. * @type {number}
  29627. * @expose
  29628. * @see ByteBuffer#mark
  29629. * @see ByteBuffer#reset
  29630. */
  29631. this.markedOffset = -1;
  29632. /**
  29633. * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
  29634. * @type {number}
  29635. * @expose
  29636. * @see ByteBuffer#flip
  29637. * @see ByteBuffer#clear
  29638. */
  29639. this.limit = capacity;
  29640. /**
  29641. * Whether to use little endian byte order, defaults to `false` for big endian.
  29642. * @type {boolean}
  29643. * @expose
  29644. */
  29645. this.littleEndian = littleEndian;
  29646. /**
  29647. * Whether to skip assertions of offsets and values, defaults to `false`.
  29648. * @type {boolean}
  29649. * @expose
  29650. */
  29651. this.noAssert = noAssert;
  29652. };
  29653. /**
  29654. * ByteBuffer version.
  29655. * @type {string}
  29656. * @const
  29657. * @expose
  29658. */
  29659. ByteBuffer.VERSION = "5.0.1";
  29660. /**
  29661. * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
  29662. * @type {boolean}
  29663. * @const
  29664. * @expose
  29665. */
  29666. ByteBuffer.LITTLE_ENDIAN = true;
  29667. /**
  29668. * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
  29669. * @type {boolean}
  29670. * @const
  29671. * @expose
  29672. */
  29673. ByteBuffer.BIG_ENDIAN = false;
  29674. /**
  29675. * Default initial capacity of `16`.
  29676. * @type {number}
  29677. * @expose
  29678. */
  29679. ByteBuffer.DEFAULT_CAPACITY = 16;
  29680. /**
  29681. * Default endianess of `false` for big endian.
  29682. * @type {boolean}
  29683. * @expose
  29684. */
  29685. ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
  29686. /**
  29687. * Default no assertions flag of `false`.
  29688. * @type {boolean}
  29689. * @expose
  29690. */
  29691. ByteBuffer.DEFAULT_NOASSERT = false;
  29692. /**
  29693. * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
  29694. * and int64 support is not available.
  29695. * @type {?Long}
  29696. * @const
  29697. * @see https://github.com/dcodeIO/long.js
  29698. * @expose
  29699. */
  29700. ByteBuffer.Long = Long || null;
  29701. /**
  29702. * @alias ByteBuffer.prototype
  29703. * @inner
  29704. */
  29705. var ByteBufferPrototype = ByteBuffer.prototype;
  29706. /**
  29707. * An indicator used to reliably determine if an object is a ByteBuffer or not.
  29708. * @type {boolean}
  29709. * @const
  29710. * @expose
  29711. * @private
  29712. */
  29713. ByteBufferPrototype.__isByteBuffer__;
  29714. Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
  29715. value: true,
  29716. enumerable: false,
  29717. configurable: false
  29718. });
  29719. // helpers
  29720. /**
  29721. * @type {!ArrayBuffer}
  29722. * @inner
  29723. */
  29724. var EMPTY_BUFFER = new ArrayBuffer(0);
  29725. /**
  29726. * String.fromCharCode reference for compile-time renaming.
  29727. * @type {function(...number):string}
  29728. * @inner
  29729. */
  29730. var stringFromCharCode = String.fromCharCode;
  29731. /**
  29732. * Creates a source function for a string.
  29733. * @param {string} s String to read from
  29734. * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
  29735. * no more characters left.
  29736. * @throws {TypeError} If the argument is invalid
  29737. * @inner
  29738. */
  29739. function stringSource(s) {
  29740. var i=0; return function() {
  29741. return i < s.length ? s.charCodeAt(i++) : null;
  29742. };
  29743. }
  29744. /**
  29745. * Creates a destination function for a string.
  29746. * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
  29747. * Returns the final string when called without arguments.
  29748. * @inner
  29749. */
  29750. function stringDestination() {
  29751. var cs = [], ps = []; return function() {
  29752. if (arguments.length === 0)
  29753. return ps.join('')+stringFromCharCode.apply(String, cs);
  29754. if (cs.length + arguments.length > 1024)
  29755. ps.push(stringFromCharCode.apply(String, cs)),
  29756. cs.length = 0;
  29757. Array.prototype.push.apply(cs, arguments);
  29758. };
  29759. }
  29760. /**
  29761. * Gets the accessor type.
  29762. * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
  29763. * @expose
  29764. */
  29765. ByteBuffer.accessor = function() {
  29766. return Uint8Array;
  29767. };
  29768. /**
  29769. * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
  29770. * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
  29771. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  29772. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  29773. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  29774. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  29775. * @returns {!ByteBuffer}
  29776. * @expose
  29777. */
  29778. ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
  29779. return new ByteBuffer(capacity, littleEndian, noAssert);
  29780. };
  29781. /**
  29782. * Concatenates multiple ByteBuffers into one.
  29783. * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
  29784. * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
  29785. * defaults to "utf8")
  29786. * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
  29787. * to {@link ByteBuffer.DEFAULT_ENDIAN}.
  29788. * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
  29789. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  29790. * @returns {!ByteBuffer} Concatenated ByteBuffer
  29791. * @expose
  29792. */
  29793. ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
  29794. if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
  29795. noAssert = littleEndian;
  29796. littleEndian = encoding;
  29797. encoding = undefined;
  29798. }
  29799. var capacity = 0;
  29800. for (var i=0, k=buffers.length, length; i<k; ++i) {
  29801. if (!ByteBuffer.isByteBuffer(buffers[i]))
  29802. buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
  29803. length = buffers[i].limit - buffers[i].offset;
  29804. if (length > 0) capacity += length;
  29805. }
  29806. if (capacity === 0)
  29807. return new ByteBuffer(0, littleEndian, noAssert);
  29808. var bb = new ByteBuffer(capacity, littleEndian, noAssert),
  29809. bi;
  29810. i=0; while (i<k) {
  29811. bi = buffers[i++];
  29812. length = bi.limit - bi.offset;
  29813. if (length <= 0) continue;
  29814. bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
  29815. bb.offset += length;
  29816. }
  29817. bb.limit = bb.offset;
  29818. bb.offset = 0;
  29819. return bb;
  29820. };
  29821. /**
  29822. * Tests if the specified type is a ByteBuffer.
  29823. * @param {*} bb ByteBuffer to test
  29824. * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
  29825. * @expose
  29826. */
  29827. ByteBuffer.isByteBuffer = function(bb) {
  29828. return (bb && bb["__isByteBuffer__"]) === true;
  29829. };
  29830. /**
  29831. * Gets the backing buffer type.
  29832. * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
  29833. * @expose
  29834. */
  29835. ByteBuffer.type = function() {
  29836. return ArrayBuffer;
  29837. };
  29838. /**
  29839. * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
  29840. * {@link ByteBuffer#limit} to the length of the wrapped data.
  29841. * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
  29842. * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
  29843. * "utf8")
  29844. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  29845. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  29846. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  29847. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  29848. * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
  29849. * @expose
  29850. */
  29851. ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
  29852. if (typeof encoding !== 'string') {
  29853. noAssert = littleEndian;
  29854. littleEndian = encoding;
  29855. encoding = undefined;
  29856. }
  29857. if (typeof buffer === 'string') {
  29858. if (typeof encoding === 'undefined')
  29859. encoding = "utf8";
  29860. switch (encoding) {
  29861. case "base64":
  29862. return ByteBuffer.fromBase64(buffer, littleEndian);
  29863. case "hex":
  29864. return ByteBuffer.fromHex(buffer, littleEndian);
  29865. case "binary":
  29866. return ByteBuffer.fromBinary(buffer, littleEndian);
  29867. case "utf8":
  29868. return ByteBuffer.fromUTF8(buffer, littleEndian);
  29869. case "debug":
  29870. return ByteBuffer.fromDebug(buffer, littleEndian);
  29871. default:
  29872. throw Error("Unsupported encoding: "+encoding);
  29873. }
  29874. }
  29875. if (buffer === null || typeof buffer !== 'object')
  29876. throw TypeError("Illegal buffer");
  29877. var bb;
  29878. if (ByteBuffer.isByteBuffer(buffer)) {
  29879. bb = ByteBufferPrototype.clone.call(buffer);
  29880. bb.markedOffset = -1;
  29881. return bb;
  29882. }
  29883. if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
  29884. bb = new ByteBuffer(0, littleEndian, noAssert);
  29885. if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
  29886. bb.buffer = buffer.buffer;
  29887. bb.offset = buffer.byteOffset;
  29888. bb.limit = buffer.byteOffset + buffer.byteLength;
  29889. bb.view = new Uint8Array(buffer.buffer);
  29890. }
  29891. } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
  29892. bb = new ByteBuffer(0, littleEndian, noAssert);
  29893. if (buffer.byteLength > 0) {
  29894. bb.buffer = buffer;
  29895. bb.offset = 0;
  29896. bb.limit = buffer.byteLength;
  29897. bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
  29898. }
  29899. } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
  29900. bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
  29901. bb.limit = buffer.length;
  29902. for (var i=0; i<buffer.length; ++i)
  29903. bb.view[i] = buffer[i];
  29904. } else
  29905. throw TypeError("Illegal buffer"); // Otherwise fail
  29906. return bb;
  29907. };
  29908. /**
  29909. * Writes the array as a bitset.
  29910. * @param {Array<boolean>} value Array of booleans to write
  29911. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
  29912. * @returns {!ByteBuffer}
  29913. * @expose
  29914. */
  29915. ByteBufferPrototype.writeBitSet = function(value, offset) {
  29916. var relative = typeof offset === 'undefined';
  29917. if (relative) offset = this.offset;
  29918. if (!this.noAssert) {
  29919. if (!(value instanceof Array))
  29920. throw TypeError("Illegal BitSet: Not an array");
  29921. if (typeof offset !== 'number' || offset % 1 !== 0)
  29922. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  29923. offset >>>= 0;
  29924. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  29925. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  29926. }
  29927. var start = offset,
  29928. bits = value.length,
  29929. bytes = (bits >> 3),
  29930. bit = 0,
  29931. k;
  29932. offset += this.writeVarint32(bits,offset);
  29933. while(bytes--) {
  29934. k = (!!value[bit++] & 1) |
  29935. ((!!value[bit++] & 1) << 1) |
  29936. ((!!value[bit++] & 1) << 2) |
  29937. ((!!value[bit++] & 1) << 3) |
  29938. ((!!value[bit++] & 1) << 4) |
  29939. ((!!value[bit++] & 1) << 5) |
  29940. ((!!value[bit++] & 1) << 6) |
  29941. ((!!value[bit++] & 1) << 7);
  29942. this.writeByte(k,offset++);
  29943. }
  29944. if(bit < bits) {
  29945. var m = 0; k = 0;
  29946. while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
  29947. this.writeByte(k,offset++);
  29948. }
  29949. if (relative) {
  29950. this.offset = offset;
  29951. return this;
  29952. }
  29953. return offset - start;
  29954. }
  29955. /**
  29956. * Reads a BitSet as an array of booleans.
  29957. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
  29958. * @returns {Array<boolean>
  29959. * @expose
  29960. */
  29961. ByteBufferPrototype.readBitSet = function(offset) {
  29962. var relative = typeof offset === 'undefined';
  29963. if (relative) offset = this.offset;
  29964. var ret = this.readVarint32(offset),
  29965. bits = ret.value,
  29966. bytes = (bits >> 3),
  29967. bit = 0,
  29968. value = [],
  29969. k;
  29970. offset += ret.length;
  29971. while(bytes--) {
  29972. k = this.readByte(offset++);
  29973. value[bit++] = !!(k & 0x01);
  29974. value[bit++] = !!(k & 0x02);
  29975. value[bit++] = !!(k & 0x04);
  29976. value[bit++] = !!(k & 0x08);
  29977. value[bit++] = !!(k & 0x10);
  29978. value[bit++] = !!(k & 0x20);
  29979. value[bit++] = !!(k & 0x40);
  29980. value[bit++] = !!(k & 0x80);
  29981. }
  29982. if(bit < bits) {
  29983. var m = 0;
  29984. k = this.readByte(offset++);
  29985. while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
  29986. }
  29987. if (relative) {
  29988. this.offset = offset;
  29989. }
  29990. return value;
  29991. }
  29992. /**
  29993. * Reads the specified number of bytes.
  29994. * @param {number} length Number of bytes to read
  29995. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
  29996. * @returns {!ByteBuffer}
  29997. * @expose
  29998. */
  29999. ByteBufferPrototype.readBytes = function(length, offset) {
  30000. var relative = typeof offset === 'undefined';
  30001. if (relative) offset = this.offset;
  30002. if (!this.noAssert) {
  30003. if (typeof offset !== 'number' || offset % 1 !== 0)
  30004. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30005. offset >>>= 0;
  30006. if (offset < 0 || offset + length > this.buffer.byteLength)
  30007. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
  30008. }
  30009. var slice = this.slice(offset, offset + length);
  30010. if (relative) this.offset += length;
  30011. return slice;
  30012. };
  30013. /**
  30014. * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
  30015. * @function
  30016. * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
  30017. * will be modified according to the performed read operation.
  30018. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
  30019. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  30020. * written if omitted.
  30021. * @returns {!ByteBuffer} this
  30022. * @expose
  30023. */
  30024. ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
  30025. // types/ints/int8
  30026. /**
  30027. * Writes an 8bit signed integer.
  30028. * @param {number} value Value to write
  30029. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30030. * @returns {!ByteBuffer} this
  30031. * @expose
  30032. */
  30033. ByteBufferPrototype.writeInt8 = function(value, offset) {
  30034. var relative = typeof offset === 'undefined';
  30035. if (relative) offset = this.offset;
  30036. if (!this.noAssert) {
  30037. if (typeof value !== 'number' || value % 1 !== 0)
  30038. throw TypeError("Illegal value: "+value+" (not an integer)");
  30039. value |= 0;
  30040. if (typeof offset !== 'number' || offset % 1 !== 0)
  30041. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30042. offset >>>= 0;
  30043. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30044. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30045. }
  30046. offset += 1;
  30047. var capacity0 = this.buffer.byteLength;
  30048. if (offset > capacity0)
  30049. this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
  30050. offset -= 1;
  30051. this.view[offset] = value;
  30052. if (relative) this.offset += 1;
  30053. return this;
  30054. };
  30055. /**
  30056. * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
  30057. * @function
  30058. * @param {number} value Value to write
  30059. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30060. * @returns {!ByteBuffer} this
  30061. * @expose
  30062. */
  30063. ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
  30064. /**
  30065. * Reads an 8bit signed integer.
  30066. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30067. * @returns {number} Value read
  30068. * @expose
  30069. */
  30070. ByteBufferPrototype.readInt8 = function(offset) {
  30071. var relative = typeof offset === 'undefined';
  30072. if (relative) offset = this.offset;
  30073. if (!this.noAssert) {
  30074. if (typeof offset !== 'number' || offset % 1 !== 0)
  30075. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30076. offset >>>= 0;
  30077. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  30078. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  30079. }
  30080. var value = this.view[offset];
  30081. if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
  30082. if (relative) this.offset += 1;
  30083. return value;
  30084. };
  30085. /**
  30086. * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
  30087. * @function
  30088. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30089. * @returns {number} Value read
  30090. * @expose
  30091. */
  30092. ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
  30093. /**
  30094. * Writes an 8bit unsigned integer.
  30095. * @param {number} value Value to write
  30096. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30097. * @returns {!ByteBuffer} this
  30098. * @expose
  30099. */
  30100. ByteBufferPrototype.writeUint8 = function(value, offset) {
  30101. var relative = typeof offset === 'undefined';
  30102. if (relative) offset = this.offset;
  30103. if (!this.noAssert) {
  30104. if (typeof value !== 'number' || value % 1 !== 0)
  30105. throw TypeError("Illegal value: "+value+" (not an integer)");
  30106. value >>>= 0;
  30107. if (typeof offset !== 'number' || offset % 1 !== 0)
  30108. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30109. offset >>>= 0;
  30110. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30111. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30112. }
  30113. offset += 1;
  30114. var capacity1 = this.buffer.byteLength;
  30115. if (offset > capacity1)
  30116. this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
  30117. offset -= 1;
  30118. this.view[offset] = value;
  30119. if (relative) this.offset += 1;
  30120. return this;
  30121. };
  30122. /**
  30123. * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
  30124. * @function
  30125. * @param {number} value Value to write
  30126. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30127. * @returns {!ByteBuffer} this
  30128. * @expose
  30129. */
  30130. ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
  30131. /**
  30132. * Reads an 8bit unsigned integer.
  30133. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30134. * @returns {number} Value read
  30135. * @expose
  30136. */
  30137. ByteBufferPrototype.readUint8 = function(offset) {
  30138. var relative = typeof offset === 'undefined';
  30139. if (relative) offset = this.offset;
  30140. if (!this.noAssert) {
  30141. if (typeof offset !== 'number' || offset % 1 !== 0)
  30142. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30143. offset >>>= 0;
  30144. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  30145. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  30146. }
  30147. var value = this.view[offset];
  30148. if (relative) this.offset += 1;
  30149. return value;
  30150. };
  30151. /**
  30152. * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
  30153. * @function
  30154. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  30155. * @returns {number} Value read
  30156. * @expose
  30157. */
  30158. ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
  30159. // types/ints/int16
  30160. /**
  30161. * Writes a 16bit signed integer.
  30162. * @param {number} value Value to write
  30163. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30164. * @throws {TypeError} If `offset` or `value` is not a valid number
  30165. * @throws {RangeError} If `offset` is out of bounds
  30166. * @expose
  30167. */
  30168. ByteBufferPrototype.writeInt16 = function(value, offset) {
  30169. var relative = typeof offset === 'undefined';
  30170. if (relative) offset = this.offset;
  30171. if (!this.noAssert) {
  30172. if (typeof value !== 'number' || value % 1 !== 0)
  30173. throw TypeError("Illegal value: "+value+" (not an integer)");
  30174. value |= 0;
  30175. if (typeof offset !== 'number' || offset % 1 !== 0)
  30176. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30177. offset >>>= 0;
  30178. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30179. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30180. }
  30181. offset += 2;
  30182. var capacity2 = this.buffer.byteLength;
  30183. if (offset > capacity2)
  30184. this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
  30185. offset -= 2;
  30186. if (this.littleEndian) {
  30187. this.view[offset+1] = (value & 0xFF00) >>> 8;
  30188. this.view[offset ] = value & 0x00FF;
  30189. } else {
  30190. this.view[offset] = (value & 0xFF00) >>> 8;
  30191. this.view[offset+1] = value & 0x00FF;
  30192. }
  30193. if (relative) this.offset += 2;
  30194. return this;
  30195. };
  30196. /**
  30197. * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
  30198. * @function
  30199. * @param {number} value Value to write
  30200. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30201. * @throws {TypeError} If `offset` or `value` is not a valid number
  30202. * @throws {RangeError} If `offset` is out of bounds
  30203. * @expose
  30204. */
  30205. ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
  30206. /**
  30207. * Reads a 16bit signed integer.
  30208. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30209. * @returns {number} Value read
  30210. * @throws {TypeError} If `offset` is not a valid number
  30211. * @throws {RangeError} If `offset` is out of bounds
  30212. * @expose
  30213. */
  30214. ByteBufferPrototype.readInt16 = function(offset) {
  30215. var relative = typeof offset === 'undefined';
  30216. if (relative) offset = this.offset;
  30217. if (!this.noAssert) {
  30218. if (typeof offset !== 'number' || offset % 1 !== 0)
  30219. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30220. offset >>>= 0;
  30221. if (offset < 0 || offset + 2 > this.buffer.byteLength)
  30222. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
  30223. }
  30224. var value = 0;
  30225. if (this.littleEndian) {
  30226. value = this.view[offset ];
  30227. value |= this.view[offset+1] << 8;
  30228. } else {
  30229. value = this.view[offset ] << 8;
  30230. value |= this.view[offset+1];
  30231. }
  30232. if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
  30233. if (relative) this.offset += 2;
  30234. return value;
  30235. };
  30236. /**
  30237. * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
  30238. * @function
  30239. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30240. * @returns {number} Value read
  30241. * @throws {TypeError} If `offset` is not a valid number
  30242. * @throws {RangeError} If `offset` is out of bounds
  30243. * @expose
  30244. */
  30245. ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
  30246. /**
  30247. * Writes a 16bit unsigned integer.
  30248. * @param {number} value Value to write
  30249. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30250. * @throws {TypeError} If `offset` or `value` is not a valid number
  30251. * @throws {RangeError} If `offset` is out of bounds
  30252. * @expose
  30253. */
  30254. ByteBufferPrototype.writeUint16 = function(value, offset) {
  30255. var relative = typeof offset === 'undefined';
  30256. if (relative) offset = this.offset;
  30257. if (!this.noAssert) {
  30258. if (typeof value !== 'number' || value % 1 !== 0)
  30259. throw TypeError("Illegal value: "+value+" (not an integer)");
  30260. value >>>= 0;
  30261. if (typeof offset !== 'number' || offset % 1 !== 0)
  30262. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30263. offset >>>= 0;
  30264. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30265. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30266. }
  30267. offset += 2;
  30268. var capacity3 = this.buffer.byteLength;
  30269. if (offset > capacity3)
  30270. this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
  30271. offset -= 2;
  30272. if (this.littleEndian) {
  30273. this.view[offset+1] = (value & 0xFF00) >>> 8;
  30274. this.view[offset ] = value & 0x00FF;
  30275. } else {
  30276. this.view[offset] = (value & 0xFF00) >>> 8;
  30277. this.view[offset+1] = value & 0x00FF;
  30278. }
  30279. if (relative) this.offset += 2;
  30280. return this;
  30281. };
  30282. /**
  30283. * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
  30284. * @function
  30285. * @param {number} value Value to write
  30286. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30287. * @throws {TypeError} If `offset` or `value` is not a valid number
  30288. * @throws {RangeError} If `offset` is out of bounds
  30289. * @expose
  30290. */
  30291. ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
  30292. /**
  30293. * Reads a 16bit unsigned integer.
  30294. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30295. * @returns {number} Value read
  30296. * @throws {TypeError} If `offset` is not a valid number
  30297. * @throws {RangeError} If `offset` is out of bounds
  30298. * @expose
  30299. */
  30300. ByteBufferPrototype.readUint16 = function(offset) {
  30301. var relative = typeof offset === 'undefined';
  30302. if (relative) offset = this.offset;
  30303. if (!this.noAssert) {
  30304. if (typeof offset !== 'number' || offset % 1 !== 0)
  30305. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30306. offset >>>= 0;
  30307. if (offset < 0 || offset + 2 > this.buffer.byteLength)
  30308. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
  30309. }
  30310. var value = 0;
  30311. if (this.littleEndian) {
  30312. value = this.view[offset ];
  30313. value |= this.view[offset+1] << 8;
  30314. } else {
  30315. value = this.view[offset ] << 8;
  30316. value |= this.view[offset+1];
  30317. }
  30318. if (relative) this.offset += 2;
  30319. return value;
  30320. };
  30321. /**
  30322. * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
  30323. * @function
  30324. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  30325. * @returns {number} Value read
  30326. * @throws {TypeError} If `offset` is not a valid number
  30327. * @throws {RangeError} If `offset` is out of bounds
  30328. * @expose
  30329. */
  30330. ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
  30331. // types/ints/int32
  30332. /**
  30333. * Writes a 32bit signed integer.
  30334. * @param {number} value Value to write
  30335. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30336. * @expose
  30337. */
  30338. ByteBufferPrototype.writeInt32 = function(value, offset) {
  30339. var relative = typeof offset === 'undefined';
  30340. if (relative) offset = this.offset;
  30341. if (!this.noAssert) {
  30342. if (typeof value !== 'number' || value % 1 !== 0)
  30343. throw TypeError("Illegal value: "+value+" (not an integer)");
  30344. value |= 0;
  30345. if (typeof offset !== 'number' || offset % 1 !== 0)
  30346. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30347. offset >>>= 0;
  30348. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30349. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30350. }
  30351. offset += 4;
  30352. var capacity4 = this.buffer.byteLength;
  30353. if (offset > capacity4)
  30354. this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
  30355. offset -= 4;
  30356. if (this.littleEndian) {
  30357. this.view[offset+3] = (value >>> 24) & 0xFF;
  30358. this.view[offset+2] = (value >>> 16) & 0xFF;
  30359. this.view[offset+1] = (value >>> 8) & 0xFF;
  30360. this.view[offset ] = value & 0xFF;
  30361. } else {
  30362. this.view[offset ] = (value >>> 24) & 0xFF;
  30363. this.view[offset+1] = (value >>> 16) & 0xFF;
  30364. this.view[offset+2] = (value >>> 8) & 0xFF;
  30365. this.view[offset+3] = value & 0xFF;
  30366. }
  30367. if (relative) this.offset += 4;
  30368. return this;
  30369. };
  30370. /**
  30371. * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
  30372. * @param {number} value Value to write
  30373. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30374. * @expose
  30375. */
  30376. ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
  30377. /**
  30378. * Reads a 32bit signed integer.
  30379. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30380. * @returns {number} Value read
  30381. * @expose
  30382. */
  30383. ByteBufferPrototype.readInt32 = function(offset) {
  30384. var relative = typeof offset === 'undefined';
  30385. if (relative) offset = this.offset;
  30386. if (!this.noAssert) {
  30387. if (typeof offset !== 'number' || offset % 1 !== 0)
  30388. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30389. offset >>>= 0;
  30390. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  30391. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  30392. }
  30393. var value = 0;
  30394. if (this.littleEndian) {
  30395. value = this.view[offset+2] << 16;
  30396. value |= this.view[offset+1] << 8;
  30397. value |= this.view[offset ];
  30398. value += this.view[offset+3] << 24 >>> 0;
  30399. } else {
  30400. value = this.view[offset+1] << 16;
  30401. value |= this.view[offset+2] << 8;
  30402. value |= this.view[offset+3];
  30403. value += this.view[offset ] << 24 >>> 0;
  30404. }
  30405. value |= 0; // Cast to signed
  30406. if (relative) this.offset += 4;
  30407. return value;
  30408. };
  30409. /**
  30410. * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
  30411. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
  30412. * @returns {number} Value read
  30413. * @expose
  30414. */
  30415. ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
  30416. /**
  30417. * Writes a 32bit unsigned integer.
  30418. * @param {number} value Value to write
  30419. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30420. * @expose
  30421. */
  30422. ByteBufferPrototype.writeUint32 = function(value, offset) {
  30423. var relative = typeof offset === 'undefined';
  30424. if (relative) offset = this.offset;
  30425. if (!this.noAssert) {
  30426. if (typeof value !== 'number' || value % 1 !== 0)
  30427. throw TypeError("Illegal value: "+value+" (not an integer)");
  30428. value >>>= 0;
  30429. if (typeof offset !== 'number' || offset % 1 !== 0)
  30430. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30431. offset >>>= 0;
  30432. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30433. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30434. }
  30435. offset += 4;
  30436. var capacity5 = this.buffer.byteLength;
  30437. if (offset > capacity5)
  30438. this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
  30439. offset -= 4;
  30440. if (this.littleEndian) {
  30441. this.view[offset+3] = (value >>> 24) & 0xFF;
  30442. this.view[offset+2] = (value >>> 16) & 0xFF;
  30443. this.view[offset+1] = (value >>> 8) & 0xFF;
  30444. this.view[offset ] = value & 0xFF;
  30445. } else {
  30446. this.view[offset ] = (value >>> 24) & 0xFF;
  30447. this.view[offset+1] = (value >>> 16) & 0xFF;
  30448. this.view[offset+2] = (value >>> 8) & 0xFF;
  30449. this.view[offset+3] = value & 0xFF;
  30450. }
  30451. if (relative) this.offset += 4;
  30452. return this;
  30453. };
  30454. /**
  30455. * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
  30456. * @function
  30457. * @param {number} value Value to write
  30458. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30459. * @expose
  30460. */
  30461. ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
  30462. /**
  30463. * Reads a 32bit unsigned integer.
  30464. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30465. * @returns {number} Value read
  30466. * @expose
  30467. */
  30468. ByteBufferPrototype.readUint32 = function(offset) {
  30469. var relative = typeof offset === 'undefined';
  30470. if (relative) offset = this.offset;
  30471. if (!this.noAssert) {
  30472. if (typeof offset !== 'number' || offset % 1 !== 0)
  30473. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30474. offset >>>= 0;
  30475. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  30476. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  30477. }
  30478. var value = 0;
  30479. if (this.littleEndian) {
  30480. value = this.view[offset+2] << 16;
  30481. value |= this.view[offset+1] << 8;
  30482. value |= this.view[offset ];
  30483. value += this.view[offset+3] << 24 >>> 0;
  30484. } else {
  30485. value = this.view[offset+1] << 16;
  30486. value |= this.view[offset+2] << 8;
  30487. value |= this.view[offset+3];
  30488. value += this.view[offset ] << 24 >>> 0;
  30489. }
  30490. if (relative) this.offset += 4;
  30491. return value;
  30492. };
  30493. /**
  30494. * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
  30495. * @function
  30496. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30497. * @returns {number} Value read
  30498. * @expose
  30499. */
  30500. ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
  30501. // types/ints/int64
  30502. if (Long) {
  30503. /**
  30504. * Writes a 64bit signed integer.
  30505. * @param {number|!Long} value Value to write
  30506. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30507. * @returns {!ByteBuffer} this
  30508. * @expose
  30509. */
  30510. ByteBufferPrototype.writeInt64 = function(value, offset) {
  30511. var relative = typeof offset === 'undefined';
  30512. if (relative) offset = this.offset;
  30513. if (!this.noAssert) {
  30514. if (typeof value === 'number')
  30515. value = Long.fromNumber(value);
  30516. else if (typeof value === 'string')
  30517. value = Long.fromString(value);
  30518. else if (!(value && value instanceof Long))
  30519. throw TypeError("Illegal value: "+value+" (not an integer or Long)");
  30520. if (typeof offset !== 'number' || offset % 1 !== 0)
  30521. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30522. offset >>>= 0;
  30523. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30524. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30525. }
  30526. if (typeof value === 'number')
  30527. value = Long.fromNumber(value);
  30528. else if (typeof value === 'string')
  30529. value = Long.fromString(value);
  30530. offset += 8;
  30531. var capacity6 = this.buffer.byteLength;
  30532. if (offset > capacity6)
  30533. this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
  30534. offset -= 8;
  30535. var lo = value.low,
  30536. hi = value.high;
  30537. if (this.littleEndian) {
  30538. this.view[offset+3] = (lo >>> 24) & 0xFF;
  30539. this.view[offset+2] = (lo >>> 16) & 0xFF;
  30540. this.view[offset+1] = (lo >>> 8) & 0xFF;
  30541. this.view[offset ] = lo & 0xFF;
  30542. offset += 4;
  30543. this.view[offset+3] = (hi >>> 24) & 0xFF;
  30544. this.view[offset+2] = (hi >>> 16) & 0xFF;
  30545. this.view[offset+1] = (hi >>> 8) & 0xFF;
  30546. this.view[offset ] = hi & 0xFF;
  30547. } else {
  30548. this.view[offset ] = (hi >>> 24) & 0xFF;
  30549. this.view[offset+1] = (hi >>> 16) & 0xFF;
  30550. this.view[offset+2] = (hi >>> 8) & 0xFF;
  30551. this.view[offset+3] = hi & 0xFF;
  30552. offset += 4;
  30553. this.view[offset ] = (lo >>> 24) & 0xFF;
  30554. this.view[offset+1] = (lo >>> 16) & 0xFF;
  30555. this.view[offset+2] = (lo >>> 8) & 0xFF;
  30556. this.view[offset+3] = lo & 0xFF;
  30557. }
  30558. if (relative) this.offset += 8;
  30559. return this;
  30560. };
  30561. /**
  30562. * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
  30563. * @param {number|!Long} value Value to write
  30564. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30565. * @returns {!ByteBuffer} this
  30566. * @expose
  30567. */
  30568. ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
  30569. /**
  30570. * Reads a 64bit signed integer.
  30571. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30572. * @returns {!Long}
  30573. * @expose
  30574. */
  30575. ByteBufferPrototype.readInt64 = function(offset) {
  30576. var relative = typeof offset === 'undefined';
  30577. if (relative) offset = this.offset;
  30578. if (!this.noAssert) {
  30579. if (typeof offset !== 'number' || offset % 1 !== 0)
  30580. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30581. offset >>>= 0;
  30582. if (offset < 0 || offset + 8 > this.buffer.byteLength)
  30583. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
  30584. }
  30585. var lo = 0,
  30586. hi = 0;
  30587. if (this.littleEndian) {
  30588. lo = this.view[offset+2] << 16;
  30589. lo |= this.view[offset+1] << 8;
  30590. lo |= this.view[offset ];
  30591. lo += this.view[offset+3] << 24 >>> 0;
  30592. offset += 4;
  30593. hi = this.view[offset+2] << 16;
  30594. hi |= this.view[offset+1] << 8;
  30595. hi |= this.view[offset ];
  30596. hi += this.view[offset+3] << 24 >>> 0;
  30597. } else {
  30598. hi = this.view[offset+1] << 16;
  30599. hi |= this.view[offset+2] << 8;
  30600. hi |= this.view[offset+3];
  30601. hi += this.view[offset ] << 24 >>> 0;
  30602. offset += 4;
  30603. lo = this.view[offset+1] << 16;
  30604. lo |= this.view[offset+2] << 8;
  30605. lo |= this.view[offset+3];
  30606. lo += this.view[offset ] << 24 >>> 0;
  30607. }
  30608. var value = new Long(lo, hi, false);
  30609. if (relative) this.offset += 8;
  30610. return value;
  30611. };
  30612. /**
  30613. * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
  30614. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30615. * @returns {!Long}
  30616. * @expose
  30617. */
  30618. ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
  30619. /**
  30620. * Writes a 64bit unsigned integer.
  30621. * @param {number|!Long} value Value to write
  30622. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30623. * @returns {!ByteBuffer} this
  30624. * @expose
  30625. */
  30626. ByteBufferPrototype.writeUint64 = function(value, offset) {
  30627. var relative = typeof offset === 'undefined';
  30628. if (relative) offset = this.offset;
  30629. if (!this.noAssert) {
  30630. if (typeof value === 'number')
  30631. value = Long.fromNumber(value);
  30632. else if (typeof value === 'string')
  30633. value = Long.fromString(value);
  30634. else if (!(value && value instanceof Long))
  30635. throw TypeError("Illegal value: "+value+" (not an integer or Long)");
  30636. if (typeof offset !== 'number' || offset % 1 !== 0)
  30637. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30638. offset >>>= 0;
  30639. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30640. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30641. }
  30642. if (typeof value === 'number')
  30643. value = Long.fromNumber(value);
  30644. else if (typeof value === 'string')
  30645. value = Long.fromString(value);
  30646. offset += 8;
  30647. var capacity7 = this.buffer.byteLength;
  30648. if (offset > capacity7)
  30649. this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
  30650. offset -= 8;
  30651. var lo = value.low,
  30652. hi = value.high;
  30653. if (this.littleEndian) {
  30654. this.view[offset+3] = (lo >>> 24) & 0xFF;
  30655. this.view[offset+2] = (lo >>> 16) & 0xFF;
  30656. this.view[offset+1] = (lo >>> 8) & 0xFF;
  30657. this.view[offset ] = lo & 0xFF;
  30658. offset += 4;
  30659. this.view[offset+3] = (hi >>> 24) & 0xFF;
  30660. this.view[offset+2] = (hi >>> 16) & 0xFF;
  30661. this.view[offset+1] = (hi >>> 8) & 0xFF;
  30662. this.view[offset ] = hi & 0xFF;
  30663. } else {
  30664. this.view[offset ] = (hi >>> 24) & 0xFF;
  30665. this.view[offset+1] = (hi >>> 16) & 0xFF;
  30666. this.view[offset+2] = (hi >>> 8) & 0xFF;
  30667. this.view[offset+3] = hi & 0xFF;
  30668. offset += 4;
  30669. this.view[offset ] = (lo >>> 24) & 0xFF;
  30670. this.view[offset+1] = (lo >>> 16) & 0xFF;
  30671. this.view[offset+2] = (lo >>> 8) & 0xFF;
  30672. this.view[offset+3] = lo & 0xFF;
  30673. }
  30674. if (relative) this.offset += 8;
  30675. return this;
  30676. };
  30677. /**
  30678. * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
  30679. * @function
  30680. * @param {number|!Long} value Value to write
  30681. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30682. * @returns {!ByteBuffer} this
  30683. * @expose
  30684. */
  30685. ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
  30686. /**
  30687. * Reads a 64bit unsigned integer.
  30688. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30689. * @returns {!Long}
  30690. * @expose
  30691. */
  30692. ByteBufferPrototype.readUint64 = function(offset) {
  30693. var relative = typeof offset === 'undefined';
  30694. if (relative) offset = this.offset;
  30695. if (!this.noAssert) {
  30696. if (typeof offset !== 'number' || offset % 1 !== 0)
  30697. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30698. offset >>>= 0;
  30699. if (offset < 0 || offset + 8 > this.buffer.byteLength)
  30700. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
  30701. }
  30702. var lo = 0,
  30703. hi = 0;
  30704. if (this.littleEndian) {
  30705. lo = this.view[offset+2] << 16;
  30706. lo |= this.view[offset+1] << 8;
  30707. lo |= this.view[offset ];
  30708. lo += this.view[offset+3] << 24 >>> 0;
  30709. offset += 4;
  30710. hi = this.view[offset+2] << 16;
  30711. hi |= this.view[offset+1] << 8;
  30712. hi |= this.view[offset ];
  30713. hi += this.view[offset+3] << 24 >>> 0;
  30714. } else {
  30715. hi = this.view[offset+1] << 16;
  30716. hi |= this.view[offset+2] << 8;
  30717. hi |= this.view[offset+3];
  30718. hi += this.view[offset ] << 24 >>> 0;
  30719. offset += 4;
  30720. lo = this.view[offset+1] << 16;
  30721. lo |= this.view[offset+2] << 8;
  30722. lo |= this.view[offset+3];
  30723. lo += this.view[offset ] << 24 >>> 0;
  30724. }
  30725. var value = new Long(lo, hi, true);
  30726. if (relative) this.offset += 8;
  30727. return value;
  30728. };
  30729. /**
  30730. * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
  30731. * @function
  30732. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30733. * @returns {!Long}
  30734. * @expose
  30735. */
  30736. ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
  30737. } // Long
  30738. // types/floats/float32
  30739. /*
  30740. ieee754 - https://github.com/feross/ieee754
  30741. The MIT License (MIT)
  30742. Copyright (c) Feross Aboukhadijeh
  30743. Permission is hereby granted, free of charge, to any person obtaining a copy
  30744. of this software and associated documentation files (the "Software"), to deal
  30745. in the Software without restriction, including without limitation the rights
  30746. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30747. copies of the Software, and to permit persons to whom the Software is
  30748. furnished to do so, subject to the following conditions:
  30749. The above copyright notice and this permission notice shall be included in
  30750. all copies or substantial portions of the Software.
  30751. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  30752. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30753. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  30754. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30755. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  30756. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  30757. THE SOFTWARE.
  30758. */
  30759. /**
  30760. * Reads an IEEE754 float from a byte array.
  30761. * @param {!Array} buffer
  30762. * @param {number} offset
  30763. * @param {boolean} isLE
  30764. * @param {number} mLen
  30765. * @param {number} nBytes
  30766. * @returns {number}
  30767. * @inner
  30768. */
  30769. function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
  30770. var e, m,
  30771. eLen = nBytes * 8 - mLen - 1,
  30772. eMax = (1 << eLen) - 1,
  30773. eBias = eMax >> 1,
  30774. nBits = -7,
  30775. i = isLE ? (nBytes - 1) : 0,
  30776. d = isLE ? -1 : 1,
  30777. s = buffer[offset + i];
  30778. i += d;
  30779. e = s & ((1 << (-nBits)) - 1);
  30780. s >>= (-nBits);
  30781. nBits += eLen;
  30782. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  30783. m = e & ((1 << (-nBits)) - 1);
  30784. e >>= (-nBits);
  30785. nBits += mLen;
  30786. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  30787. if (e === 0) {
  30788. e = 1 - eBias;
  30789. } else if (e === eMax) {
  30790. return m ? NaN : ((s ? -1 : 1) * Infinity);
  30791. } else {
  30792. m = m + Math.pow(2, mLen);
  30793. e = e - eBias;
  30794. }
  30795. return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
  30796. }
  30797. /**
  30798. * Writes an IEEE754 float to a byte array.
  30799. * @param {!Array} buffer
  30800. * @param {number} value
  30801. * @param {number} offset
  30802. * @param {boolean} isLE
  30803. * @param {number} mLen
  30804. * @param {number} nBytes
  30805. * @inner
  30806. */
  30807. function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
  30808. var e, m, c,
  30809. eLen = nBytes * 8 - mLen - 1,
  30810. eMax = (1 << eLen) - 1,
  30811. eBias = eMax >> 1,
  30812. rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
  30813. i = isLE ? 0 : (nBytes - 1),
  30814. d = isLE ? 1 : -1,
  30815. s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
  30816. value = Math.abs(value);
  30817. if (isNaN(value) || value === Infinity) {
  30818. m = isNaN(value) ? 1 : 0;
  30819. e = eMax;
  30820. } else {
  30821. e = Math.floor(Math.log(value) / Math.LN2);
  30822. if (value * (c = Math.pow(2, -e)) < 1) {
  30823. e--;
  30824. c *= 2;
  30825. }
  30826. if (e + eBias >= 1) {
  30827. value += rt / c;
  30828. } else {
  30829. value += rt * Math.pow(2, 1 - eBias);
  30830. }
  30831. if (value * c >= 2) {
  30832. e++;
  30833. c /= 2;
  30834. }
  30835. if (e + eBias >= eMax) {
  30836. m = 0;
  30837. e = eMax;
  30838. } else if (e + eBias >= 1) {
  30839. m = (value * c - 1) * Math.pow(2, mLen);
  30840. e = e + eBias;
  30841. } else {
  30842. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
  30843. e = 0;
  30844. }
  30845. }
  30846. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  30847. e = (e << mLen) | m;
  30848. eLen += mLen;
  30849. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  30850. buffer[offset + i - d] |= s * 128;
  30851. }
  30852. /**
  30853. * Writes a 32bit float.
  30854. * @param {number} value Value to write
  30855. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30856. * @returns {!ByteBuffer} this
  30857. * @expose
  30858. */
  30859. ByteBufferPrototype.writeFloat32 = function(value, offset) {
  30860. var relative = typeof offset === 'undefined';
  30861. if (relative) offset = this.offset;
  30862. if (!this.noAssert) {
  30863. if (typeof value !== 'number')
  30864. throw TypeError("Illegal value: "+value+" (not a number)");
  30865. if (typeof offset !== 'number' || offset % 1 !== 0)
  30866. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30867. offset >>>= 0;
  30868. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30869. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30870. }
  30871. offset += 4;
  30872. var capacity8 = this.buffer.byteLength;
  30873. if (offset > capacity8)
  30874. this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
  30875. offset -= 4;
  30876. ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
  30877. if (relative) this.offset += 4;
  30878. return this;
  30879. };
  30880. /**
  30881. * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
  30882. * @function
  30883. * @param {number} value Value to write
  30884. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30885. * @returns {!ByteBuffer} this
  30886. * @expose
  30887. */
  30888. ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
  30889. /**
  30890. * Reads a 32bit float.
  30891. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30892. * @returns {number}
  30893. * @expose
  30894. */
  30895. ByteBufferPrototype.readFloat32 = function(offset) {
  30896. var relative = typeof offset === 'undefined';
  30897. if (relative) offset = this.offset;
  30898. if (!this.noAssert) {
  30899. if (typeof offset !== 'number' || offset % 1 !== 0)
  30900. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30901. offset >>>= 0;
  30902. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  30903. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  30904. }
  30905. var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
  30906. if (relative) this.offset += 4;
  30907. return value;
  30908. };
  30909. /**
  30910. * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
  30911. * @function
  30912. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  30913. * @returns {number}
  30914. * @expose
  30915. */
  30916. ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
  30917. // types/floats/float64
  30918. /**
  30919. * Writes a 64bit float.
  30920. * @param {number} value Value to write
  30921. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30922. * @returns {!ByteBuffer} this
  30923. * @expose
  30924. */
  30925. ByteBufferPrototype.writeFloat64 = function(value, offset) {
  30926. var relative = typeof offset === 'undefined';
  30927. if (relative) offset = this.offset;
  30928. if (!this.noAssert) {
  30929. if (typeof value !== 'number')
  30930. throw TypeError("Illegal value: "+value+" (not a number)");
  30931. if (typeof offset !== 'number' || offset % 1 !== 0)
  30932. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30933. offset >>>= 0;
  30934. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  30935. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  30936. }
  30937. offset += 8;
  30938. var capacity9 = this.buffer.byteLength;
  30939. if (offset > capacity9)
  30940. this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
  30941. offset -= 8;
  30942. ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
  30943. if (relative) this.offset += 8;
  30944. return this;
  30945. };
  30946. /**
  30947. * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
  30948. * @function
  30949. * @param {number} value Value to write
  30950. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30951. * @returns {!ByteBuffer} this
  30952. * @expose
  30953. */
  30954. ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
  30955. /**
  30956. * Reads a 64bit float.
  30957. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30958. * @returns {number}
  30959. * @expose
  30960. */
  30961. ByteBufferPrototype.readFloat64 = function(offset) {
  30962. var relative = typeof offset === 'undefined';
  30963. if (relative) offset = this.offset;
  30964. if (!this.noAssert) {
  30965. if (typeof offset !== 'number' || offset % 1 !== 0)
  30966. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  30967. offset >>>= 0;
  30968. if (offset < 0 || offset + 8 > this.buffer.byteLength)
  30969. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
  30970. }
  30971. var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
  30972. if (relative) this.offset += 8;
  30973. return value;
  30974. };
  30975. /**
  30976. * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
  30977. * @function
  30978. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  30979. * @returns {number}
  30980. * @expose
  30981. */
  30982. ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
  30983. // types/varints/varint32
  30984. /**
  30985. * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
  30986. * @type {number}
  30987. * @const
  30988. * @expose
  30989. */
  30990. ByteBuffer.MAX_VARINT32_BYTES = 5;
  30991. /**
  30992. * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
  30993. * @param {number} value Value to encode
  30994. * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
  30995. * @expose
  30996. */
  30997. ByteBuffer.calculateVarint32 = function(value) {
  30998. // ref: src/google/protobuf/io/coded_stream.cc
  30999. value = value >>> 0;
  31000. if (value < 1 << 7 ) return 1;
  31001. else if (value < 1 << 14) return 2;
  31002. else if (value < 1 << 21) return 3;
  31003. else if (value < 1 << 28) return 4;
  31004. else return 5;
  31005. };
  31006. /**
  31007. * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
  31008. * @param {number} n Signed 32bit integer
  31009. * @returns {number} Unsigned zigzag encoded 32bit integer
  31010. * @expose
  31011. */
  31012. ByteBuffer.zigZagEncode32 = function(n) {
  31013. return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
  31014. };
  31015. /**
  31016. * Decodes a zigzag encoded signed 32bit integer.
  31017. * @param {number} n Unsigned zigzag encoded 32bit integer
  31018. * @returns {number} Signed 32bit integer
  31019. * @expose
  31020. */
  31021. ByteBuffer.zigZagDecode32 = function(n) {
  31022. return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
  31023. };
  31024. /**
  31025. * Writes a 32bit base 128 variable-length integer.
  31026. * @param {number} value Value to write
  31027. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31028. * written if omitted.
  31029. * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
  31030. * @expose
  31031. */
  31032. ByteBufferPrototype.writeVarint32 = function(value, offset) {
  31033. var relative = typeof offset === 'undefined';
  31034. if (relative) offset = this.offset;
  31035. if (!this.noAssert) {
  31036. if (typeof value !== 'number' || value % 1 !== 0)
  31037. throw TypeError("Illegal value: "+value+" (not an integer)");
  31038. value |= 0;
  31039. if (typeof offset !== 'number' || offset % 1 !== 0)
  31040. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31041. offset >>>= 0;
  31042. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31043. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31044. }
  31045. var size = ByteBuffer.calculateVarint32(value),
  31046. b;
  31047. offset += size;
  31048. var capacity10 = this.buffer.byteLength;
  31049. if (offset > capacity10)
  31050. this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
  31051. offset -= size;
  31052. value >>>= 0;
  31053. while (value >= 0x80) {
  31054. b = (value & 0x7f) | 0x80;
  31055. this.view[offset++] = b;
  31056. value >>>= 7;
  31057. }
  31058. this.view[offset++] = value;
  31059. if (relative) {
  31060. this.offset = offset;
  31061. return this;
  31062. }
  31063. return size;
  31064. };
  31065. /**
  31066. * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
  31067. * @param {number} value Value to write
  31068. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31069. * written if omitted.
  31070. * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
  31071. * @expose
  31072. */
  31073. ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
  31074. return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
  31075. };
  31076. /**
  31077. * Reads a 32bit base 128 variable-length integer.
  31078. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31079. * written if omitted.
  31080. * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
  31081. * and the actual number of bytes read.
  31082. * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
  31083. * to fully decode the varint.
  31084. * @expose
  31085. */
  31086. ByteBufferPrototype.readVarint32 = function(offset) {
  31087. var relative = typeof offset === 'undefined';
  31088. if (relative) offset = this.offset;
  31089. if (!this.noAssert) {
  31090. if (typeof offset !== 'number' || offset % 1 !== 0)
  31091. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31092. offset >>>= 0;
  31093. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  31094. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  31095. }
  31096. var c = 0,
  31097. value = 0 >>> 0,
  31098. b;
  31099. do {
  31100. if (!this.noAssert && offset > this.limit) {
  31101. var err = Error("Truncated");
  31102. err['truncated'] = true;
  31103. throw err;
  31104. }
  31105. b = this.view[offset++];
  31106. if (c < 5)
  31107. value |= (b & 0x7f) << (7*c);
  31108. ++c;
  31109. } while ((b & 0x80) !== 0);
  31110. value |= 0;
  31111. if (relative) {
  31112. this.offset = offset;
  31113. return value;
  31114. }
  31115. return {
  31116. "value": value,
  31117. "length": c
  31118. };
  31119. };
  31120. /**
  31121. * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
  31122. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31123. * written if omitted.
  31124. * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
  31125. * and the actual number of bytes read.
  31126. * @throws {Error} If it's not a valid varint
  31127. * @expose
  31128. */
  31129. ByteBufferPrototype.readVarint32ZigZag = function(offset) {
  31130. var val = this.readVarint32(offset);
  31131. if (typeof val === 'object')
  31132. val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
  31133. else
  31134. val = ByteBuffer.zigZagDecode32(val);
  31135. return val;
  31136. };
  31137. // types/varints/varint64
  31138. if (Long) {
  31139. /**
  31140. * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
  31141. * @type {number}
  31142. * @const
  31143. * @expose
  31144. */
  31145. ByteBuffer.MAX_VARINT64_BYTES = 10;
  31146. /**
  31147. * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
  31148. * @param {number|!Long} value Value to encode
  31149. * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
  31150. * @expose
  31151. */
  31152. ByteBuffer.calculateVarint64 = function(value) {
  31153. if (typeof value === 'number')
  31154. value = Long.fromNumber(value);
  31155. else if (typeof value === 'string')
  31156. value = Long.fromString(value);
  31157. // ref: src/google/protobuf/io/coded_stream.cc
  31158. var part0 = value.toInt() >>> 0,
  31159. part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
  31160. part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
  31161. if (part2 == 0) {
  31162. if (part1 == 0) {
  31163. if (part0 < 1 << 14)
  31164. return part0 < 1 << 7 ? 1 : 2;
  31165. else
  31166. return part0 < 1 << 21 ? 3 : 4;
  31167. } else {
  31168. if (part1 < 1 << 14)
  31169. return part1 < 1 << 7 ? 5 : 6;
  31170. else
  31171. return part1 < 1 << 21 ? 7 : 8;
  31172. }
  31173. } else
  31174. return part2 < 1 << 7 ? 9 : 10;
  31175. };
  31176. /**
  31177. * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
  31178. * @param {number|!Long} value Signed long
  31179. * @returns {!Long} Unsigned zigzag encoded long
  31180. * @expose
  31181. */
  31182. ByteBuffer.zigZagEncode64 = function(value) {
  31183. if (typeof value === 'number')
  31184. value = Long.fromNumber(value, false);
  31185. else if (typeof value === 'string')
  31186. value = Long.fromString(value, false);
  31187. else if (value.unsigned !== false) value = value.toSigned();
  31188. // ref: src/google/protobuf/wire_format_lite.h
  31189. return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
  31190. };
  31191. /**
  31192. * Decodes a zigzag encoded signed 64bit integer.
  31193. * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
  31194. * @returns {!Long} Signed long
  31195. * @expose
  31196. */
  31197. ByteBuffer.zigZagDecode64 = function(value) {
  31198. if (typeof value === 'number')
  31199. value = Long.fromNumber(value, false);
  31200. else if (typeof value === 'string')
  31201. value = Long.fromString(value, false);
  31202. else if (value.unsigned !== false) value = value.toSigned();
  31203. // ref: src/google/protobuf/wire_format_lite.h
  31204. return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
  31205. };
  31206. /**
  31207. * Writes a 64bit base 128 variable-length integer.
  31208. * @param {number|Long} value Value to write
  31209. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31210. * written if omitted.
  31211. * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
  31212. * @expose
  31213. */
  31214. ByteBufferPrototype.writeVarint64 = function(value, offset) {
  31215. var relative = typeof offset === 'undefined';
  31216. if (relative) offset = this.offset;
  31217. if (!this.noAssert) {
  31218. if (typeof value === 'number')
  31219. value = Long.fromNumber(value);
  31220. else if (typeof value === 'string')
  31221. value = Long.fromString(value);
  31222. else if (!(value && value instanceof Long))
  31223. throw TypeError("Illegal value: "+value+" (not an integer or Long)");
  31224. if (typeof offset !== 'number' || offset % 1 !== 0)
  31225. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31226. offset >>>= 0;
  31227. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31228. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31229. }
  31230. if (typeof value === 'number')
  31231. value = Long.fromNumber(value, false);
  31232. else if (typeof value === 'string')
  31233. value = Long.fromString(value, false);
  31234. else if (value.unsigned !== false) value = value.toSigned();
  31235. var size = ByteBuffer.calculateVarint64(value),
  31236. part0 = value.toInt() >>> 0,
  31237. part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
  31238. part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
  31239. offset += size;
  31240. var capacity11 = this.buffer.byteLength;
  31241. if (offset > capacity11)
  31242. this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
  31243. offset -= size;
  31244. switch (size) {
  31245. case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
  31246. case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
  31247. case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
  31248. case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
  31249. case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
  31250. case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
  31251. case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
  31252. case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
  31253. case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
  31254. case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
  31255. }
  31256. if (relative) {
  31257. this.offset += size;
  31258. return this;
  31259. } else {
  31260. return size;
  31261. }
  31262. };
  31263. /**
  31264. * Writes a zig-zag encoded 64bit base 128 variable-length integer.
  31265. * @param {number|Long} value Value to write
  31266. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31267. * written if omitted.
  31268. * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
  31269. * @expose
  31270. */
  31271. ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
  31272. return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
  31273. };
  31274. /**
  31275. * Reads a 64bit base 128 variable-length integer. Requires Long.js.
  31276. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31277. * read if omitted.
  31278. * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
  31279. * the actual number of bytes read.
  31280. * @throws {Error} If it's not a valid varint
  31281. * @expose
  31282. */
  31283. ByteBufferPrototype.readVarint64 = function(offset) {
  31284. var relative = typeof offset === 'undefined';
  31285. if (relative) offset = this.offset;
  31286. if (!this.noAssert) {
  31287. if (typeof offset !== 'number' || offset % 1 !== 0)
  31288. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31289. offset >>>= 0;
  31290. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  31291. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  31292. }
  31293. // ref: src/google/protobuf/io/coded_stream.cc
  31294. var start = offset,
  31295. part0 = 0,
  31296. part1 = 0,
  31297. part2 = 0,
  31298. b = 0;
  31299. b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
  31300. b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31301. b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31302. b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31303. b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31304. b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31305. b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31306. b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31307. b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31308. b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
  31309. throw Error("Buffer overrun"); }}}}}}}}}}
  31310. var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
  31311. if (relative) {
  31312. this.offset = offset;
  31313. return value;
  31314. } else {
  31315. return {
  31316. 'value': value,
  31317. 'length': offset-start
  31318. };
  31319. }
  31320. };
  31321. /**
  31322. * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
  31323. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31324. * read if omitted.
  31325. * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
  31326. * the actual number of bytes read.
  31327. * @throws {Error} If it's not a valid varint
  31328. * @expose
  31329. */
  31330. ByteBufferPrototype.readVarint64ZigZag = function(offset) {
  31331. var val = this.readVarint64(offset);
  31332. if (val && val['value'] instanceof Long)
  31333. val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
  31334. else
  31335. val = ByteBuffer.zigZagDecode64(val);
  31336. return val;
  31337. };
  31338. } // Long
  31339. // types/strings/cstring
  31340. /**
  31341. * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
  31342. * characters itself.
  31343. * @param {string} str String to write
  31344. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31345. * contained in `str` + 1 if omitted.
  31346. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
  31347. * @expose
  31348. */
  31349. ByteBufferPrototype.writeCString = function(str, offset) {
  31350. var relative = typeof offset === 'undefined';
  31351. if (relative) offset = this.offset;
  31352. var i,
  31353. k = str.length;
  31354. if (!this.noAssert) {
  31355. if (typeof str !== 'string')
  31356. throw TypeError("Illegal str: Not a string");
  31357. for (i=0; i<k; ++i) {
  31358. if (str.charCodeAt(i) === 0)
  31359. throw RangeError("Illegal str: Contains NULL-characters");
  31360. }
  31361. if (typeof offset !== 'number' || offset % 1 !== 0)
  31362. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31363. offset >>>= 0;
  31364. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31365. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31366. }
  31367. // UTF8 strings do not contain zero bytes in between except for the zero character, so:
  31368. k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
  31369. offset += k+1;
  31370. var capacity12 = this.buffer.byteLength;
  31371. if (offset > capacity12)
  31372. this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
  31373. offset -= k+1;
  31374. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  31375. this.view[offset++] = b;
  31376. }.bind(this));
  31377. this.view[offset++] = 0;
  31378. if (relative) {
  31379. this.offset = offset;
  31380. return this;
  31381. }
  31382. return k;
  31383. };
  31384. /**
  31385. * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
  31386. * itself.
  31387. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31388. * read if omitted.
  31389. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  31390. * read and the actual number of bytes read.
  31391. * @expose
  31392. */
  31393. ByteBufferPrototype.readCString = function(offset) {
  31394. var relative = typeof offset === 'undefined';
  31395. if (relative) offset = this.offset;
  31396. if (!this.noAssert) {
  31397. if (typeof offset !== 'number' || offset % 1 !== 0)
  31398. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31399. offset >>>= 0;
  31400. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  31401. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  31402. }
  31403. var start = offset,
  31404. temp;
  31405. // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
  31406. var sd, b = -1;
  31407. utfx.decodeUTF8toUTF16(function() {
  31408. if (b === 0) return null;
  31409. if (offset >= this.limit)
  31410. throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
  31411. b = this.view[offset++];
  31412. return b === 0 ? null : b;
  31413. }.bind(this), sd = stringDestination(), true);
  31414. if (relative) {
  31415. this.offset = offset;
  31416. return sd();
  31417. } else {
  31418. return {
  31419. "string": sd(),
  31420. "length": offset - start
  31421. };
  31422. }
  31423. };
  31424. // types/strings/istring
  31425. /**
  31426. * Writes a length as uint32 prefixed UTF8 encoded string.
  31427. * @param {string} str String to write
  31428. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31429. * written if omitted.
  31430. * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
  31431. * @expose
  31432. * @see ByteBuffer#writeVarint32
  31433. */
  31434. ByteBufferPrototype.writeIString = function(str, offset) {
  31435. var relative = typeof offset === 'undefined';
  31436. if (relative) offset = this.offset;
  31437. if (!this.noAssert) {
  31438. if (typeof str !== 'string')
  31439. throw TypeError("Illegal str: Not a string");
  31440. if (typeof offset !== 'number' || offset % 1 !== 0)
  31441. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31442. offset >>>= 0;
  31443. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31444. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31445. }
  31446. var start = offset,
  31447. k;
  31448. k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
  31449. offset += 4+k;
  31450. var capacity13 = this.buffer.byteLength;
  31451. if (offset > capacity13)
  31452. this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
  31453. offset -= 4+k;
  31454. if (this.littleEndian) {
  31455. this.view[offset+3] = (k >>> 24) & 0xFF;
  31456. this.view[offset+2] = (k >>> 16) & 0xFF;
  31457. this.view[offset+1] = (k >>> 8) & 0xFF;
  31458. this.view[offset ] = k & 0xFF;
  31459. } else {
  31460. this.view[offset ] = (k >>> 24) & 0xFF;
  31461. this.view[offset+1] = (k >>> 16) & 0xFF;
  31462. this.view[offset+2] = (k >>> 8) & 0xFF;
  31463. this.view[offset+3] = k & 0xFF;
  31464. }
  31465. offset += 4;
  31466. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  31467. this.view[offset++] = b;
  31468. }.bind(this));
  31469. if (offset !== start + 4 + k)
  31470. throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
  31471. if (relative) {
  31472. this.offset = offset;
  31473. return this;
  31474. }
  31475. return offset - start;
  31476. };
  31477. /**
  31478. * Reads a length as uint32 prefixed UTF8 encoded string.
  31479. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31480. * read if omitted.
  31481. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  31482. * read and the actual number of bytes read.
  31483. * @expose
  31484. * @see ByteBuffer#readVarint32
  31485. */
  31486. ByteBufferPrototype.readIString = function(offset) {
  31487. var relative = typeof offset === 'undefined';
  31488. if (relative) offset = this.offset;
  31489. if (!this.noAssert) {
  31490. if (typeof offset !== 'number' || offset % 1 !== 0)
  31491. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31492. offset >>>= 0;
  31493. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  31494. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  31495. }
  31496. var start = offset;
  31497. var len = this.readUint32(offset);
  31498. var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
  31499. offset += str['length'];
  31500. if (relative) {
  31501. this.offset = offset;
  31502. return str['string'];
  31503. } else {
  31504. return {
  31505. 'string': str['string'],
  31506. 'length': offset - start
  31507. };
  31508. }
  31509. };
  31510. // types/strings/utf8string
  31511. /**
  31512. * Metrics representing number of UTF8 characters. Evaluates to `c`.
  31513. * @type {string}
  31514. * @const
  31515. * @expose
  31516. */
  31517. ByteBuffer.METRICS_CHARS = 'c';
  31518. /**
  31519. * Metrics representing number of bytes. Evaluates to `b`.
  31520. * @type {string}
  31521. * @const
  31522. * @expose
  31523. */
  31524. ByteBuffer.METRICS_BYTES = 'b';
  31525. /**
  31526. * Writes an UTF8 encoded string.
  31527. * @param {string} str String to write
  31528. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
  31529. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
  31530. * @expose
  31531. */
  31532. ByteBufferPrototype.writeUTF8String = function(str, offset) {
  31533. var relative = typeof offset === 'undefined';
  31534. if (relative) offset = this.offset;
  31535. if (!this.noAssert) {
  31536. if (typeof offset !== 'number' || offset % 1 !== 0)
  31537. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31538. offset >>>= 0;
  31539. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31540. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31541. }
  31542. var k;
  31543. var start = offset;
  31544. k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
  31545. offset += k;
  31546. var capacity14 = this.buffer.byteLength;
  31547. if (offset > capacity14)
  31548. this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
  31549. offset -= k;
  31550. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  31551. this.view[offset++] = b;
  31552. }.bind(this));
  31553. if (relative) {
  31554. this.offset = offset;
  31555. return this;
  31556. }
  31557. return offset - start;
  31558. };
  31559. /**
  31560. * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
  31561. * @function
  31562. * @param {string} str String to write
  31563. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
  31564. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
  31565. * @expose
  31566. */
  31567. ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
  31568. /**
  31569. * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
  31570. * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
  31571. * @param {string} str String to calculate
  31572. * @returns {number} Number of UTF8 characters
  31573. * @expose
  31574. */
  31575. ByteBuffer.calculateUTF8Chars = function(str) {
  31576. return utfx.calculateUTF16asUTF8(stringSource(str))[0];
  31577. };
  31578. /**
  31579. * Calculates the number of UTF8 bytes of a string.
  31580. * @param {string} str String to calculate
  31581. * @returns {number} Number of UTF8 bytes
  31582. * @expose
  31583. */
  31584. ByteBuffer.calculateUTF8Bytes = function(str) {
  31585. return utfx.calculateUTF16asUTF8(stringSource(str))[1];
  31586. };
  31587. /**
  31588. * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
  31589. * @function
  31590. * @param {string} str String to calculate
  31591. * @returns {number} Number of UTF8 bytes
  31592. * @expose
  31593. */
  31594. ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
  31595. /**
  31596. * Reads an UTF8 encoded string.
  31597. * @param {number} length Number of characters or bytes to read.
  31598. * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
  31599. * {@link ByteBuffer.METRICS_CHARS}.
  31600. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31601. * read if omitted.
  31602. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  31603. * read and the actual number of bytes read.
  31604. * @expose
  31605. */
  31606. ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
  31607. if (typeof metrics === 'number') {
  31608. offset = metrics;
  31609. metrics = undefined;
  31610. }
  31611. var relative = typeof offset === 'undefined';
  31612. if (relative) offset = this.offset;
  31613. if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
  31614. if (!this.noAssert) {
  31615. if (typeof length !== 'number' || length % 1 !== 0)
  31616. throw TypeError("Illegal length: "+length+" (not an integer)");
  31617. length |= 0;
  31618. if (typeof offset !== 'number' || offset % 1 !== 0)
  31619. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31620. offset >>>= 0;
  31621. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31622. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31623. }
  31624. var i = 0,
  31625. start = offset,
  31626. sd;
  31627. if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
  31628. sd = stringDestination();
  31629. utfx.decodeUTF8(function() {
  31630. return i < length && offset < this.limit ? this.view[offset++] : null;
  31631. }.bind(this), function(cp) {
  31632. ++i; utfx.UTF8toUTF16(cp, sd);
  31633. });
  31634. if (i !== length)
  31635. throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
  31636. if (relative) {
  31637. this.offset = offset;
  31638. return sd();
  31639. } else {
  31640. return {
  31641. "string": sd(),
  31642. "length": offset - start
  31643. };
  31644. }
  31645. } else if (metrics === ByteBuffer.METRICS_BYTES) {
  31646. if (!this.noAssert) {
  31647. if (typeof offset !== 'number' || offset % 1 !== 0)
  31648. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31649. offset >>>= 0;
  31650. if (offset < 0 || offset + length > this.buffer.byteLength)
  31651. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
  31652. }
  31653. var k = offset + length;
  31654. utfx.decodeUTF8toUTF16(function() {
  31655. return offset < k ? this.view[offset++] : null;
  31656. }.bind(this), sd = stringDestination(), this.noAssert);
  31657. if (offset !== k)
  31658. throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
  31659. if (relative) {
  31660. this.offset = offset;
  31661. return sd();
  31662. } else {
  31663. return {
  31664. 'string': sd(),
  31665. 'length': offset - start
  31666. };
  31667. }
  31668. } else
  31669. throw TypeError("Unsupported metrics: "+metrics);
  31670. };
  31671. /**
  31672. * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
  31673. * @function
  31674. * @param {number} length Number of characters or bytes to read
  31675. * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
  31676. * {@link ByteBuffer.METRICS_CHARS}.
  31677. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31678. * read if omitted.
  31679. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  31680. * read and the actual number of bytes read.
  31681. * @expose
  31682. */
  31683. ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
  31684. // types/strings/vstring
  31685. /**
  31686. * Writes a length as varint32 prefixed UTF8 encoded string.
  31687. * @param {string} str String to write
  31688. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31689. * written if omitted.
  31690. * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
  31691. * @expose
  31692. * @see ByteBuffer#writeVarint32
  31693. */
  31694. ByteBufferPrototype.writeVString = function(str, offset) {
  31695. var relative = typeof offset === 'undefined';
  31696. if (relative) offset = this.offset;
  31697. if (!this.noAssert) {
  31698. if (typeof str !== 'string')
  31699. throw TypeError("Illegal str: Not a string");
  31700. if (typeof offset !== 'number' || offset % 1 !== 0)
  31701. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31702. offset >>>= 0;
  31703. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31704. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31705. }
  31706. var start = offset,
  31707. k, l;
  31708. k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
  31709. l = ByteBuffer.calculateVarint32(k);
  31710. offset += l+k;
  31711. var capacity15 = this.buffer.byteLength;
  31712. if (offset > capacity15)
  31713. this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
  31714. offset -= l+k;
  31715. offset += this.writeVarint32(k, offset);
  31716. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  31717. this.view[offset++] = b;
  31718. }.bind(this));
  31719. if (offset !== start+k+l)
  31720. throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
  31721. if (relative) {
  31722. this.offset = offset;
  31723. return this;
  31724. }
  31725. return offset - start;
  31726. };
  31727. /**
  31728. * Reads a length as varint32 prefixed UTF8 encoded string.
  31729. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31730. * read if omitted.
  31731. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  31732. * read and the actual number of bytes read.
  31733. * @expose
  31734. * @see ByteBuffer#readVarint32
  31735. */
  31736. ByteBufferPrototype.readVString = function(offset) {
  31737. var relative = typeof offset === 'undefined';
  31738. if (relative) offset = this.offset;
  31739. if (!this.noAssert) {
  31740. if (typeof offset !== 'number' || offset % 1 !== 0)
  31741. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31742. offset >>>= 0;
  31743. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  31744. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  31745. }
  31746. var start = offset;
  31747. var len = this.readVarint32(offset);
  31748. var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
  31749. offset += str['length'];
  31750. if (relative) {
  31751. this.offset = offset;
  31752. return str['string'];
  31753. } else {
  31754. return {
  31755. 'string': str['string'],
  31756. 'length': offset - start
  31757. };
  31758. }
  31759. };
  31760. /**
  31761. * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
  31762. * data's length.
  31763. * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
  31764. * will be modified according to the performed read operation.
  31765. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
  31766. * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31767. * written if omitted.
  31768. * @returns {!ByteBuffer} this
  31769. * @expose
  31770. * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
  31771. * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
  31772. */
  31773. ByteBufferPrototype.append = function(source, encoding, offset) {
  31774. if (typeof encoding === 'number' || typeof encoding !== 'string') {
  31775. offset = encoding;
  31776. encoding = undefined;
  31777. }
  31778. var relative = typeof offset === 'undefined';
  31779. if (relative) offset = this.offset;
  31780. if (!this.noAssert) {
  31781. if (typeof offset !== 'number' || offset % 1 !== 0)
  31782. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  31783. offset >>>= 0;
  31784. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  31785. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  31786. }
  31787. if (!(source instanceof ByteBuffer))
  31788. source = ByteBuffer.wrap(source, encoding);
  31789. var length = source.limit - source.offset;
  31790. if (length <= 0) return this; // Nothing to append
  31791. offset += length;
  31792. var capacity16 = this.buffer.byteLength;
  31793. if (offset > capacity16)
  31794. this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
  31795. offset -= length;
  31796. this.view.set(source.view.subarray(source.offset, source.limit), offset);
  31797. source.offset += length;
  31798. if (relative) this.offset += length;
  31799. return this;
  31800. };
  31801. /**
  31802. * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
  31803. specified offset up to the length of this ByteBuffer's data.
  31804. * @param {!ByteBuffer} target Target ByteBuffer
  31805. * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31806. * read if omitted.
  31807. * @returns {!ByteBuffer} this
  31808. * @expose
  31809. * @see ByteBuffer#append
  31810. */
  31811. ByteBufferPrototype.appendTo = function(target, offset) {
  31812. target.append(this, offset);
  31813. return this;
  31814. };
  31815. /**
  31816. * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
  31817. * disable them if your code already makes sure that everything is valid.
  31818. * @param {boolean} assert `true` to enable assertions, otherwise `false`
  31819. * @returns {!ByteBuffer} this
  31820. * @expose
  31821. */
  31822. ByteBufferPrototype.assert = function(assert) {
  31823. this.noAssert = !assert;
  31824. return this;
  31825. };
  31826. /**
  31827. * Gets the capacity of this ByteBuffer's backing buffer.
  31828. * @returns {number} Capacity of the backing buffer
  31829. * @expose
  31830. */
  31831. ByteBufferPrototype.capacity = function() {
  31832. return this.buffer.byteLength;
  31833. };
  31834. /**
  31835. * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
  31836. * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
  31837. * @returns {!ByteBuffer} this
  31838. * @expose
  31839. */
  31840. ByteBufferPrototype.clear = function() {
  31841. this.offset = 0;
  31842. this.limit = this.buffer.byteLength;
  31843. this.markedOffset = -1;
  31844. return this;
  31845. };
  31846. /**
  31847. * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
  31848. * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
  31849. * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
  31850. * @returns {!ByteBuffer} Cloned instance
  31851. * @expose
  31852. */
  31853. ByteBufferPrototype.clone = function(copy) {
  31854. var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
  31855. if (copy) {
  31856. bb.buffer = new ArrayBuffer(this.buffer.byteLength);
  31857. bb.view = new Uint8Array(bb.buffer);
  31858. } else {
  31859. bb.buffer = this.buffer;
  31860. bb.view = this.view;
  31861. }
  31862. bb.offset = this.offset;
  31863. bb.markedOffset = this.markedOffset;
  31864. bb.limit = this.limit;
  31865. return bb;
  31866. };
  31867. /**
  31868. * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
  31869. * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
  31870. * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
  31871. * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
  31872. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
  31873. * @returns {!ByteBuffer} this
  31874. * @expose
  31875. */
  31876. ByteBufferPrototype.compact = function(begin, end) {
  31877. if (typeof begin === 'undefined') begin = this.offset;
  31878. if (typeof end === 'undefined') end = this.limit;
  31879. if (!this.noAssert) {
  31880. if (typeof begin !== 'number' || begin % 1 !== 0)
  31881. throw TypeError("Illegal begin: Not an integer");
  31882. begin >>>= 0;
  31883. if (typeof end !== 'number' || end % 1 !== 0)
  31884. throw TypeError("Illegal end: Not an integer");
  31885. end >>>= 0;
  31886. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  31887. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  31888. }
  31889. if (begin === 0 && end === this.buffer.byteLength)
  31890. return this; // Already compacted
  31891. var len = end - begin;
  31892. if (len === 0) {
  31893. this.buffer = EMPTY_BUFFER;
  31894. this.view = null;
  31895. if (this.markedOffset >= 0) this.markedOffset -= begin;
  31896. this.offset = 0;
  31897. this.limit = 0;
  31898. return this;
  31899. }
  31900. var buffer = new ArrayBuffer(len);
  31901. var view = new Uint8Array(buffer);
  31902. view.set(this.view.subarray(begin, end));
  31903. this.buffer = buffer;
  31904. this.view = view;
  31905. if (this.markedOffset >= 0) this.markedOffset -= begin;
  31906. this.offset = 0;
  31907. this.limit = len;
  31908. return this;
  31909. };
  31910. /**
  31911. * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
  31912. * {@link ByteBuffer#limit}.
  31913. * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
  31914. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
  31915. * @returns {!ByteBuffer} Copy
  31916. * @expose
  31917. */
  31918. ByteBufferPrototype.copy = function(begin, end) {
  31919. if (typeof begin === 'undefined') begin = this.offset;
  31920. if (typeof end === 'undefined') end = this.limit;
  31921. if (!this.noAssert) {
  31922. if (typeof begin !== 'number' || begin % 1 !== 0)
  31923. throw TypeError("Illegal begin: Not an integer");
  31924. begin >>>= 0;
  31925. if (typeof end !== 'number' || end % 1 !== 0)
  31926. throw TypeError("Illegal end: Not an integer");
  31927. end >>>= 0;
  31928. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  31929. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  31930. }
  31931. if (begin === end)
  31932. return new ByteBuffer(0, this.littleEndian, this.noAssert);
  31933. var capacity = end - begin,
  31934. bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
  31935. bb.offset = 0;
  31936. bb.limit = capacity;
  31937. if (bb.markedOffset >= 0) bb.markedOffset -= begin;
  31938. this.copyTo(bb, 0, begin, end);
  31939. return bb;
  31940. };
  31941. /**
  31942. * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
  31943. * {@link ByteBuffer#limit}.
  31944. * @param {!ByteBuffer} target Target ByteBuffer
  31945. * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
  31946. * by the number of bytes copied if omitted.
  31947. * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
  31948. * number of bytes copied if omitted.
  31949. * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
  31950. * @returns {!ByteBuffer} this
  31951. * @expose
  31952. */
  31953. ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
  31954. var relative,
  31955. targetRelative;
  31956. if (!this.noAssert) {
  31957. if (!ByteBuffer.isByteBuffer(target))
  31958. throw TypeError("Illegal target: Not a ByteBuffer");
  31959. }
  31960. targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
  31961. sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
  31962. sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
  31963. if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
  31964. throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
  31965. if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
  31966. throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
  31967. var len = sourceLimit - sourceOffset;
  31968. if (len === 0)
  31969. return target; // Nothing to copy
  31970. target.ensureCapacity(targetOffset + len);
  31971. target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
  31972. if (relative) this.offset += len;
  31973. if (targetRelative) target.offset += len;
  31974. return this;
  31975. };
  31976. /**
  31977. * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
  31978. * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
  31979. * the required capacity will be used instead.
  31980. * @param {number} capacity Required capacity
  31981. * @returns {!ByteBuffer} this
  31982. * @expose
  31983. */
  31984. ByteBufferPrototype.ensureCapacity = function(capacity) {
  31985. var current = this.buffer.byteLength;
  31986. if (current < capacity)
  31987. return this.resize((current *= 2) > capacity ? current : capacity);
  31988. return this;
  31989. };
  31990. /**
  31991. * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
  31992. * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
  31993. * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
  31994. * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  31995. * written if omitted. defaults to {@link ByteBuffer#offset}.
  31996. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
  31997. * @returns {!ByteBuffer} this
  31998. * @expose
  31999. * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
  32000. */
  32001. ByteBufferPrototype.fill = function(value, begin, end) {
  32002. var relative = typeof begin === 'undefined';
  32003. if (relative) begin = this.offset;
  32004. if (typeof value === 'string' && value.length > 0)
  32005. value = value.charCodeAt(0);
  32006. if (typeof begin === 'undefined') begin = this.offset;
  32007. if (typeof end === 'undefined') end = this.limit;
  32008. if (!this.noAssert) {
  32009. if (typeof value !== 'number' || value % 1 !== 0)
  32010. throw TypeError("Illegal value: "+value+" (not an integer)");
  32011. value |= 0;
  32012. if (typeof begin !== 'number' || begin % 1 !== 0)
  32013. throw TypeError("Illegal begin: Not an integer");
  32014. begin >>>= 0;
  32015. if (typeof end !== 'number' || end % 1 !== 0)
  32016. throw TypeError("Illegal end: Not an integer");
  32017. end >>>= 0;
  32018. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  32019. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  32020. }
  32021. if (begin >= end)
  32022. return this; // Nothing to fill
  32023. while (begin < end) this.view[begin++] = value;
  32024. if (relative) this.offset = begin;
  32025. return this;
  32026. };
  32027. /**
  32028. * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
  32029. * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
  32030. * @returns {!ByteBuffer} this
  32031. * @expose
  32032. */
  32033. ByteBufferPrototype.flip = function() {
  32034. this.limit = this.offset;
  32035. this.offset = 0;
  32036. return this;
  32037. };
  32038. /**
  32039. * Marks an offset on this ByteBuffer to be used later.
  32040. * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
  32041. * @returns {!ByteBuffer} this
  32042. * @throws {TypeError} If `offset` is not a valid number
  32043. * @throws {RangeError} If `offset` is out of bounds
  32044. * @see ByteBuffer#reset
  32045. * @expose
  32046. */
  32047. ByteBufferPrototype.mark = function(offset) {
  32048. offset = typeof offset === 'undefined' ? this.offset : offset;
  32049. if (!this.noAssert) {
  32050. if (typeof offset !== 'number' || offset % 1 !== 0)
  32051. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  32052. offset >>>= 0;
  32053. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  32054. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  32055. }
  32056. this.markedOffset = offset;
  32057. return this;
  32058. };
  32059. /**
  32060. * Sets the byte order.
  32061. * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
  32062. * @returns {!ByteBuffer} this
  32063. * @expose
  32064. */
  32065. ByteBufferPrototype.order = function(littleEndian) {
  32066. if (!this.noAssert) {
  32067. if (typeof littleEndian !== 'boolean')
  32068. throw TypeError("Illegal littleEndian: Not a boolean");
  32069. }
  32070. this.littleEndian = !!littleEndian;
  32071. return this;
  32072. };
  32073. /**
  32074. * Switches (to) little endian byte order.
  32075. * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
  32076. * @returns {!ByteBuffer} this
  32077. * @expose
  32078. */
  32079. ByteBufferPrototype.LE = function(littleEndian) {
  32080. this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
  32081. return this;
  32082. };
  32083. /**
  32084. * Switches (to) big endian byte order.
  32085. * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
  32086. * @returns {!ByteBuffer} this
  32087. * @expose
  32088. */
  32089. ByteBufferPrototype.BE = function(bigEndian) {
  32090. this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
  32091. return this;
  32092. };
  32093. /**
  32094. * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
  32095. * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
  32096. * will be resized and its contents moved accordingly.
  32097. * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
  32098. * modified according to the performed read operation.
  32099. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
  32100. * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
  32101. * prepended if omitted.
  32102. * @returns {!ByteBuffer} this
  32103. * @expose
  32104. * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
  32105. * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
  32106. */
  32107. ByteBufferPrototype.prepend = function(source, encoding, offset) {
  32108. if (typeof encoding === 'number' || typeof encoding !== 'string') {
  32109. offset = encoding;
  32110. encoding = undefined;
  32111. }
  32112. var relative = typeof offset === 'undefined';
  32113. if (relative) offset = this.offset;
  32114. if (!this.noAssert) {
  32115. if (typeof offset !== 'number' || offset % 1 !== 0)
  32116. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  32117. offset >>>= 0;
  32118. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  32119. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  32120. }
  32121. if (!(source instanceof ByteBuffer))
  32122. source = ByteBuffer.wrap(source, encoding);
  32123. var len = source.limit - source.offset;
  32124. if (len <= 0) return this; // Nothing to prepend
  32125. var diff = len - offset;
  32126. if (diff > 0) { // Not enough space before offset, so resize + move
  32127. var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
  32128. var view = new Uint8Array(buffer);
  32129. view.set(this.view.subarray(offset, this.buffer.byteLength), len);
  32130. this.buffer = buffer;
  32131. this.view = view;
  32132. this.offset += diff;
  32133. if (this.markedOffset >= 0) this.markedOffset += diff;
  32134. this.limit += diff;
  32135. offset += diff;
  32136. } else {
  32137. var arrayView = new Uint8Array(this.buffer);
  32138. }
  32139. this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
  32140. source.offset = source.limit;
  32141. if (relative)
  32142. this.offset -= len;
  32143. return this;
  32144. };
  32145. /**
  32146. * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
  32147. * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
  32148. * will be resized and its contents moved accordingly.
  32149. * @param {!ByteBuffer} target Target ByteBuffer
  32150. * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
  32151. * prepended if omitted.
  32152. * @returns {!ByteBuffer} this
  32153. * @expose
  32154. * @see ByteBuffer#prepend
  32155. */
  32156. ByteBufferPrototype.prependTo = function(target, offset) {
  32157. target.prepend(this, offset);
  32158. return this;
  32159. };
  32160. /**
  32161. * Prints debug information about this ByteBuffer's contents.
  32162. * @param {function(string)=} out Output function to call, defaults to console.log
  32163. * @expose
  32164. */
  32165. ByteBufferPrototype.printDebug = function(out) {
  32166. if (typeof out !== 'function') out = console.log.bind(console);
  32167. out(
  32168. this.toString()+"\n"+
  32169. "-------------------------------------------------------------------\n"+
  32170. this.toDebug(/* columns */ true)
  32171. );
  32172. };
  32173. /**
  32174. * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
  32175. * {@link ByteBuffer#limit}, so this returns `limit - offset`.
  32176. * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
  32177. * @expose
  32178. */
  32179. ByteBufferPrototype.remaining = function() {
  32180. return this.limit - this.offset;
  32181. };
  32182. /**
  32183. * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
  32184. * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
  32185. * marked, sets `offset = 0`.
  32186. * @returns {!ByteBuffer} this
  32187. * @see ByteBuffer#mark
  32188. * @expose
  32189. */
  32190. ByteBufferPrototype.reset = function() {
  32191. if (this.markedOffset >= 0) {
  32192. this.offset = this.markedOffset;
  32193. this.markedOffset = -1;
  32194. } else {
  32195. this.offset = 0;
  32196. }
  32197. return this;
  32198. };
  32199. /**
  32200. * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
  32201. * large or larger.
  32202. * @param {number} capacity Capacity required
  32203. * @returns {!ByteBuffer} this
  32204. * @throws {TypeError} If `capacity` is not a number
  32205. * @throws {RangeError} If `capacity < 0`
  32206. * @expose
  32207. */
  32208. ByteBufferPrototype.resize = function(capacity) {
  32209. if (!this.noAssert) {
  32210. if (typeof capacity !== 'number' || capacity % 1 !== 0)
  32211. throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
  32212. capacity |= 0;
  32213. if (capacity < 0)
  32214. throw RangeError("Illegal capacity: 0 <= "+capacity);
  32215. }
  32216. if (this.buffer.byteLength < capacity) {
  32217. var buffer = new ArrayBuffer(capacity);
  32218. var view = new Uint8Array(buffer);
  32219. view.set(this.view);
  32220. this.buffer = buffer;
  32221. this.view = view;
  32222. }
  32223. return this;
  32224. };
  32225. /**
  32226. * Reverses this ByteBuffer's contents.
  32227. * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
  32228. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
  32229. * @returns {!ByteBuffer} this
  32230. * @expose
  32231. */
  32232. ByteBufferPrototype.reverse = function(begin, end) {
  32233. if (typeof begin === 'undefined') begin = this.offset;
  32234. if (typeof end === 'undefined') end = this.limit;
  32235. if (!this.noAssert) {
  32236. if (typeof begin !== 'number' || begin % 1 !== 0)
  32237. throw TypeError("Illegal begin: Not an integer");
  32238. begin >>>= 0;
  32239. if (typeof end !== 'number' || end % 1 !== 0)
  32240. throw TypeError("Illegal end: Not an integer");
  32241. end >>>= 0;
  32242. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  32243. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  32244. }
  32245. if (begin === end)
  32246. return this; // Nothing to reverse
  32247. Array.prototype.reverse.call(this.view.subarray(begin, end));
  32248. return this;
  32249. };
  32250. /**
  32251. * Skips the next `length` bytes. This will just advance
  32252. * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
  32253. * @returns {!ByteBuffer} this
  32254. * @expose
  32255. */
  32256. ByteBufferPrototype.skip = function(length) {
  32257. if (!this.noAssert) {
  32258. if (typeof length !== 'number' || length % 1 !== 0)
  32259. throw TypeError("Illegal length: "+length+" (not an integer)");
  32260. length |= 0;
  32261. }
  32262. var offset = this.offset + length;
  32263. if (!this.noAssert) {
  32264. if (offset < 0 || offset > this.buffer.byteLength)
  32265. throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
  32266. }
  32267. this.offset = offset;
  32268. return this;
  32269. };
  32270. /**
  32271. * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
  32272. * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
  32273. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
  32274. * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
  32275. * @expose
  32276. */
  32277. ByteBufferPrototype.slice = function(begin, end) {
  32278. if (typeof begin === 'undefined') begin = this.offset;
  32279. if (typeof end === 'undefined') end = this.limit;
  32280. if (!this.noAssert) {
  32281. if (typeof begin !== 'number' || begin % 1 !== 0)
  32282. throw TypeError("Illegal begin: Not an integer");
  32283. begin >>>= 0;
  32284. if (typeof end !== 'number' || end % 1 !== 0)
  32285. throw TypeError("Illegal end: Not an integer");
  32286. end >>>= 0;
  32287. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  32288. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  32289. }
  32290. var bb = this.clone();
  32291. bb.offset = begin;
  32292. bb.limit = end;
  32293. return bb;
  32294. };
  32295. /**
  32296. * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
  32297. * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
  32298. * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
  32299. * possible. Defaults to `false`
  32300. * @returns {!ArrayBuffer} Contents as an ArrayBuffer
  32301. * @expose
  32302. */
  32303. ByteBufferPrototype.toBuffer = function(forceCopy) {
  32304. var offset = this.offset,
  32305. limit = this.limit;
  32306. if (!this.noAssert) {
  32307. if (typeof offset !== 'number' || offset % 1 !== 0)
  32308. throw TypeError("Illegal offset: Not an integer");
  32309. offset >>>= 0;
  32310. if (typeof limit !== 'number' || limit % 1 !== 0)
  32311. throw TypeError("Illegal limit: Not an integer");
  32312. limit >>>= 0;
  32313. if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
  32314. throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
  32315. }
  32316. // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
  32317. // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
  32318. if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
  32319. return this.buffer;
  32320. if (offset === limit)
  32321. return EMPTY_BUFFER;
  32322. var buffer = new ArrayBuffer(limit - offset);
  32323. new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
  32324. return buffer;
  32325. };
  32326. /**
  32327. * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
  32328. * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
  32329. * @function
  32330. * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
  32331. * Defaults to `false`
  32332. * @returns {!ArrayBuffer} Contents as an ArrayBuffer
  32333. * @expose
  32334. */
  32335. ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
  32336. /**
  32337. * Converts the ByteBuffer's contents to a string.
  32338. * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
  32339. * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
  32340. * highlighted offsets.
  32341. * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
  32342. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
  32343. * @returns {string} String representation
  32344. * @throws {Error} If `encoding` is invalid
  32345. * @expose
  32346. */
  32347. ByteBufferPrototype.toString = function(encoding, begin, end) {
  32348. if (typeof encoding === 'undefined')
  32349. return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
  32350. if (typeof encoding === 'number')
  32351. encoding = "utf8",
  32352. begin = encoding,
  32353. end = begin;
  32354. switch (encoding) {
  32355. case "utf8":
  32356. return this.toUTF8(begin, end);
  32357. case "base64":
  32358. return this.toBase64(begin, end);
  32359. case "hex":
  32360. return this.toHex(begin, end);
  32361. case "binary":
  32362. return this.toBinary(begin, end);
  32363. case "debug":
  32364. return this.toDebug();
  32365. case "columns":
  32366. return this.toColumns();
  32367. default:
  32368. throw Error("Unsupported encoding: "+encoding);
  32369. }
  32370. };
  32371. // lxiv-embeddable
  32372. /**
  32373. * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
  32374. * Released under the Apache License, Version 2.0
  32375. * see: https://github.com/dcodeIO/lxiv for details
  32376. */
  32377. var lxiv = function() {
  32378. "use strict";
  32379. /**
  32380. * lxiv namespace.
  32381. * @type {!Object.<string,*>}
  32382. * @exports lxiv
  32383. */
  32384. var lxiv = {};
  32385. /**
  32386. * Character codes for output.
  32387. * @type {!Array.<number>}
  32388. * @inner
  32389. */
  32390. var aout = [
  32391. 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
  32392. 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
  32393. 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
  32394. 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
  32395. ];
  32396. /**
  32397. * Character codes for input.
  32398. * @type {!Array.<number>}
  32399. * @inner
  32400. */
  32401. var ain = [];
  32402. for (var i=0, k=aout.length; i<k; ++i)
  32403. ain[aout[i]] = i;
  32404. /**
  32405. * Encodes bytes to base64 char codes.
  32406. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
  32407. * there are no more bytes left.
  32408. * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
  32409. * code.
  32410. */
  32411. lxiv.encode = function(src, dst) {
  32412. var b, t;
  32413. while ((b = src()) !== null) {
  32414. dst(aout[(b>>2)&0x3f]);
  32415. t = (b&0x3)<<4;
  32416. if ((b = src()) !== null) {
  32417. t |= (b>>4)&0xf;
  32418. dst(aout[(t|((b>>4)&0xf))&0x3f]);
  32419. t = (b&0xf)<<2;
  32420. if ((b = src()) !== null)
  32421. dst(aout[(t|((b>>6)&0x3))&0x3f]),
  32422. dst(aout[b&0x3f]);
  32423. else
  32424. dst(aout[t&0x3f]),
  32425. dst(61);
  32426. } else
  32427. dst(aout[t&0x3f]),
  32428. dst(61),
  32429. dst(61);
  32430. }
  32431. };
  32432. /**
  32433. * Decodes base64 char codes to bytes.
  32434. * @param {!function():number|null} src Characters source as a function returning the next char code respectively
  32435. * `null` if there are no more characters left.
  32436. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
  32437. * @throws {Error} If a character code is invalid
  32438. */
  32439. lxiv.decode = function(src, dst) {
  32440. var c, t1, t2;
  32441. function fail(c) {
  32442. throw Error("Illegal character code: "+c);
  32443. }
  32444. while ((c = src()) !== null) {
  32445. t1 = ain[c];
  32446. if (typeof t1 === 'undefined') fail(c);
  32447. if ((c = src()) !== null) {
  32448. t2 = ain[c];
  32449. if (typeof t2 === 'undefined') fail(c);
  32450. dst((t1<<2)>>>0|(t2&0x30)>>4);
  32451. if ((c = src()) !== null) {
  32452. t1 = ain[c];
  32453. if (typeof t1 === 'undefined')
  32454. if (c === 61) break; else fail(c);
  32455. dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
  32456. if ((c = src()) !== null) {
  32457. t2 = ain[c];
  32458. if (typeof t2 === 'undefined')
  32459. if (c === 61) break; else fail(c);
  32460. dst(((t1&0x3)<<6)>>>0|t2);
  32461. }
  32462. }
  32463. }
  32464. }
  32465. };
  32466. /**
  32467. * Tests if a string is valid base64.
  32468. * @param {string} str String to test
  32469. * @returns {boolean} `true` if valid, otherwise `false`
  32470. */
  32471. lxiv.test = function(str) {
  32472. return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
  32473. };
  32474. return lxiv;
  32475. }();
  32476. // encodings/base64
  32477. /**
  32478. * Encodes this ByteBuffer's contents to a base64 encoded string.
  32479. * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
  32480. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
  32481. * @returns {string} Base64 encoded string
  32482. * @throws {RangeError} If `begin` or `end` is out of bounds
  32483. * @expose
  32484. */
  32485. ByteBufferPrototype.toBase64 = function(begin, end) {
  32486. if (typeof begin === 'undefined')
  32487. begin = this.offset;
  32488. if (typeof end === 'undefined')
  32489. end = this.limit;
  32490. begin = begin | 0; end = end | 0;
  32491. if (begin < 0 || end > this.capacity || begin > end)
  32492. throw RangeError("begin, end");
  32493. var sd; lxiv.encode(function() {
  32494. return begin < end ? this.view[begin++] : null;
  32495. }.bind(this), sd = stringDestination());
  32496. return sd();
  32497. };
  32498. /**
  32499. * Decodes a base64 encoded string to a ByteBuffer.
  32500. * @param {string} str String to decode
  32501. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  32502. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  32503. * @returns {!ByteBuffer} ByteBuffer
  32504. * @expose
  32505. */
  32506. ByteBuffer.fromBase64 = function(str, littleEndian) {
  32507. if (typeof str !== 'string')
  32508. throw TypeError("str");
  32509. var bb = new ByteBuffer(str.length/4*3, littleEndian),
  32510. i = 0;
  32511. lxiv.decode(stringSource(str), function(b) {
  32512. bb.view[i++] = b;
  32513. });
  32514. bb.limit = i;
  32515. return bb;
  32516. };
  32517. /**
  32518. * Encodes a binary string to base64 like `window.btoa` does.
  32519. * @param {string} str Binary string
  32520. * @returns {string} Base64 encoded string
  32521. * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
  32522. * @expose
  32523. */
  32524. ByteBuffer.btoa = function(str) {
  32525. return ByteBuffer.fromBinary(str).toBase64();
  32526. };
  32527. /**
  32528. * Decodes a base64 encoded string to binary like `window.atob` does.
  32529. * @param {string} b64 Base64 encoded string
  32530. * @returns {string} Binary string
  32531. * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
  32532. * @expose
  32533. */
  32534. ByteBuffer.atob = function(b64) {
  32535. return ByteBuffer.fromBase64(b64).toBinary();
  32536. };
  32537. // encodings/binary
  32538. /**
  32539. * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
  32540. * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
  32541. * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
  32542. * @returns {string} Binary encoded string
  32543. * @throws {RangeError} If `offset > limit`
  32544. * @expose
  32545. */
  32546. ByteBufferPrototype.toBinary = function(begin, end) {
  32547. if (typeof begin === 'undefined')
  32548. begin = this.offset;
  32549. if (typeof end === 'undefined')
  32550. end = this.limit;
  32551. begin |= 0; end |= 0;
  32552. if (begin < 0 || end > this.capacity() || begin > end)
  32553. throw RangeError("begin, end");
  32554. if (begin === end)
  32555. return "";
  32556. var chars = [],
  32557. parts = [];
  32558. while (begin < end) {
  32559. chars.push(this.view[begin++]);
  32560. if (chars.length >= 1024)
  32561. parts.push(String.fromCharCode.apply(String, chars)),
  32562. chars = [];
  32563. }
  32564. return parts.join('') + String.fromCharCode.apply(String, chars);
  32565. };
  32566. /**
  32567. * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
  32568. * @param {string} str String to decode
  32569. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  32570. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  32571. * @returns {!ByteBuffer} ByteBuffer
  32572. * @expose
  32573. */
  32574. ByteBuffer.fromBinary = function(str, littleEndian) {
  32575. if (typeof str !== 'string')
  32576. throw TypeError("str");
  32577. var i = 0,
  32578. k = str.length,
  32579. charCode,
  32580. bb = new ByteBuffer(k, littleEndian);
  32581. while (i<k) {
  32582. charCode = str.charCodeAt(i);
  32583. if (charCode > 0xff)
  32584. throw RangeError("illegal char code: "+charCode);
  32585. bb.view[i++] = charCode;
  32586. }
  32587. bb.limit = k;
  32588. return bb;
  32589. };
  32590. // encodings/debug
  32591. /**
  32592. * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
  32593. * * `<` : offset,
  32594. * * `'` : markedOffset,
  32595. * * `>` : limit,
  32596. * * `|` : offset and limit,
  32597. * * `[` : offset and markedOffset,
  32598. * * `]` : markedOffset and limit,
  32599. * * `!` : offset, markedOffset and limit
  32600. * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
  32601. * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
  32602. * @expose
  32603. * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
  32604. * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
  32605. * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
  32606. * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
  32607. */
  32608. ByteBufferPrototype.toDebug = function(columns) {
  32609. var i = -1,
  32610. k = this.buffer.byteLength,
  32611. b,
  32612. hex = "",
  32613. asc = "",
  32614. out = "";
  32615. while (i<k) {
  32616. if (i !== -1) {
  32617. b = this.view[i];
  32618. if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
  32619. else hex += b.toString(16).toUpperCase();
  32620. if (columns)
  32621. asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
  32622. }
  32623. ++i;
  32624. if (columns) {
  32625. if (i > 0 && i % 16 === 0 && i !== k) {
  32626. while (hex.length < 3*16+3) hex += " ";
  32627. out += hex+asc+"\n";
  32628. hex = asc = "";
  32629. }
  32630. }
  32631. if (i === this.offset && i === this.limit)
  32632. hex += i === this.markedOffset ? "!" : "|";
  32633. else if (i === this.offset)
  32634. hex += i === this.markedOffset ? "[" : "<";
  32635. else if (i === this.limit)
  32636. hex += i === this.markedOffset ? "]" : ">";
  32637. else
  32638. hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
  32639. }
  32640. if (columns && hex !== " ") {
  32641. while (hex.length < 3*16+3)
  32642. hex += " ";
  32643. out += hex + asc + "\n";
  32644. }
  32645. return columns ? out : hex;
  32646. };
  32647. /**
  32648. * Decodes a hex encoded string with marked offsets to a ByteBuffer.
  32649. * @param {string} str Debug string to decode (not be generated with `columns = true`)
  32650. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  32651. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  32652. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  32653. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  32654. * @returns {!ByteBuffer} ByteBuffer
  32655. * @expose
  32656. * @see ByteBuffer#toDebug
  32657. */
  32658. ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
  32659. var k = str.length,
  32660. bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
  32661. var i = 0, j = 0, ch, b,
  32662. rs = false, // Require symbol next
  32663. ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
  32664. fail = false;
  32665. while (i<k) {
  32666. switch (ch = str.charAt(i++)) {
  32667. case '!':
  32668. if (!noAssert) {
  32669. if (ho || hm || hl) {
  32670. fail = true;
  32671. break;
  32672. }
  32673. ho = hm = hl = true;
  32674. }
  32675. bb.offset = bb.markedOffset = bb.limit = j;
  32676. rs = false;
  32677. break;
  32678. case '|':
  32679. if (!noAssert) {
  32680. if (ho || hl) {
  32681. fail = true;
  32682. break;
  32683. }
  32684. ho = hl = true;
  32685. }
  32686. bb.offset = bb.limit = j;
  32687. rs = false;
  32688. break;
  32689. case '[':
  32690. if (!noAssert) {
  32691. if (ho || hm) {
  32692. fail = true;
  32693. break;
  32694. }
  32695. ho = hm = true;
  32696. }
  32697. bb.offset = bb.markedOffset = j;
  32698. rs = false;
  32699. break;
  32700. case '<':
  32701. if (!noAssert) {
  32702. if (ho) {
  32703. fail = true;
  32704. break;
  32705. }
  32706. ho = true;
  32707. }
  32708. bb.offset = j;
  32709. rs = false;
  32710. break;
  32711. case ']':
  32712. if (!noAssert) {
  32713. if (hl || hm) {
  32714. fail = true;
  32715. break;
  32716. }
  32717. hl = hm = true;
  32718. }
  32719. bb.limit = bb.markedOffset = j;
  32720. rs = false;
  32721. break;
  32722. case '>':
  32723. if (!noAssert) {
  32724. if (hl) {
  32725. fail = true;
  32726. break;
  32727. }
  32728. hl = true;
  32729. }
  32730. bb.limit = j;
  32731. rs = false;
  32732. break;
  32733. case "'":
  32734. if (!noAssert) {
  32735. if (hm) {
  32736. fail = true;
  32737. break;
  32738. }
  32739. hm = true;
  32740. }
  32741. bb.markedOffset = j;
  32742. rs = false;
  32743. break;
  32744. case ' ':
  32745. rs = false;
  32746. break;
  32747. default:
  32748. if (!noAssert) {
  32749. if (rs) {
  32750. fail = true;
  32751. break;
  32752. }
  32753. }
  32754. b = parseInt(ch+str.charAt(i++), 16);
  32755. if (!noAssert) {
  32756. if (isNaN(b) || b < 0 || b > 255)
  32757. throw TypeError("Illegal str: Not a debug encoded string");
  32758. }
  32759. bb.view[j++] = b;
  32760. rs = true;
  32761. }
  32762. if (fail)
  32763. throw TypeError("Illegal str: Invalid symbol at "+i);
  32764. }
  32765. if (!noAssert) {
  32766. if (!ho || !hl)
  32767. throw TypeError("Illegal str: Missing offset or limit");
  32768. if (j<bb.buffer.byteLength)
  32769. throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
  32770. }
  32771. return bb;
  32772. };
  32773. // encodings/hex
  32774. /**
  32775. * Encodes this ByteBuffer's contents to a hex encoded string.
  32776. * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
  32777. * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
  32778. * @returns {string} Hex encoded string
  32779. * @expose
  32780. */
  32781. ByteBufferPrototype.toHex = function(begin, end) {
  32782. begin = typeof begin === 'undefined' ? this.offset : begin;
  32783. end = typeof end === 'undefined' ? this.limit : end;
  32784. if (!this.noAssert) {
  32785. if (typeof begin !== 'number' || begin % 1 !== 0)
  32786. throw TypeError("Illegal begin: Not an integer");
  32787. begin >>>= 0;
  32788. if (typeof end !== 'number' || end % 1 !== 0)
  32789. throw TypeError("Illegal end: Not an integer");
  32790. end >>>= 0;
  32791. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  32792. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  32793. }
  32794. var out = new Array(end - begin),
  32795. b;
  32796. while (begin < end) {
  32797. b = this.view[begin++];
  32798. if (b < 0x10)
  32799. out.push("0", b.toString(16));
  32800. else out.push(b.toString(16));
  32801. }
  32802. return out.join('');
  32803. };
  32804. /**
  32805. * Decodes a hex encoded string to a ByteBuffer.
  32806. * @param {string} str String to decode
  32807. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  32808. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  32809. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  32810. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  32811. * @returns {!ByteBuffer} ByteBuffer
  32812. * @expose
  32813. */
  32814. ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
  32815. if (!noAssert) {
  32816. if (typeof str !== 'string')
  32817. throw TypeError("Illegal str: Not a string");
  32818. if (str.length % 2 !== 0)
  32819. throw TypeError("Illegal str: Length not a multiple of 2");
  32820. }
  32821. var k = str.length,
  32822. bb = new ByteBuffer((k / 2) | 0, littleEndian),
  32823. b;
  32824. for (var i=0, j=0; i<k; i+=2) {
  32825. b = parseInt(str.substring(i, i+2), 16);
  32826. if (!noAssert)
  32827. if (!isFinite(b) || b < 0 || b > 255)
  32828. throw TypeError("Illegal str: Contains non-hex characters");
  32829. bb.view[j++] = b;
  32830. }
  32831. bb.limit = j;
  32832. return bb;
  32833. };
  32834. // utfx-embeddable
  32835. /**
  32836. * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
  32837. * Released under the Apache License, Version 2.0
  32838. * see: https://github.com/dcodeIO/utfx for details
  32839. */
  32840. var utfx = function() {
  32841. "use strict";
  32842. /**
  32843. * utfx namespace.
  32844. * @inner
  32845. * @type {!Object.<string,*>}
  32846. */
  32847. var utfx = {};
  32848. /**
  32849. * Maximum valid code point.
  32850. * @type {number}
  32851. * @const
  32852. */
  32853. utfx.MAX_CODEPOINT = 0x10FFFF;
  32854. /**
  32855. * Encodes UTF8 code points to UTF8 bytes.
  32856. * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
  32857. * respectively `null` if there are no more code points left or a single numeric code point.
  32858. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
  32859. */
  32860. utfx.encodeUTF8 = function(src, dst) {
  32861. var cp = null;
  32862. if (typeof src === 'number')
  32863. cp = src,
  32864. src = function() { return null; };
  32865. while (cp !== null || (cp = src()) !== null) {
  32866. if (cp < 0x80)
  32867. dst(cp&0x7F);
  32868. else if (cp < 0x800)
  32869. dst(((cp>>6)&0x1F)|0xC0),
  32870. dst((cp&0x3F)|0x80);
  32871. else if (cp < 0x10000)
  32872. dst(((cp>>12)&0x0F)|0xE0),
  32873. dst(((cp>>6)&0x3F)|0x80),
  32874. dst((cp&0x3F)|0x80);
  32875. else
  32876. dst(((cp>>18)&0x07)|0xF0),
  32877. dst(((cp>>12)&0x3F)|0x80),
  32878. dst(((cp>>6)&0x3F)|0x80),
  32879. dst((cp&0x3F)|0x80);
  32880. cp = null;
  32881. }
  32882. };
  32883. /**
  32884. * Decodes UTF8 bytes to UTF8 code points.
  32885. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
  32886. * are no more bytes left.
  32887. * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
  32888. * @throws {RangeError} If a starting byte is invalid in UTF8
  32889. * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
  32890. * remaining bytes.
  32891. */
  32892. utfx.decodeUTF8 = function(src, dst) {
  32893. var a, b, c, d, fail = function(b) {
  32894. b = b.slice(0, b.indexOf(null));
  32895. var err = Error(b.toString());
  32896. err.name = "TruncatedError";
  32897. err['bytes'] = b;
  32898. throw err;
  32899. };
  32900. while ((a = src()) !== null) {
  32901. if ((a&0x80) === 0)
  32902. dst(a);
  32903. else if ((a&0xE0) === 0xC0)
  32904. ((b = src()) === null) && fail([a, b]),
  32905. dst(((a&0x1F)<<6) | (b&0x3F));
  32906. else if ((a&0xF0) === 0xE0)
  32907. ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
  32908. dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
  32909. else if ((a&0xF8) === 0xF0)
  32910. ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
  32911. dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
  32912. else throw RangeError("Illegal starting byte: "+a);
  32913. }
  32914. };
  32915. /**
  32916. * Converts UTF16 characters to UTF8 code points.
  32917. * @param {!function():number|null} src Characters source as a function returning the next char code respectively
  32918. * `null` if there are no more characters left.
  32919. * @param {!function(number)} dst Code points destination as a function successively called with each converted code
  32920. * point.
  32921. */
  32922. utfx.UTF16toUTF8 = function(src, dst) {
  32923. var c1, c2 = null;
  32924. while (true) {
  32925. if ((c1 = c2 !== null ? c2 : src()) === null)
  32926. break;
  32927. if (c1 >= 0xD800 && c1 <= 0xDFFF) {
  32928. if ((c2 = src()) !== null) {
  32929. if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
  32930. dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
  32931. c2 = null; continue;
  32932. }
  32933. }
  32934. }
  32935. dst(c1);
  32936. }
  32937. if (c2 !== null) dst(c2);
  32938. };
  32939. /**
  32940. * Converts UTF8 code points to UTF16 characters.
  32941. * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
  32942. * respectively `null` if there are no more code points left or a single numeric code point.
  32943. * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
  32944. * @throws {RangeError} If a code point is out of range
  32945. */
  32946. utfx.UTF8toUTF16 = function(src, dst) {
  32947. var cp = null;
  32948. if (typeof src === 'number')
  32949. cp = src, src = function() { return null; };
  32950. while (cp !== null || (cp = src()) !== null) {
  32951. if (cp <= 0xFFFF)
  32952. dst(cp);
  32953. else
  32954. cp -= 0x10000,
  32955. dst((cp>>10)+0xD800),
  32956. dst((cp%0x400)+0xDC00);
  32957. cp = null;
  32958. }
  32959. };
  32960. /**
  32961. * Converts and encodes UTF16 characters to UTF8 bytes.
  32962. * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
  32963. * if there are no more characters left.
  32964. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
  32965. */
  32966. utfx.encodeUTF16toUTF8 = function(src, dst) {
  32967. utfx.UTF16toUTF8(src, function(cp) {
  32968. utfx.encodeUTF8(cp, dst);
  32969. });
  32970. };
  32971. /**
  32972. * Decodes and converts UTF8 bytes to UTF16 characters.
  32973. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
  32974. * are no more bytes left.
  32975. * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
  32976. * @throws {RangeError} If a starting byte is invalid in UTF8
  32977. * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
  32978. */
  32979. utfx.decodeUTF8toUTF16 = function(src, dst) {
  32980. utfx.decodeUTF8(src, function(cp) {
  32981. utfx.UTF8toUTF16(cp, dst);
  32982. });
  32983. };
  32984. /**
  32985. * Calculates the byte length of an UTF8 code point.
  32986. * @param {number} cp UTF8 code point
  32987. * @returns {number} Byte length
  32988. */
  32989. utfx.calculateCodePoint = function(cp) {
  32990. return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
  32991. };
  32992. /**
  32993. * Calculates the number of UTF8 bytes required to store UTF8 code points.
  32994. * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
  32995. * `null` if there are no more code points left.
  32996. * @returns {number} The number of UTF8 bytes required
  32997. */
  32998. utfx.calculateUTF8 = function(src) {
  32999. var cp, l=0;
  33000. while ((cp = src()) !== null)
  33001. l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
  33002. return l;
  33003. };
  33004. /**
  33005. * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
  33006. * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
  33007. * `null` if there are no more characters left.
  33008. * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
  33009. */
  33010. utfx.calculateUTF16asUTF8 = function(src) {
  33011. var n=0, l=0;
  33012. utfx.UTF16toUTF8(src, function(cp) {
  33013. ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
  33014. });
  33015. return [n,l];
  33016. };
  33017. return utfx;
  33018. }();
  33019. // encodings/utf8
  33020. /**
  33021. * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
  33022. * string.
  33023. * @returns {string} Hex encoded string
  33024. * @throws {RangeError} If `offset > limit`
  33025. * @expose
  33026. */
  33027. ByteBufferPrototype.toUTF8 = function(begin, end) {
  33028. if (typeof begin === 'undefined') begin = this.offset;
  33029. if (typeof end === 'undefined') end = this.limit;
  33030. if (!this.noAssert) {
  33031. if (typeof begin !== 'number' || begin % 1 !== 0)
  33032. throw TypeError("Illegal begin: Not an integer");
  33033. begin >>>= 0;
  33034. if (typeof end !== 'number' || end % 1 !== 0)
  33035. throw TypeError("Illegal end: Not an integer");
  33036. end >>>= 0;
  33037. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  33038. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  33039. }
  33040. var sd; try {
  33041. utfx.decodeUTF8toUTF16(function() {
  33042. return begin < end ? this.view[begin++] : null;
  33043. }.bind(this), sd = stringDestination());
  33044. } catch (e) {
  33045. if (begin !== end)
  33046. throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
  33047. }
  33048. return sd();
  33049. };
  33050. /**
  33051. * Decodes an UTF8 encoded string to a ByteBuffer.
  33052. * @param {string} str String to decode
  33053. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  33054. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  33055. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  33056. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  33057. * @returns {!ByteBuffer} ByteBuffer
  33058. * @expose
  33059. */
  33060. ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
  33061. if (!noAssert)
  33062. if (typeof str !== 'string')
  33063. throw TypeError("Illegal str: Not a string");
  33064. var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
  33065. i = 0;
  33066. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  33067. bb.view[i++] = b;
  33068. });
  33069. bb.limit = i;
  33070. return bb;
  33071. };
  33072. return ByteBuffer;
  33073. });
  33074. /***/ }),
  33075. /* 614 */
  33076. /***/ (function(module, exports, __webpack_require__) {
  33077. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
  33078. Copyright 2013 Daniel Wirtz <dcode@dcode.io>
  33079. Copyright 2009 The Closure Library Authors. All Rights Reserved.
  33080. Licensed under the Apache License, Version 2.0 (the "License");
  33081. you may not use this file except in compliance with the License.
  33082. You may obtain a copy of the License at
  33083. http://www.apache.org/licenses/LICENSE-2.0
  33084. Unless required by applicable law or agreed to in writing, software
  33085. distributed under the License is distributed on an "AS-IS" BASIS,
  33086. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  33087. See the License for the specific language governing permissions and
  33088. limitations under the License.
  33089. */
  33090. /**
  33091. * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
  33092. * Released under the Apache License, Version 2.0
  33093. * see: https://github.com/dcodeIO/long.js for details
  33094. */
  33095. (function(global, factory) {
  33096. /* AMD */ if (true)
  33097. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  33098. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  33099. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  33100. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33101. /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
  33102. module["exports"] = factory();
  33103. /* Global */ else
  33104. (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
  33105. })(this, function() {
  33106. "use strict";
  33107. /**
  33108. * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
  33109. * See the from* functions below for more convenient ways of constructing Longs.
  33110. * @exports Long
  33111. * @class A Long class for representing a 64 bit two's-complement integer value.
  33112. * @param {number} low The low (signed) 32 bits of the long
  33113. * @param {number} high The high (signed) 32 bits of the long
  33114. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  33115. * @constructor
  33116. */
  33117. function Long(low, high, unsigned) {
  33118. /**
  33119. * The low 32 bits as a signed value.
  33120. * @type {number}
  33121. */
  33122. this.low = low | 0;
  33123. /**
  33124. * The high 32 bits as a signed value.
  33125. * @type {number}
  33126. */
  33127. this.high = high | 0;
  33128. /**
  33129. * Whether unsigned or not.
  33130. * @type {boolean}
  33131. */
  33132. this.unsigned = !!unsigned;
  33133. }
  33134. // The internal representation of a long is the two given signed, 32-bit values.
  33135. // We use 32-bit pieces because these are the size of integers on which
  33136. // Javascript performs bit-operations. For operations like addition and
  33137. // multiplication, we split each number into 16 bit pieces, which can easily be
  33138. // multiplied within Javascript's floating-point representation without overflow
  33139. // or change in sign.
  33140. //
  33141. // In the algorithms below, we frequently reduce the negative case to the
  33142. // positive case by negating the input(s) and then post-processing the result.
  33143. // Note that we must ALWAYS check specially whether those values are MIN_VALUE
  33144. // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
  33145. // a positive number, it overflows back into a negative). Not handling this
  33146. // case would often result in infinite recursion.
  33147. //
  33148. // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
  33149. // methods on which they depend.
  33150. /**
  33151. * An indicator used to reliably determine if an object is a Long or not.
  33152. * @type {boolean}
  33153. * @const
  33154. * @private
  33155. */
  33156. Long.prototype.__isLong__;
  33157. Object.defineProperty(Long.prototype, "__isLong__", {
  33158. value: true,
  33159. enumerable: false,
  33160. configurable: false
  33161. });
  33162. /**
  33163. * @function
  33164. * @param {*} obj Object
  33165. * @returns {boolean}
  33166. * @inner
  33167. */
  33168. function isLong(obj) {
  33169. return (obj && obj["__isLong__"]) === true;
  33170. }
  33171. /**
  33172. * Tests if the specified object is a Long.
  33173. * @function
  33174. * @param {*} obj Object
  33175. * @returns {boolean}
  33176. */
  33177. Long.isLong = isLong;
  33178. /**
  33179. * A cache of the Long representations of small integer values.
  33180. * @type {!Object}
  33181. * @inner
  33182. */
  33183. var INT_CACHE = {};
  33184. /**
  33185. * A cache of the Long representations of small unsigned integer values.
  33186. * @type {!Object}
  33187. * @inner
  33188. */
  33189. var UINT_CACHE = {};
  33190. /**
  33191. * @param {number} value
  33192. * @param {boolean=} unsigned
  33193. * @returns {!Long}
  33194. * @inner
  33195. */
  33196. function fromInt(value, unsigned) {
  33197. var obj, cachedObj, cache;
  33198. if (unsigned) {
  33199. value >>>= 0;
  33200. if (cache = (0 <= value && value < 256)) {
  33201. cachedObj = UINT_CACHE[value];
  33202. if (cachedObj)
  33203. return cachedObj;
  33204. }
  33205. obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
  33206. if (cache)
  33207. UINT_CACHE[value] = obj;
  33208. return obj;
  33209. } else {
  33210. value |= 0;
  33211. if (cache = (-128 <= value && value < 128)) {
  33212. cachedObj = INT_CACHE[value];
  33213. if (cachedObj)
  33214. return cachedObj;
  33215. }
  33216. obj = fromBits(value, value < 0 ? -1 : 0, false);
  33217. if (cache)
  33218. INT_CACHE[value] = obj;
  33219. return obj;
  33220. }
  33221. }
  33222. /**
  33223. * Returns a Long representing the given 32 bit integer value.
  33224. * @function
  33225. * @param {number} value The 32 bit integer in question
  33226. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  33227. * @returns {!Long} The corresponding Long value
  33228. */
  33229. Long.fromInt = fromInt;
  33230. /**
  33231. * @param {number} value
  33232. * @param {boolean=} unsigned
  33233. * @returns {!Long}
  33234. * @inner
  33235. */
  33236. function fromNumber(value, unsigned) {
  33237. if (isNaN(value) || !isFinite(value))
  33238. return unsigned ? UZERO : ZERO;
  33239. if (unsigned) {
  33240. if (value < 0)
  33241. return UZERO;
  33242. if (value >= TWO_PWR_64_DBL)
  33243. return MAX_UNSIGNED_VALUE;
  33244. } else {
  33245. if (value <= -TWO_PWR_63_DBL)
  33246. return MIN_VALUE;
  33247. if (value + 1 >= TWO_PWR_63_DBL)
  33248. return MAX_VALUE;
  33249. }
  33250. if (value < 0)
  33251. return fromNumber(-value, unsigned).neg();
  33252. return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
  33253. }
  33254. /**
  33255. * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
  33256. * @function
  33257. * @param {number} value The number in question
  33258. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  33259. * @returns {!Long} The corresponding Long value
  33260. */
  33261. Long.fromNumber = fromNumber;
  33262. /**
  33263. * @param {number} lowBits
  33264. * @param {number} highBits
  33265. * @param {boolean=} unsigned
  33266. * @returns {!Long}
  33267. * @inner
  33268. */
  33269. function fromBits(lowBits, highBits, unsigned) {
  33270. return new Long(lowBits, highBits, unsigned);
  33271. }
  33272. /**
  33273. * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
  33274. * assumed to use 32 bits.
  33275. * @function
  33276. * @param {number} lowBits The low 32 bits
  33277. * @param {number} highBits The high 32 bits
  33278. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  33279. * @returns {!Long} The corresponding Long value
  33280. */
  33281. Long.fromBits = fromBits;
  33282. /**
  33283. * @function
  33284. * @param {number} base
  33285. * @param {number} exponent
  33286. * @returns {number}
  33287. * @inner
  33288. */
  33289. var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
  33290. /**
  33291. * @param {string} str
  33292. * @param {(boolean|number)=} unsigned
  33293. * @param {number=} radix
  33294. * @returns {!Long}
  33295. * @inner
  33296. */
  33297. function fromString(str, unsigned, radix) {
  33298. if (str.length === 0)
  33299. throw Error('empty string');
  33300. if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
  33301. return ZERO;
  33302. if (typeof unsigned === 'number') {
  33303. // For goog.math.long compatibility
  33304. radix = unsigned,
  33305. unsigned = false;
  33306. } else {
  33307. unsigned = !! unsigned;
  33308. }
  33309. radix = radix || 10;
  33310. if (radix < 2 || 36 < radix)
  33311. throw RangeError('radix');
  33312. var p;
  33313. if ((p = str.indexOf('-')) > 0)
  33314. throw Error('interior hyphen');
  33315. else if (p === 0) {
  33316. return fromString(str.substring(1), unsigned, radix).neg();
  33317. }
  33318. // Do several (8) digits each time through the loop, so as to
  33319. // minimize the calls to the very expensive emulated div.
  33320. var radixToPower = fromNumber(pow_dbl(radix, 8));
  33321. var result = ZERO;
  33322. for (var i = 0; i < str.length; i += 8) {
  33323. var size = Math.min(8, str.length - i),
  33324. value = parseInt(str.substring(i, i + size), radix);
  33325. if (size < 8) {
  33326. var power = fromNumber(pow_dbl(radix, size));
  33327. result = result.mul(power).add(fromNumber(value));
  33328. } else {
  33329. result = result.mul(radixToPower);
  33330. result = result.add(fromNumber(value));
  33331. }
  33332. }
  33333. result.unsigned = unsigned;
  33334. return result;
  33335. }
  33336. /**
  33337. * Returns a Long representation of the given string, written using the specified radix.
  33338. * @function
  33339. * @param {string} str The textual representation of the Long
  33340. * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
  33341. * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
  33342. * @returns {!Long} The corresponding Long value
  33343. */
  33344. Long.fromString = fromString;
  33345. /**
  33346. * @function
  33347. * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
  33348. * @returns {!Long}
  33349. * @inner
  33350. */
  33351. function fromValue(val) {
  33352. if (val /* is compatible */ instanceof Long)
  33353. return val;
  33354. if (typeof val === 'number')
  33355. return fromNumber(val);
  33356. if (typeof val === 'string')
  33357. return fromString(val);
  33358. // Throws for non-objects, converts non-instanceof Long:
  33359. return fromBits(val.low, val.high, val.unsigned);
  33360. }
  33361. /**
  33362. * Converts the specified value to a Long.
  33363. * @function
  33364. * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
  33365. * @returns {!Long}
  33366. */
  33367. Long.fromValue = fromValue;
  33368. // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
  33369. // no runtime penalty for these.
  33370. /**
  33371. * @type {number}
  33372. * @const
  33373. * @inner
  33374. */
  33375. var TWO_PWR_16_DBL = 1 << 16;
  33376. /**
  33377. * @type {number}
  33378. * @const
  33379. * @inner
  33380. */
  33381. var TWO_PWR_24_DBL = 1 << 24;
  33382. /**
  33383. * @type {number}
  33384. * @const
  33385. * @inner
  33386. */
  33387. var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
  33388. /**
  33389. * @type {number}
  33390. * @const
  33391. * @inner
  33392. */
  33393. var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
  33394. /**
  33395. * @type {number}
  33396. * @const
  33397. * @inner
  33398. */
  33399. var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
  33400. /**
  33401. * @type {!Long}
  33402. * @const
  33403. * @inner
  33404. */
  33405. var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
  33406. /**
  33407. * @type {!Long}
  33408. * @inner
  33409. */
  33410. var ZERO = fromInt(0);
  33411. /**
  33412. * Signed zero.
  33413. * @type {!Long}
  33414. */
  33415. Long.ZERO = ZERO;
  33416. /**
  33417. * @type {!Long}
  33418. * @inner
  33419. */
  33420. var UZERO = fromInt(0, true);
  33421. /**
  33422. * Unsigned zero.
  33423. * @type {!Long}
  33424. */
  33425. Long.UZERO = UZERO;
  33426. /**
  33427. * @type {!Long}
  33428. * @inner
  33429. */
  33430. var ONE = fromInt(1);
  33431. /**
  33432. * Signed one.
  33433. * @type {!Long}
  33434. */
  33435. Long.ONE = ONE;
  33436. /**
  33437. * @type {!Long}
  33438. * @inner
  33439. */
  33440. var UONE = fromInt(1, true);
  33441. /**
  33442. * Unsigned one.
  33443. * @type {!Long}
  33444. */
  33445. Long.UONE = UONE;
  33446. /**
  33447. * @type {!Long}
  33448. * @inner
  33449. */
  33450. var NEG_ONE = fromInt(-1);
  33451. /**
  33452. * Signed negative one.
  33453. * @type {!Long}
  33454. */
  33455. Long.NEG_ONE = NEG_ONE;
  33456. /**
  33457. * @type {!Long}
  33458. * @inner
  33459. */
  33460. var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
  33461. /**
  33462. * Maximum signed value.
  33463. * @type {!Long}
  33464. */
  33465. Long.MAX_VALUE = MAX_VALUE;
  33466. /**
  33467. * @type {!Long}
  33468. * @inner
  33469. */
  33470. var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
  33471. /**
  33472. * Maximum unsigned value.
  33473. * @type {!Long}
  33474. */
  33475. Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
  33476. /**
  33477. * @type {!Long}
  33478. * @inner
  33479. */
  33480. var MIN_VALUE = fromBits(0, 0x80000000|0, false);
  33481. /**
  33482. * Minimum signed value.
  33483. * @type {!Long}
  33484. */
  33485. Long.MIN_VALUE = MIN_VALUE;
  33486. /**
  33487. * @alias Long.prototype
  33488. * @inner
  33489. */
  33490. var LongPrototype = Long.prototype;
  33491. /**
  33492. * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
  33493. * @returns {number}
  33494. */
  33495. LongPrototype.toInt = function toInt() {
  33496. return this.unsigned ? this.low >>> 0 : this.low;
  33497. };
  33498. /**
  33499. * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
  33500. * @returns {number}
  33501. */
  33502. LongPrototype.toNumber = function toNumber() {
  33503. if (this.unsigned)
  33504. return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
  33505. return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
  33506. };
  33507. /**
  33508. * Converts the Long to a string written in the specified radix.
  33509. * @param {number=} radix Radix (2-36), defaults to 10
  33510. * @returns {string}
  33511. * @override
  33512. * @throws {RangeError} If `radix` is out of range
  33513. */
  33514. LongPrototype.toString = function toString(radix) {
  33515. radix = radix || 10;
  33516. if (radix < 2 || 36 < radix)
  33517. throw RangeError('radix');
  33518. if (this.isZero())
  33519. return '0';
  33520. if (this.isNegative()) { // Unsigned Longs are never negative
  33521. if (this.eq(MIN_VALUE)) {
  33522. // We need to change the Long value before it can be negated, so we remove
  33523. // the bottom-most digit in this base and then recurse to do the rest.
  33524. var radixLong = fromNumber(radix),
  33525. div = this.div(radixLong),
  33526. rem1 = div.mul(radixLong).sub(this);
  33527. return div.toString(radix) + rem1.toInt().toString(radix);
  33528. } else
  33529. return '-' + this.neg().toString(radix);
  33530. }
  33531. // Do several (6) digits each time through the loop, so as to
  33532. // minimize the calls to the very expensive emulated div.
  33533. var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
  33534. rem = this;
  33535. var result = '';
  33536. while (true) {
  33537. var remDiv = rem.div(radixToPower),
  33538. intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
  33539. digits = intval.toString(radix);
  33540. rem = remDiv;
  33541. if (rem.isZero())
  33542. return digits + result;
  33543. else {
  33544. while (digits.length < 6)
  33545. digits = '0' + digits;
  33546. result = '' + digits + result;
  33547. }
  33548. }
  33549. };
  33550. /**
  33551. * Gets the high 32 bits as a signed integer.
  33552. * @returns {number} Signed high bits
  33553. */
  33554. LongPrototype.getHighBits = function getHighBits() {
  33555. return this.high;
  33556. };
  33557. /**
  33558. * Gets the high 32 bits as an unsigned integer.
  33559. * @returns {number} Unsigned high bits
  33560. */
  33561. LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
  33562. return this.high >>> 0;
  33563. };
  33564. /**
  33565. * Gets the low 32 bits as a signed integer.
  33566. * @returns {number} Signed low bits
  33567. */
  33568. LongPrototype.getLowBits = function getLowBits() {
  33569. return this.low;
  33570. };
  33571. /**
  33572. * Gets the low 32 bits as an unsigned integer.
  33573. * @returns {number} Unsigned low bits
  33574. */
  33575. LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
  33576. return this.low >>> 0;
  33577. };
  33578. /**
  33579. * Gets the number of bits needed to represent the absolute value of this Long.
  33580. * @returns {number}
  33581. */
  33582. LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
  33583. if (this.isNegative()) // Unsigned Longs are never negative
  33584. return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
  33585. var val = this.high != 0 ? this.high : this.low;
  33586. for (var bit = 31; bit > 0; bit--)
  33587. if ((val & (1 << bit)) != 0)
  33588. break;
  33589. return this.high != 0 ? bit + 33 : bit + 1;
  33590. };
  33591. /**
  33592. * Tests if this Long's value equals zero.
  33593. * @returns {boolean}
  33594. */
  33595. LongPrototype.isZero = function isZero() {
  33596. return this.high === 0 && this.low === 0;
  33597. };
  33598. /**
  33599. * Tests if this Long's value is negative.
  33600. * @returns {boolean}
  33601. */
  33602. LongPrototype.isNegative = function isNegative() {
  33603. return !this.unsigned && this.high < 0;
  33604. };
  33605. /**
  33606. * Tests if this Long's value is positive.
  33607. * @returns {boolean}
  33608. */
  33609. LongPrototype.isPositive = function isPositive() {
  33610. return this.unsigned || this.high >= 0;
  33611. };
  33612. /**
  33613. * Tests if this Long's value is odd.
  33614. * @returns {boolean}
  33615. */
  33616. LongPrototype.isOdd = function isOdd() {
  33617. return (this.low & 1) === 1;
  33618. };
  33619. /**
  33620. * Tests if this Long's value is even.
  33621. * @returns {boolean}
  33622. */
  33623. LongPrototype.isEven = function isEven() {
  33624. return (this.low & 1) === 0;
  33625. };
  33626. /**
  33627. * Tests if this Long's value equals the specified's.
  33628. * @param {!Long|number|string} other Other value
  33629. * @returns {boolean}
  33630. */
  33631. LongPrototype.equals = function equals(other) {
  33632. if (!isLong(other))
  33633. other = fromValue(other);
  33634. if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
  33635. return false;
  33636. return this.high === other.high && this.low === other.low;
  33637. };
  33638. /**
  33639. * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
  33640. * @function
  33641. * @param {!Long|number|string} other Other value
  33642. * @returns {boolean}
  33643. */
  33644. LongPrototype.eq = LongPrototype.equals;
  33645. /**
  33646. * Tests if this Long's value differs from the specified's.
  33647. * @param {!Long|number|string} other Other value
  33648. * @returns {boolean}
  33649. */
  33650. LongPrototype.notEquals = function notEquals(other) {
  33651. return !this.eq(/* validates */ other);
  33652. };
  33653. /**
  33654. * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
  33655. * @function
  33656. * @param {!Long|number|string} other Other value
  33657. * @returns {boolean}
  33658. */
  33659. LongPrototype.neq = LongPrototype.notEquals;
  33660. /**
  33661. * Tests if this Long's value is less than the specified's.
  33662. * @param {!Long|number|string} other Other value
  33663. * @returns {boolean}
  33664. */
  33665. LongPrototype.lessThan = function lessThan(other) {
  33666. return this.comp(/* validates */ other) < 0;
  33667. };
  33668. /**
  33669. * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
  33670. * @function
  33671. * @param {!Long|number|string} other Other value
  33672. * @returns {boolean}
  33673. */
  33674. LongPrototype.lt = LongPrototype.lessThan;
  33675. /**
  33676. * Tests if this Long's value is less than or equal the specified's.
  33677. * @param {!Long|number|string} other Other value
  33678. * @returns {boolean}
  33679. */
  33680. LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
  33681. return this.comp(/* validates */ other) <= 0;
  33682. };
  33683. /**
  33684. * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
  33685. * @function
  33686. * @param {!Long|number|string} other Other value
  33687. * @returns {boolean}
  33688. */
  33689. LongPrototype.lte = LongPrototype.lessThanOrEqual;
  33690. /**
  33691. * Tests if this Long's value is greater than the specified's.
  33692. * @param {!Long|number|string} other Other value
  33693. * @returns {boolean}
  33694. */
  33695. LongPrototype.greaterThan = function greaterThan(other) {
  33696. return this.comp(/* validates */ other) > 0;
  33697. };
  33698. /**
  33699. * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
  33700. * @function
  33701. * @param {!Long|number|string} other Other value
  33702. * @returns {boolean}
  33703. */
  33704. LongPrototype.gt = LongPrototype.greaterThan;
  33705. /**
  33706. * Tests if this Long's value is greater than or equal the specified's.
  33707. * @param {!Long|number|string} other Other value
  33708. * @returns {boolean}
  33709. */
  33710. LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
  33711. return this.comp(/* validates */ other) >= 0;
  33712. };
  33713. /**
  33714. * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
  33715. * @function
  33716. * @param {!Long|number|string} other Other value
  33717. * @returns {boolean}
  33718. */
  33719. LongPrototype.gte = LongPrototype.greaterThanOrEqual;
  33720. /**
  33721. * Compares this Long's value with the specified's.
  33722. * @param {!Long|number|string} other Other value
  33723. * @returns {number} 0 if they are the same, 1 if the this is greater and -1
  33724. * if the given one is greater
  33725. */
  33726. LongPrototype.compare = function compare(other) {
  33727. if (!isLong(other))
  33728. other = fromValue(other);
  33729. if (this.eq(other))
  33730. return 0;
  33731. var thisNeg = this.isNegative(),
  33732. otherNeg = other.isNegative();
  33733. if (thisNeg && !otherNeg)
  33734. return -1;
  33735. if (!thisNeg && otherNeg)
  33736. return 1;
  33737. // At this point the sign bits are the same
  33738. if (!this.unsigned)
  33739. return this.sub(other).isNegative() ? -1 : 1;
  33740. // Both are positive if at least one is unsigned
  33741. return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
  33742. };
  33743. /**
  33744. * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
  33745. * @function
  33746. * @param {!Long|number|string} other Other value
  33747. * @returns {number} 0 if they are the same, 1 if the this is greater and -1
  33748. * if the given one is greater
  33749. */
  33750. LongPrototype.comp = LongPrototype.compare;
  33751. /**
  33752. * Negates this Long's value.
  33753. * @returns {!Long} Negated Long
  33754. */
  33755. LongPrototype.negate = function negate() {
  33756. if (!this.unsigned && this.eq(MIN_VALUE))
  33757. return MIN_VALUE;
  33758. return this.not().add(ONE);
  33759. };
  33760. /**
  33761. * Negates this Long's value. This is an alias of {@link Long#negate}.
  33762. * @function
  33763. * @returns {!Long} Negated Long
  33764. */
  33765. LongPrototype.neg = LongPrototype.negate;
  33766. /**
  33767. * Returns the sum of this and the specified Long.
  33768. * @param {!Long|number|string} addend Addend
  33769. * @returns {!Long} Sum
  33770. */
  33771. LongPrototype.add = function add(addend) {
  33772. if (!isLong(addend))
  33773. addend = fromValue(addend);
  33774. // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
  33775. var a48 = this.high >>> 16;
  33776. var a32 = this.high & 0xFFFF;
  33777. var a16 = this.low >>> 16;
  33778. var a00 = this.low & 0xFFFF;
  33779. var b48 = addend.high >>> 16;
  33780. var b32 = addend.high & 0xFFFF;
  33781. var b16 = addend.low >>> 16;
  33782. var b00 = addend.low & 0xFFFF;
  33783. var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
  33784. c00 += a00 + b00;
  33785. c16 += c00 >>> 16;
  33786. c00 &= 0xFFFF;
  33787. c16 += a16 + b16;
  33788. c32 += c16 >>> 16;
  33789. c16 &= 0xFFFF;
  33790. c32 += a32 + b32;
  33791. c48 += c32 >>> 16;
  33792. c32 &= 0xFFFF;
  33793. c48 += a48 + b48;
  33794. c48 &= 0xFFFF;
  33795. return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
  33796. };
  33797. /**
  33798. * Returns the difference of this and the specified Long.
  33799. * @param {!Long|number|string} subtrahend Subtrahend
  33800. * @returns {!Long} Difference
  33801. */
  33802. LongPrototype.subtract = function subtract(subtrahend) {
  33803. if (!isLong(subtrahend))
  33804. subtrahend = fromValue(subtrahend);
  33805. return this.add(subtrahend.neg());
  33806. };
  33807. /**
  33808. * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
  33809. * @function
  33810. * @param {!Long|number|string} subtrahend Subtrahend
  33811. * @returns {!Long} Difference
  33812. */
  33813. LongPrototype.sub = LongPrototype.subtract;
  33814. /**
  33815. * Returns the product of this and the specified Long.
  33816. * @param {!Long|number|string} multiplier Multiplier
  33817. * @returns {!Long} Product
  33818. */
  33819. LongPrototype.multiply = function multiply(multiplier) {
  33820. if (this.isZero())
  33821. return ZERO;
  33822. if (!isLong(multiplier))
  33823. multiplier = fromValue(multiplier);
  33824. if (multiplier.isZero())
  33825. return ZERO;
  33826. if (this.eq(MIN_VALUE))
  33827. return multiplier.isOdd() ? MIN_VALUE : ZERO;
  33828. if (multiplier.eq(MIN_VALUE))
  33829. return this.isOdd() ? MIN_VALUE : ZERO;
  33830. if (this.isNegative()) {
  33831. if (multiplier.isNegative())
  33832. return this.neg().mul(multiplier.neg());
  33833. else
  33834. return this.neg().mul(multiplier).neg();
  33835. } else if (multiplier.isNegative())
  33836. return this.mul(multiplier.neg()).neg();
  33837. // If both longs are small, use float multiplication
  33838. if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
  33839. return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
  33840. // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
  33841. // We can skip products that would overflow.
  33842. var a48 = this.high >>> 16;
  33843. var a32 = this.high & 0xFFFF;
  33844. var a16 = this.low >>> 16;
  33845. var a00 = this.low & 0xFFFF;
  33846. var b48 = multiplier.high >>> 16;
  33847. var b32 = multiplier.high & 0xFFFF;
  33848. var b16 = multiplier.low >>> 16;
  33849. var b00 = multiplier.low & 0xFFFF;
  33850. var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
  33851. c00 += a00 * b00;
  33852. c16 += c00 >>> 16;
  33853. c00 &= 0xFFFF;
  33854. c16 += a16 * b00;
  33855. c32 += c16 >>> 16;
  33856. c16 &= 0xFFFF;
  33857. c16 += a00 * b16;
  33858. c32 += c16 >>> 16;
  33859. c16 &= 0xFFFF;
  33860. c32 += a32 * b00;
  33861. c48 += c32 >>> 16;
  33862. c32 &= 0xFFFF;
  33863. c32 += a16 * b16;
  33864. c48 += c32 >>> 16;
  33865. c32 &= 0xFFFF;
  33866. c32 += a00 * b32;
  33867. c48 += c32 >>> 16;
  33868. c32 &= 0xFFFF;
  33869. c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
  33870. c48 &= 0xFFFF;
  33871. return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
  33872. };
  33873. /**
  33874. * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
  33875. * @function
  33876. * @param {!Long|number|string} multiplier Multiplier
  33877. * @returns {!Long} Product
  33878. */
  33879. LongPrototype.mul = LongPrototype.multiply;
  33880. /**
  33881. * Returns this Long divided by the specified. The result is signed if this Long is signed or
  33882. * unsigned if this Long is unsigned.
  33883. * @param {!Long|number|string} divisor Divisor
  33884. * @returns {!Long} Quotient
  33885. */
  33886. LongPrototype.divide = function divide(divisor) {
  33887. if (!isLong(divisor))
  33888. divisor = fromValue(divisor);
  33889. if (divisor.isZero())
  33890. throw Error('division by zero');
  33891. if (this.isZero())
  33892. return this.unsigned ? UZERO : ZERO;
  33893. var approx, rem, res;
  33894. if (!this.unsigned) {
  33895. // This section is only relevant for signed longs and is derived from the
  33896. // closure library as a whole.
  33897. if (this.eq(MIN_VALUE)) {
  33898. if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
  33899. return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
  33900. else if (divisor.eq(MIN_VALUE))
  33901. return ONE;
  33902. else {
  33903. // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
  33904. var halfThis = this.shr(1);
  33905. approx = halfThis.div(divisor).shl(1);
  33906. if (approx.eq(ZERO)) {
  33907. return divisor.isNegative() ? ONE : NEG_ONE;
  33908. } else {
  33909. rem = this.sub(divisor.mul(approx));
  33910. res = approx.add(rem.div(divisor));
  33911. return res;
  33912. }
  33913. }
  33914. } else if (divisor.eq(MIN_VALUE))
  33915. return this.unsigned ? UZERO : ZERO;
  33916. if (this.isNegative()) {
  33917. if (divisor.isNegative())
  33918. return this.neg().div(divisor.neg());
  33919. return this.neg().div(divisor).neg();
  33920. } else if (divisor.isNegative())
  33921. return this.div(divisor.neg()).neg();
  33922. res = ZERO;
  33923. } else {
  33924. // The algorithm below has not been made for unsigned longs. It's therefore
  33925. // required to take special care of the MSB prior to running it.
  33926. if (!divisor.unsigned)
  33927. divisor = divisor.toUnsigned();
  33928. if (divisor.gt(this))
  33929. return UZERO;
  33930. if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
  33931. return UONE;
  33932. res = UZERO;
  33933. }
  33934. // Repeat the following until the remainder is less than other: find a
  33935. // floating-point that approximates remainder / other *from below*, add this
  33936. // into the result, and subtract it from the remainder. It is critical that
  33937. // the approximate value is less than or equal to the real value so that the
  33938. // remainder never becomes negative.
  33939. rem = this;
  33940. while (rem.gte(divisor)) {
  33941. // Approximate the result of division. This may be a little greater or
  33942. // smaller than the actual value.
  33943. approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
  33944. // We will tweak the approximate result by changing it in the 48-th digit or
  33945. // the smallest non-fractional digit, whichever is larger.
  33946. var log2 = Math.ceil(Math.log(approx) / Math.LN2),
  33947. delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
  33948. // Decrease the approximation until it is smaller than the remainder. Note
  33949. // that if it is too large, the product overflows and is negative.
  33950. approxRes = fromNumber(approx),
  33951. approxRem = approxRes.mul(divisor);
  33952. while (approxRem.isNegative() || approxRem.gt(rem)) {
  33953. approx -= delta;
  33954. approxRes = fromNumber(approx, this.unsigned);
  33955. approxRem = approxRes.mul(divisor);
  33956. }
  33957. // We know the answer can't be zero... and actually, zero would cause
  33958. // infinite recursion since we would make no progress.
  33959. if (approxRes.isZero())
  33960. approxRes = ONE;
  33961. res = res.add(approxRes);
  33962. rem = rem.sub(approxRem);
  33963. }
  33964. return res;
  33965. };
  33966. /**
  33967. * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
  33968. * @function
  33969. * @param {!Long|number|string} divisor Divisor
  33970. * @returns {!Long} Quotient
  33971. */
  33972. LongPrototype.div = LongPrototype.divide;
  33973. /**
  33974. * Returns this Long modulo the specified.
  33975. * @param {!Long|number|string} divisor Divisor
  33976. * @returns {!Long} Remainder
  33977. */
  33978. LongPrototype.modulo = function modulo(divisor) {
  33979. if (!isLong(divisor))
  33980. divisor = fromValue(divisor);
  33981. return this.sub(this.div(divisor).mul(divisor));
  33982. };
  33983. /**
  33984. * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
  33985. * @function
  33986. * @param {!Long|number|string} divisor Divisor
  33987. * @returns {!Long} Remainder
  33988. */
  33989. LongPrototype.mod = LongPrototype.modulo;
  33990. /**
  33991. * Returns the bitwise NOT of this Long.
  33992. * @returns {!Long}
  33993. */
  33994. LongPrototype.not = function not() {
  33995. return fromBits(~this.low, ~this.high, this.unsigned);
  33996. };
  33997. /**
  33998. * Returns the bitwise AND of this Long and the specified.
  33999. * @param {!Long|number|string} other Other Long
  34000. * @returns {!Long}
  34001. */
  34002. LongPrototype.and = function and(other) {
  34003. if (!isLong(other))
  34004. other = fromValue(other);
  34005. return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
  34006. };
  34007. /**
  34008. * Returns the bitwise OR of this Long and the specified.
  34009. * @param {!Long|number|string} other Other Long
  34010. * @returns {!Long}
  34011. */
  34012. LongPrototype.or = function or(other) {
  34013. if (!isLong(other))
  34014. other = fromValue(other);
  34015. return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
  34016. };
  34017. /**
  34018. * Returns the bitwise XOR of this Long and the given one.
  34019. * @param {!Long|number|string} other Other Long
  34020. * @returns {!Long}
  34021. */
  34022. LongPrototype.xor = function xor(other) {
  34023. if (!isLong(other))
  34024. other = fromValue(other);
  34025. return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
  34026. };
  34027. /**
  34028. * Returns this Long with bits shifted to the left by the given amount.
  34029. * @param {number|!Long} numBits Number of bits
  34030. * @returns {!Long} Shifted Long
  34031. */
  34032. LongPrototype.shiftLeft = function shiftLeft(numBits) {
  34033. if (isLong(numBits))
  34034. numBits = numBits.toInt();
  34035. if ((numBits &= 63) === 0)
  34036. return this;
  34037. else if (numBits < 32)
  34038. return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
  34039. else
  34040. return fromBits(0, this.low << (numBits - 32), this.unsigned);
  34041. };
  34042. /**
  34043. * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
  34044. * @function
  34045. * @param {number|!Long} numBits Number of bits
  34046. * @returns {!Long} Shifted Long
  34047. */
  34048. LongPrototype.shl = LongPrototype.shiftLeft;
  34049. /**
  34050. * Returns this Long with bits arithmetically shifted to the right by the given amount.
  34051. * @param {number|!Long} numBits Number of bits
  34052. * @returns {!Long} Shifted Long
  34053. */
  34054. LongPrototype.shiftRight = function shiftRight(numBits) {
  34055. if (isLong(numBits))
  34056. numBits = numBits.toInt();
  34057. if ((numBits &= 63) === 0)
  34058. return this;
  34059. else if (numBits < 32)
  34060. return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
  34061. else
  34062. return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
  34063. };
  34064. /**
  34065. * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
  34066. * @function
  34067. * @param {number|!Long} numBits Number of bits
  34068. * @returns {!Long} Shifted Long
  34069. */
  34070. LongPrototype.shr = LongPrototype.shiftRight;
  34071. /**
  34072. * Returns this Long with bits logically shifted to the right by the given amount.
  34073. * @param {number|!Long} numBits Number of bits
  34074. * @returns {!Long} Shifted Long
  34075. */
  34076. LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
  34077. if (isLong(numBits))
  34078. numBits = numBits.toInt();
  34079. numBits &= 63;
  34080. if (numBits === 0)
  34081. return this;
  34082. else {
  34083. var high = this.high;
  34084. if (numBits < 32) {
  34085. var low = this.low;
  34086. return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
  34087. } else if (numBits === 32)
  34088. return fromBits(high, 0, this.unsigned);
  34089. else
  34090. return fromBits(high >>> (numBits - 32), 0, this.unsigned);
  34091. }
  34092. };
  34093. /**
  34094. * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
  34095. * @function
  34096. * @param {number|!Long} numBits Number of bits
  34097. * @returns {!Long} Shifted Long
  34098. */
  34099. LongPrototype.shru = LongPrototype.shiftRightUnsigned;
  34100. /**
  34101. * Converts this Long to signed.
  34102. * @returns {!Long} Signed long
  34103. */
  34104. LongPrototype.toSigned = function toSigned() {
  34105. if (!this.unsigned)
  34106. return this;
  34107. return fromBits(this.low, this.high, false);
  34108. };
  34109. /**
  34110. * Converts this Long to unsigned.
  34111. * @returns {!Long} Unsigned long
  34112. */
  34113. LongPrototype.toUnsigned = function toUnsigned() {
  34114. if (this.unsigned)
  34115. return this;
  34116. return fromBits(this.low, this.high, true);
  34117. };
  34118. /**
  34119. * Converts this Long to its byte representation.
  34120. * @param {boolean=} le Whether little or big endian, defaults to big endian
  34121. * @returns {!Array.<number>} Byte representation
  34122. */
  34123. LongPrototype.toBytes = function(le) {
  34124. return le ? this.toBytesLE() : this.toBytesBE();
  34125. }
  34126. /**
  34127. * Converts this Long to its little endian byte representation.
  34128. * @returns {!Array.<number>} Little endian byte representation
  34129. */
  34130. LongPrototype.toBytesLE = function() {
  34131. var hi = this.high,
  34132. lo = this.low;
  34133. return [
  34134. lo & 0xff,
  34135. (lo >>> 8) & 0xff,
  34136. (lo >>> 16) & 0xff,
  34137. (lo >>> 24) & 0xff,
  34138. hi & 0xff,
  34139. (hi >>> 8) & 0xff,
  34140. (hi >>> 16) & 0xff,
  34141. (hi >>> 24) & 0xff
  34142. ];
  34143. }
  34144. /**
  34145. * Converts this Long to its big endian byte representation.
  34146. * @returns {!Array.<number>} Big endian byte representation
  34147. */
  34148. LongPrototype.toBytesBE = function() {
  34149. var hi = this.high,
  34150. lo = this.low;
  34151. return [
  34152. (hi >>> 24) & 0xff,
  34153. (hi >>> 16) & 0xff,
  34154. (hi >>> 8) & 0xff,
  34155. hi & 0xff,
  34156. (lo >>> 24) & 0xff,
  34157. (lo >>> 16) & 0xff,
  34158. (lo >>> 8) & 0xff,
  34159. lo & 0xff
  34160. ];
  34161. }
  34162. return Long;
  34163. });
  34164. /***/ }),
  34165. /* 615 */
  34166. /***/ (function(module, exports) {
  34167. /* (ignored) */
  34168. /***/ }),
  34169. /* 616 */
  34170. /***/ (function(module, exports, __webpack_require__) {
  34171. "use strict";
  34172. var _interopRequireDefault = __webpack_require__(1);
  34173. var _slice = _interopRequireDefault(__webpack_require__(61));
  34174. var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
  34175. var _concat = _interopRequireDefault(__webpack_require__(22));
  34176. var has = Object.prototype.hasOwnProperty,
  34177. prefix = '~';
  34178. /**
  34179. * Constructor to create a storage for our `EE` objects.
  34180. * An `Events` instance is a plain object whose properties are event names.
  34181. *
  34182. * @constructor
  34183. * @private
  34184. */
  34185. function Events() {} //
  34186. // We try to not inherit from `Object.prototype`. In some engines creating an
  34187. // instance in this way is faster than calling `Object.create(null)` directly.
  34188. // If `Object.create(null)` is not supported we prefix the event names with a
  34189. // character to make sure that the built-in object properties are not
  34190. // overridden or used as an attack vector.
  34191. //
  34192. if (Object.create) {
  34193. Events.prototype = Object.create(null); //
  34194. // This hack is needed because the `__proto__` property is still inherited in
  34195. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  34196. //
  34197. if (!new Events().__proto__) prefix = false;
  34198. }
  34199. /**
  34200. * Representation of a single event listener.
  34201. *
  34202. * @param {Function} fn The listener function.
  34203. * @param {*} context The context to invoke the listener with.
  34204. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  34205. * @constructor
  34206. * @private
  34207. */
  34208. function EE(fn, context, once) {
  34209. this.fn = fn;
  34210. this.context = context;
  34211. this.once = once || false;
  34212. }
  34213. /**
  34214. * Add a listener for a given event.
  34215. *
  34216. * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
  34217. * @param {(String|Symbol)} event The event name.
  34218. * @param {Function} fn The listener function.
  34219. * @param {*} context The context to invoke the listener with.
  34220. * @param {Boolean} once Specify if the listener is a one-time listener.
  34221. * @returns {EventEmitter}
  34222. * @private
  34223. */
  34224. function addListener(emitter, event, fn, context, once) {
  34225. if (typeof fn !== 'function') {
  34226. throw new TypeError('The listener must be a function');
  34227. }
  34228. var listener = new EE(fn, context || emitter, once),
  34229. evt = prefix ? prefix + event : event;
  34230. if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
  34231. return emitter;
  34232. }
  34233. /**
  34234. * Clear event by name.
  34235. *
  34236. * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
  34237. * @param {(String|Symbol)} evt The Event name.
  34238. * @private
  34239. */
  34240. function clearEvent(emitter, evt) {
  34241. if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
  34242. }
  34243. /**
  34244. * Minimal `EventEmitter` interface that is molded against the Node.js
  34245. * `EventEmitter` interface.
  34246. *
  34247. * @constructor
  34248. * @public
  34249. */
  34250. function EventEmitter() {
  34251. this._events = new Events();
  34252. this._eventsCount = 0;
  34253. }
  34254. /**
  34255. * Return an array listing the events for which the emitter has registered
  34256. * listeners.
  34257. *
  34258. * @returns {Array}
  34259. * @public
  34260. */
  34261. EventEmitter.prototype.eventNames = function eventNames() {
  34262. var names = [],
  34263. events,
  34264. name;
  34265. if (this._eventsCount === 0) return names;
  34266. for (name in events = this._events) {
  34267. if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
  34268. }
  34269. if (_getOwnPropertySymbols.default) {
  34270. return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
  34271. }
  34272. return names;
  34273. };
  34274. /**
  34275. * Return the listeners registered for a given event.
  34276. *
  34277. * @param {(String|Symbol)} event The event name.
  34278. * @returns {Array} The registered listeners.
  34279. * @public
  34280. */
  34281. EventEmitter.prototype.listeners = function listeners(event) {
  34282. var evt = prefix ? prefix + event : event,
  34283. handlers = this._events[evt];
  34284. if (!handlers) return [];
  34285. if (handlers.fn) return [handlers.fn];
  34286. for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
  34287. ee[i] = handlers[i].fn;
  34288. }
  34289. return ee;
  34290. };
  34291. /**
  34292. * Return the number of listeners listening to a given event.
  34293. *
  34294. * @param {(String|Symbol)} event The event name.
  34295. * @returns {Number} The number of listeners.
  34296. * @public
  34297. */
  34298. EventEmitter.prototype.listenerCount = function listenerCount(event) {
  34299. var evt = prefix ? prefix + event : event,
  34300. listeners = this._events[evt];
  34301. if (!listeners) return 0;
  34302. if (listeners.fn) return 1;
  34303. return listeners.length;
  34304. };
  34305. /**
  34306. * Calls each of the listeners registered for a given event.
  34307. *
  34308. * @param {(String|Symbol)} event The event name.
  34309. * @returns {Boolean} `true` if the event had listeners, else `false`.
  34310. * @public
  34311. */
  34312. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  34313. var evt = prefix ? prefix + event : event;
  34314. if (!this._events[evt]) return false;
  34315. var listeners = this._events[evt],
  34316. len = arguments.length,
  34317. args,
  34318. i;
  34319. if (listeners.fn) {
  34320. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  34321. switch (len) {
  34322. case 1:
  34323. return listeners.fn.call(listeners.context), true;
  34324. case 2:
  34325. return listeners.fn.call(listeners.context, a1), true;
  34326. case 3:
  34327. return listeners.fn.call(listeners.context, a1, a2), true;
  34328. case 4:
  34329. return listeners.fn.call(listeners.context, a1, a2, a3), true;
  34330. case 5:
  34331. return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  34332. case 6:
  34333. return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  34334. }
  34335. for (i = 1, args = new Array(len - 1); i < len; i++) {
  34336. args[i - 1] = arguments[i];
  34337. }
  34338. listeners.fn.apply(listeners.context, args);
  34339. } else {
  34340. var length = listeners.length,
  34341. j;
  34342. for (i = 0; i < length; i++) {
  34343. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  34344. switch (len) {
  34345. case 1:
  34346. listeners[i].fn.call(listeners[i].context);
  34347. break;
  34348. case 2:
  34349. listeners[i].fn.call(listeners[i].context, a1);
  34350. break;
  34351. case 3:
  34352. listeners[i].fn.call(listeners[i].context, a1, a2);
  34353. break;
  34354. case 4:
  34355. listeners[i].fn.call(listeners[i].context, a1, a2, a3);
  34356. break;
  34357. default:
  34358. if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
  34359. args[j - 1] = arguments[j];
  34360. }
  34361. listeners[i].fn.apply(listeners[i].context, args);
  34362. }
  34363. }
  34364. }
  34365. return true;
  34366. };
  34367. /**
  34368. * Add a listener for a given event.
  34369. *
  34370. * @param {(String|Symbol)} event The event name.
  34371. * @param {Function} fn The listener function.
  34372. * @param {*} [context=this] The context to invoke the listener with.
  34373. * @returns {EventEmitter} `this`.
  34374. * @public
  34375. */
  34376. EventEmitter.prototype.on = function on(event, fn, context) {
  34377. return addListener(this, event, fn, context, false);
  34378. };
  34379. /**
  34380. * Add a one-time listener for a given event.
  34381. *
  34382. * @param {(String|Symbol)} event The event name.
  34383. * @param {Function} fn The listener function.
  34384. * @param {*} [context=this] The context to invoke the listener with.
  34385. * @returns {EventEmitter} `this`.
  34386. * @public
  34387. */
  34388. EventEmitter.prototype.once = function once(event, fn, context) {
  34389. return addListener(this, event, fn, context, true);
  34390. };
  34391. /**
  34392. * Remove the listeners of a given event.
  34393. *
  34394. * @param {(String|Symbol)} event The event name.
  34395. * @param {Function} fn Only remove the listeners that match this function.
  34396. * @param {*} context Only remove the listeners that have this context.
  34397. * @param {Boolean} once Only remove one-time listeners.
  34398. * @returns {EventEmitter} `this`.
  34399. * @public
  34400. */
  34401. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  34402. var evt = prefix ? prefix + event : event;
  34403. if (!this._events[evt]) return this;
  34404. if (!fn) {
  34405. clearEvent(this, evt);
  34406. return this;
  34407. }
  34408. var listeners = this._events[evt];
  34409. if (listeners.fn) {
  34410. if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
  34411. clearEvent(this, evt);
  34412. }
  34413. } else {
  34414. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  34415. if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
  34416. events.push(listeners[i]);
  34417. }
  34418. } //
  34419. // Reset the array, or remove it completely if we have no more listeners.
  34420. //
  34421. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
  34422. }
  34423. return this;
  34424. };
  34425. /**
  34426. * Remove all listeners, or those of the specified event.
  34427. *
  34428. * @param {(String|Symbol)} [event] The event name.
  34429. * @returns {EventEmitter} `this`.
  34430. * @public
  34431. */
  34432. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  34433. var evt;
  34434. if (event) {
  34435. evt = prefix ? prefix + event : event;
  34436. if (this._events[evt]) clearEvent(this, evt);
  34437. } else {
  34438. this._events = new Events();
  34439. this._eventsCount = 0;
  34440. }
  34441. return this;
  34442. }; //
  34443. // Alias methods names because people roll like that.
  34444. //
  34445. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  34446. EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
  34447. // Expose the prefix.
  34448. //
  34449. EventEmitter.prefixed = prefix; //
  34450. // Allow `EventEmitter` to be imported as module namespace.
  34451. //
  34452. EventEmitter.EventEmitter = EventEmitter; //
  34453. // Expose the module.
  34454. //
  34455. if (true) {
  34456. module.exports = EventEmitter;
  34457. }
  34458. /***/ }),
  34459. /* 617 */
  34460. /***/ (function(module, exports, __webpack_require__) {
  34461. module.exports = __webpack_require__(618);
  34462. /***/ }),
  34463. /* 618 */
  34464. /***/ (function(module, exports, __webpack_require__) {
  34465. /**
  34466. * Copyright (c) 2014-present, Facebook, Inc.
  34467. *
  34468. * This source code is licensed under the MIT license found in the
  34469. * LICENSE file in the root directory of this source tree.
  34470. */
  34471. var runtime = (function (exports) {
  34472. "use strict";
  34473. var Op = Object.prototype;
  34474. var hasOwn = Op.hasOwnProperty;
  34475. var undefined; // More compressible than void 0.
  34476. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  34477. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  34478. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  34479. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  34480. function define(obj, key, value) {
  34481. Object.defineProperty(obj, key, {
  34482. value: value,
  34483. enumerable: true,
  34484. configurable: true,
  34485. writable: true
  34486. });
  34487. return obj[key];
  34488. }
  34489. try {
  34490. // IE 8 has a broken Object.defineProperty that only works on DOM objects.
  34491. define({}, "");
  34492. } catch (err) {
  34493. define = function(obj, key, value) {
  34494. return obj[key] = value;
  34495. };
  34496. }
  34497. function wrap(innerFn, outerFn, self, tryLocsList) {
  34498. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  34499. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  34500. var generator = Object.create(protoGenerator.prototype);
  34501. var context = new Context(tryLocsList || []);
  34502. // The ._invoke method unifies the implementations of the .next,
  34503. // .throw, and .return methods.
  34504. generator._invoke = makeInvokeMethod(innerFn, self, context);
  34505. return generator;
  34506. }
  34507. exports.wrap = wrap;
  34508. // Try/catch helper to minimize deoptimizations. Returns a completion
  34509. // record like context.tryEntries[i].completion. This interface could
  34510. // have been (and was previously) designed to take a closure to be
  34511. // invoked without arguments, but in all the cases we care about we
  34512. // already have an existing method we want to call, so there's no need
  34513. // to create a new function object. We can even get away with assuming
  34514. // the method takes exactly one argument, since that happens to be true
  34515. // in every case, so we don't have to touch the arguments object. The
  34516. // only additional allocation required is the completion record, which
  34517. // has a stable shape and so hopefully should be cheap to allocate.
  34518. function tryCatch(fn, obj, arg) {
  34519. try {
  34520. return { type: "normal", arg: fn.call(obj, arg) };
  34521. } catch (err) {
  34522. return { type: "throw", arg: err };
  34523. }
  34524. }
  34525. var GenStateSuspendedStart = "suspendedStart";
  34526. var GenStateSuspendedYield = "suspendedYield";
  34527. var GenStateExecuting = "executing";
  34528. var GenStateCompleted = "completed";
  34529. // Returning this object from the innerFn has the same effect as
  34530. // breaking out of the dispatch switch statement.
  34531. var ContinueSentinel = {};
  34532. // Dummy constructor functions that we use as the .constructor and
  34533. // .constructor.prototype properties for functions that return Generator
  34534. // objects. For full spec compliance, you may wish to configure your
  34535. // minifier not to mangle the names of these two functions.
  34536. function Generator() {}
  34537. function GeneratorFunction() {}
  34538. function GeneratorFunctionPrototype() {}
  34539. // This is a polyfill for %IteratorPrototype% for environments that
  34540. // don't natively support it.
  34541. var IteratorPrototype = {};
  34542. IteratorPrototype[iteratorSymbol] = function () {
  34543. return this;
  34544. };
  34545. var getProto = Object.getPrototypeOf;
  34546. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  34547. if (NativeIteratorPrototype &&
  34548. NativeIteratorPrototype !== Op &&
  34549. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  34550. // This environment has a native %IteratorPrototype%; use it instead
  34551. // of the polyfill.
  34552. IteratorPrototype = NativeIteratorPrototype;
  34553. }
  34554. var Gp = GeneratorFunctionPrototype.prototype =
  34555. Generator.prototype = Object.create(IteratorPrototype);
  34556. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  34557. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  34558. GeneratorFunction.displayName = define(
  34559. GeneratorFunctionPrototype,
  34560. toStringTagSymbol,
  34561. "GeneratorFunction"
  34562. );
  34563. // Helper for defining the .next, .throw, and .return methods of the
  34564. // Iterator interface in terms of a single ._invoke method.
  34565. function defineIteratorMethods(prototype) {
  34566. ["next", "throw", "return"].forEach(function(method) {
  34567. define(prototype, method, function(arg) {
  34568. return this._invoke(method, arg);
  34569. });
  34570. });
  34571. }
  34572. exports.isGeneratorFunction = function(genFun) {
  34573. var ctor = typeof genFun === "function" && genFun.constructor;
  34574. return ctor
  34575. ? ctor === GeneratorFunction ||
  34576. // For the native GeneratorFunction constructor, the best we can
  34577. // do is to check its .name property.
  34578. (ctor.displayName || ctor.name) === "GeneratorFunction"
  34579. : false;
  34580. };
  34581. exports.mark = function(genFun) {
  34582. if (Object.setPrototypeOf) {
  34583. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  34584. } else {
  34585. genFun.__proto__ = GeneratorFunctionPrototype;
  34586. define(genFun, toStringTagSymbol, "GeneratorFunction");
  34587. }
  34588. genFun.prototype = Object.create(Gp);
  34589. return genFun;
  34590. };
  34591. // Within the body of any async function, `await x` is transformed to
  34592. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  34593. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  34594. // meant to be awaited.
  34595. exports.awrap = function(arg) {
  34596. return { __await: arg };
  34597. };
  34598. function AsyncIterator(generator, PromiseImpl) {
  34599. function invoke(method, arg, resolve, reject) {
  34600. var record = tryCatch(generator[method], generator, arg);
  34601. if (record.type === "throw") {
  34602. reject(record.arg);
  34603. } else {
  34604. var result = record.arg;
  34605. var value = result.value;
  34606. if (value &&
  34607. typeof value === "object" &&
  34608. hasOwn.call(value, "__await")) {
  34609. return PromiseImpl.resolve(value.__await).then(function(value) {
  34610. invoke("next", value, resolve, reject);
  34611. }, function(err) {
  34612. invoke("throw", err, resolve, reject);
  34613. });
  34614. }
  34615. return PromiseImpl.resolve(value).then(function(unwrapped) {
  34616. // When a yielded Promise is resolved, its final value becomes
  34617. // the .value of the Promise<{value,done}> result for the
  34618. // current iteration.
  34619. result.value = unwrapped;
  34620. resolve(result);
  34621. }, function(error) {
  34622. // If a rejected Promise was yielded, throw the rejection back
  34623. // into the async generator function so it can be handled there.
  34624. return invoke("throw", error, resolve, reject);
  34625. });
  34626. }
  34627. }
  34628. var previousPromise;
  34629. function enqueue(method, arg) {
  34630. function callInvokeWithMethodAndArg() {
  34631. return new PromiseImpl(function(resolve, reject) {
  34632. invoke(method, arg, resolve, reject);
  34633. });
  34634. }
  34635. return previousPromise =
  34636. // If enqueue has been called before, then we want to wait until
  34637. // all previous Promises have been resolved before calling invoke,
  34638. // so that results are always delivered in the correct order. If
  34639. // enqueue has not been called before, then it is important to
  34640. // call invoke immediately, without waiting on a callback to fire,
  34641. // so that the async generator function has the opportunity to do
  34642. // any necessary setup in a predictable way. This predictability
  34643. // is why the Promise constructor synchronously invokes its
  34644. // executor callback, and why async functions synchronously
  34645. // execute code before the first await. Since we implement simple
  34646. // async functions in terms of async generators, it is especially
  34647. // important to get this right, even though it requires care.
  34648. previousPromise ? previousPromise.then(
  34649. callInvokeWithMethodAndArg,
  34650. // Avoid propagating failures to Promises returned by later
  34651. // invocations of the iterator.
  34652. callInvokeWithMethodAndArg
  34653. ) : callInvokeWithMethodAndArg();
  34654. }
  34655. // Define the unified helper method that is used to implement .next,
  34656. // .throw, and .return (see defineIteratorMethods).
  34657. this._invoke = enqueue;
  34658. }
  34659. defineIteratorMethods(AsyncIterator.prototype);
  34660. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  34661. return this;
  34662. };
  34663. exports.AsyncIterator = AsyncIterator;
  34664. // Note that simple async functions are implemented on top of
  34665. // AsyncIterator objects; they just return a Promise for the value of
  34666. // the final result produced by the iterator.
  34667. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  34668. if (PromiseImpl === void 0) PromiseImpl = Promise;
  34669. var iter = new AsyncIterator(
  34670. wrap(innerFn, outerFn, self, tryLocsList),
  34671. PromiseImpl
  34672. );
  34673. return exports.isGeneratorFunction(outerFn)
  34674. ? iter // If outerFn is a generator, return the full iterator.
  34675. : iter.next().then(function(result) {
  34676. return result.done ? result.value : iter.next();
  34677. });
  34678. };
  34679. function makeInvokeMethod(innerFn, self, context) {
  34680. var state = GenStateSuspendedStart;
  34681. return function invoke(method, arg) {
  34682. if (state === GenStateExecuting) {
  34683. throw new Error("Generator is already running");
  34684. }
  34685. if (state === GenStateCompleted) {
  34686. if (method === "throw") {
  34687. throw arg;
  34688. }
  34689. // Be forgiving, per 25.3.3.3.3 of the spec:
  34690. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  34691. return doneResult();
  34692. }
  34693. context.method = method;
  34694. context.arg = arg;
  34695. while (true) {
  34696. var delegate = context.delegate;
  34697. if (delegate) {
  34698. var delegateResult = maybeInvokeDelegate(delegate, context);
  34699. if (delegateResult) {
  34700. if (delegateResult === ContinueSentinel) continue;
  34701. return delegateResult;
  34702. }
  34703. }
  34704. if (context.method === "next") {
  34705. // Setting context._sent for legacy support of Babel's
  34706. // function.sent implementation.
  34707. context.sent = context._sent = context.arg;
  34708. } else if (context.method === "throw") {
  34709. if (state === GenStateSuspendedStart) {
  34710. state = GenStateCompleted;
  34711. throw context.arg;
  34712. }
  34713. context.dispatchException(context.arg);
  34714. } else if (context.method === "return") {
  34715. context.abrupt("return", context.arg);
  34716. }
  34717. state = GenStateExecuting;
  34718. var record = tryCatch(innerFn, self, context);
  34719. if (record.type === "normal") {
  34720. // If an exception is thrown from innerFn, we leave state ===
  34721. // GenStateExecuting and loop back for another invocation.
  34722. state = context.done
  34723. ? GenStateCompleted
  34724. : GenStateSuspendedYield;
  34725. if (record.arg === ContinueSentinel) {
  34726. continue;
  34727. }
  34728. return {
  34729. value: record.arg,
  34730. done: context.done
  34731. };
  34732. } else if (record.type === "throw") {
  34733. state = GenStateCompleted;
  34734. // Dispatch the exception by looping back around to the
  34735. // context.dispatchException(context.arg) call above.
  34736. context.method = "throw";
  34737. context.arg = record.arg;
  34738. }
  34739. }
  34740. };
  34741. }
  34742. // Call delegate.iterator[context.method](context.arg) and handle the
  34743. // result, either by returning a { value, done } result from the
  34744. // delegate iterator, or by modifying context.method and context.arg,
  34745. // setting context.delegate to null, and returning the ContinueSentinel.
  34746. function maybeInvokeDelegate(delegate, context) {
  34747. var method = delegate.iterator[context.method];
  34748. if (method === undefined) {
  34749. // A .throw or .return when the delegate iterator has no .throw
  34750. // method always terminates the yield* loop.
  34751. context.delegate = null;
  34752. if (context.method === "throw") {
  34753. // Note: ["return"] must be used for ES3 parsing compatibility.
  34754. if (delegate.iterator["return"]) {
  34755. // If the delegate iterator has a return method, give it a
  34756. // chance to clean up.
  34757. context.method = "return";
  34758. context.arg = undefined;
  34759. maybeInvokeDelegate(delegate, context);
  34760. if (context.method === "throw") {
  34761. // If maybeInvokeDelegate(context) changed context.method from
  34762. // "return" to "throw", let that override the TypeError below.
  34763. return ContinueSentinel;
  34764. }
  34765. }
  34766. context.method = "throw";
  34767. context.arg = new TypeError(
  34768. "The iterator does not provide a 'throw' method");
  34769. }
  34770. return ContinueSentinel;
  34771. }
  34772. var record = tryCatch(method, delegate.iterator, context.arg);
  34773. if (record.type === "throw") {
  34774. context.method = "throw";
  34775. context.arg = record.arg;
  34776. context.delegate = null;
  34777. return ContinueSentinel;
  34778. }
  34779. var info = record.arg;
  34780. if (! info) {
  34781. context.method = "throw";
  34782. context.arg = new TypeError("iterator result is not an object");
  34783. context.delegate = null;
  34784. return ContinueSentinel;
  34785. }
  34786. if (info.done) {
  34787. // Assign the result of the finished delegate to the temporary
  34788. // variable specified by delegate.resultName (see delegateYield).
  34789. context[delegate.resultName] = info.value;
  34790. // Resume execution at the desired location (see delegateYield).
  34791. context.next = delegate.nextLoc;
  34792. // If context.method was "throw" but the delegate handled the
  34793. // exception, let the outer generator proceed normally. If
  34794. // context.method was "next", forget context.arg since it has been
  34795. // "consumed" by the delegate iterator. If context.method was
  34796. // "return", allow the original .return call to continue in the
  34797. // outer generator.
  34798. if (context.method !== "return") {
  34799. context.method = "next";
  34800. context.arg = undefined;
  34801. }
  34802. } else {
  34803. // Re-yield the result returned by the delegate method.
  34804. return info;
  34805. }
  34806. // The delegate iterator is finished, so forget it and continue with
  34807. // the outer generator.
  34808. context.delegate = null;
  34809. return ContinueSentinel;
  34810. }
  34811. // Define Generator.prototype.{next,throw,return} in terms of the
  34812. // unified ._invoke helper method.
  34813. defineIteratorMethods(Gp);
  34814. define(Gp, toStringTagSymbol, "Generator");
  34815. // A Generator should always return itself as the iterator object when the
  34816. // @@iterator function is called on it. Some browsers' implementations of the
  34817. // iterator prototype chain incorrectly implement this, causing the Generator
  34818. // object to not be returned from this call. This ensures that doesn't happen.
  34819. // See https://github.com/facebook/regenerator/issues/274 for more details.
  34820. Gp[iteratorSymbol] = function() {
  34821. return this;
  34822. };
  34823. Gp.toString = function() {
  34824. return "[object Generator]";
  34825. };
  34826. function pushTryEntry(locs) {
  34827. var entry = { tryLoc: locs[0] };
  34828. if (1 in locs) {
  34829. entry.catchLoc = locs[1];
  34830. }
  34831. if (2 in locs) {
  34832. entry.finallyLoc = locs[2];
  34833. entry.afterLoc = locs[3];
  34834. }
  34835. this.tryEntries.push(entry);
  34836. }
  34837. function resetTryEntry(entry) {
  34838. var record = entry.completion || {};
  34839. record.type = "normal";
  34840. delete record.arg;
  34841. entry.completion = record;
  34842. }
  34843. function Context(tryLocsList) {
  34844. // The root entry object (effectively a try statement without a catch
  34845. // or a finally block) gives us a place to store values thrown from
  34846. // locations where there is no enclosing try statement.
  34847. this.tryEntries = [{ tryLoc: "root" }];
  34848. tryLocsList.forEach(pushTryEntry, this);
  34849. this.reset(true);
  34850. }
  34851. exports.keys = function(object) {
  34852. var keys = [];
  34853. for (var key in object) {
  34854. keys.push(key);
  34855. }
  34856. keys.reverse();
  34857. // Rather than returning an object with a next method, we keep
  34858. // things simple and return the next function itself.
  34859. return function next() {
  34860. while (keys.length) {
  34861. var key = keys.pop();
  34862. if (key in object) {
  34863. next.value = key;
  34864. next.done = false;
  34865. return next;
  34866. }
  34867. }
  34868. // To avoid creating an additional object, we just hang the .value
  34869. // and .done properties off the next function object itself. This
  34870. // also ensures that the minifier will not anonymize the function.
  34871. next.done = true;
  34872. return next;
  34873. };
  34874. };
  34875. function values(iterable) {
  34876. if (iterable) {
  34877. var iteratorMethod = iterable[iteratorSymbol];
  34878. if (iteratorMethod) {
  34879. return iteratorMethod.call(iterable);
  34880. }
  34881. if (typeof iterable.next === "function") {
  34882. return iterable;
  34883. }
  34884. if (!isNaN(iterable.length)) {
  34885. var i = -1, next = function next() {
  34886. while (++i < iterable.length) {
  34887. if (hasOwn.call(iterable, i)) {
  34888. next.value = iterable[i];
  34889. next.done = false;
  34890. return next;
  34891. }
  34892. }
  34893. next.value = undefined;
  34894. next.done = true;
  34895. return next;
  34896. };
  34897. return next.next = next;
  34898. }
  34899. }
  34900. // Return an iterator with no values.
  34901. return { next: doneResult };
  34902. }
  34903. exports.values = values;
  34904. function doneResult() {
  34905. return { value: undefined, done: true };
  34906. }
  34907. Context.prototype = {
  34908. constructor: Context,
  34909. reset: function(skipTempReset) {
  34910. this.prev = 0;
  34911. this.next = 0;
  34912. // Resetting context._sent for legacy support of Babel's
  34913. // function.sent implementation.
  34914. this.sent = this._sent = undefined;
  34915. this.done = false;
  34916. this.delegate = null;
  34917. this.method = "next";
  34918. this.arg = undefined;
  34919. this.tryEntries.forEach(resetTryEntry);
  34920. if (!skipTempReset) {
  34921. for (var name in this) {
  34922. // Not sure about the optimal order of these conditions:
  34923. if (name.charAt(0) === "t" &&
  34924. hasOwn.call(this, name) &&
  34925. !isNaN(+name.slice(1))) {
  34926. this[name] = undefined;
  34927. }
  34928. }
  34929. }
  34930. },
  34931. stop: function() {
  34932. this.done = true;
  34933. var rootEntry = this.tryEntries[0];
  34934. var rootRecord = rootEntry.completion;
  34935. if (rootRecord.type === "throw") {
  34936. throw rootRecord.arg;
  34937. }
  34938. return this.rval;
  34939. },
  34940. dispatchException: function(exception) {
  34941. if (this.done) {
  34942. throw exception;
  34943. }
  34944. var context = this;
  34945. function handle(loc, caught) {
  34946. record.type = "throw";
  34947. record.arg = exception;
  34948. context.next = loc;
  34949. if (caught) {
  34950. // If the dispatched exception was caught by a catch block,
  34951. // then let that catch block handle the exception normally.
  34952. context.method = "next";
  34953. context.arg = undefined;
  34954. }
  34955. return !! caught;
  34956. }
  34957. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  34958. var entry = this.tryEntries[i];
  34959. var record = entry.completion;
  34960. if (entry.tryLoc === "root") {
  34961. // Exception thrown outside of any try block that could handle
  34962. // it, so set the completion value of the entire function to
  34963. // throw the exception.
  34964. return handle("end");
  34965. }
  34966. if (entry.tryLoc <= this.prev) {
  34967. var hasCatch = hasOwn.call(entry, "catchLoc");
  34968. var hasFinally = hasOwn.call(entry, "finallyLoc");
  34969. if (hasCatch && hasFinally) {
  34970. if (this.prev < entry.catchLoc) {
  34971. return handle(entry.catchLoc, true);
  34972. } else if (this.prev < entry.finallyLoc) {
  34973. return handle(entry.finallyLoc);
  34974. }
  34975. } else if (hasCatch) {
  34976. if (this.prev < entry.catchLoc) {
  34977. return handle(entry.catchLoc, true);
  34978. }
  34979. } else if (hasFinally) {
  34980. if (this.prev < entry.finallyLoc) {
  34981. return handle(entry.finallyLoc);
  34982. }
  34983. } else {
  34984. throw new Error("try statement without catch or finally");
  34985. }
  34986. }
  34987. }
  34988. },
  34989. abrupt: function(type, arg) {
  34990. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  34991. var entry = this.tryEntries[i];
  34992. if (entry.tryLoc <= this.prev &&
  34993. hasOwn.call(entry, "finallyLoc") &&
  34994. this.prev < entry.finallyLoc) {
  34995. var finallyEntry = entry;
  34996. break;
  34997. }
  34998. }
  34999. if (finallyEntry &&
  35000. (type === "break" ||
  35001. type === "continue") &&
  35002. finallyEntry.tryLoc <= arg &&
  35003. arg <= finallyEntry.finallyLoc) {
  35004. // Ignore the finally entry if control is not jumping to a
  35005. // location outside the try/catch block.
  35006. finallyEntry = null;
  35007. }
  35008. var record = finallyEntry ? finallyEntry.completion : {};
  35009. record.type = type;
  35010. record.arg = arg;
  35011. if (finallyEntry) {
  35012. this.method = "next";
  35013. this.next = finallyEntry.finallyLoc;
  35014. return ContinueSentinel;
  35015. }
  35016. return this.complete(record);
  35017. },
  35018. complete: function(record, afterLoc) {
  35019. if (record.type === "throw") {
  35020. throw record.arg;
  35021. }
  35022. if (record.type === "break" ||
  35023. record.type === "continue") {
  35024. this.next = record.arg;
  35025. } else if (record.type === "return") {
  35026. this.rval = this.arg = record.arg;
  35027. this.method = "return";
  35028. this.next = "end";
  35029. } else if (record.type === "normal" && afterLoc) {
  35030. this.next = afterLoc;
  35031. }
  35032. return ContinueSentinel;
  35033. },
  35034. finish: function(finallyLoc) {
  35035. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  35036. var entry = this.tryEntries[i];
  35037. if (entry.finallyLoc === finallyLoc) {
  35038. this.complete(entry.completion, entry.afterLoc);
  35039. resetTryEntry(entry);
  35040. return ContinueSentinel;
  35041. }
  35042. }
  35043. },
  35044. "catch": function(tryLoc) {
  35045. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  35046. var entry = this.tryEntries[i];
  35047. if (entry.tryLoc === tryLoc) {
  35048. var record = entry.completion;
  35049. if (record.type === "throw") {
  35050. var thrown = record.arg;
  35051. resetTryEntry(entry);
  35052. }
  35053. return thrown;
  35054. }
  35055. }
  35056. // The context.catch method must only be called with a location
  35057. // argument that corresponds to a known catch block.
  35058. throw new Error("illegal catch attempt");
  35059. },
  35060. delegateYield: function(iterable, resultName, nextLoc) {
  35061. this.delegate = {
  35062. iterator: values(iterable),
  35063. resultName: resultName,
  35064. nextLoc: nextLoc
  35065. };
  35066. if (this.method === "next") {
  35067. // Deliberately forget the last sent value so that we don't
  35068. // accidentally pass it on to the delegate.
  35069. this.arg = undefined;
  35070. }
  35071. return ContinueSentinel;
  35072. }
  35073. };
  35074. // Regardless of whether this script is executing as a CommonJS module
  35075. // or not, return the runtime object so that we can declare the variable
  35076. // regeneratorRuntime in the outer scope, which allows this module to be
  35077. // injected easily by `bin/regenerator --include-runtime script.js`.
  35078. return exports;
  35079. }(
  35080. // If this script is executing as a CommonJS module, use module.exports
  35081. // as the regeneratorRuntime namespace. Otherwise create a new empty
  35082. // object. Either way, the resulting object will be used to initialize
  35083. // the regeneratorRuntime variable at the top of this file.
  35084. true ? module.exports : {}
  35085. ));
  35086. try {
  35087. regeneratorRuntime = runtime;
  35088. } catch (accidentalStrictMode) {
  35089. // This module should not be running in strict mode, so the above
  35090. // assignment should always work unless something is misconfigured. Just
  35091. // in case runtime.js accidentally runs in strict mode, we can escape
  35092. // strict mode using a global Function call. This could conceivably fail
  35093. // if a Content Security Policy forbids using Function, but in that case
  35094. // the proper solution is to fix the accidental strict mode problem. If
  35095. // you've misconfigured your bundler to force strict mode and applied a
  35096. // CSP to forbid Function, and you're not willing to fix either of those
  35097. // problems, please detail your unique predicament in a GitHub issue.
  35098. Function("r", "regeneratorRuntime = r")(runtime);
  35099. }
  35100. /***/ }),
  35101. /* 619 */
  35102. /***/ (function(module, exports) {
  35103. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  35104. try {
  35105. var info = gen[key](arg);
  35106. var value = info.value;
  35107. } catch (error) {
  35108. reject(error);
  35109. return;
  35110. }
  35111. if (info.done) {
  35112. resolve(value);
  35113. } else {
  35114. Promise.resolve(value).then(_next, _throw);
  35115. }
  35116. }
  35117. function _asyncToGenerator(fn) {
  35118. return function () {
  35119. var self = this,
  35120. args = arguments;
  35121. return new Promise(function (resolve, reject) {
  35122. var gen = fn.apply(self, args);
  35123. function _next(value) {
  35124. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  35125. }
  35126. function _throw(err) {
  35127. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  35128. }
  35129. _next(undefined);
  35130. });
  35131. };
  35132. }
  35133. module.exports = _asyncToGenerator;
  35134. /***/ }),
  35135. /* 620 */
  35136. /***/ (function(module, exports, __webpack_require__) {
  35137. var arrayWithoutHoles = __webpack_require__(621);
  35138. var iterableToArray = __webpack_require__(266);
  35139. var unsupportedIterableToArray = __webpack_require__(267);
  35140. var nonIterableSpread = __webpack_require__(622);
  35141. function _toConsumableArray(arr) {
  35142. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  35143. }
  35144. module.exports = _toConsumableArray;
  35145. /***/ }),
  35146. /* 621 */
  35147. /***/ (function(module, exports, __webpack_require__) {
  35148. var arrayLikeToArray = __webpack_require__(265);
  35149. function _arrayWithoutHoles(arr) {
  35150. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  35151. }
  35152. module.exports = _arrayWithoutHoles;
  35153. /***/ }),
  35154. /* 622 */
  35155. /***/ (function(module, exports) {
  35156. function _nonIterableSpread() {
  35157. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  35158. }
  35159. module.exports = _nonIterableSpread;
  35160. /***/ }),
  35161. /* 623 */
  35162. /***/ (function(module, exports) {
  35163. function _defineProperty(obj, key, value) {
  35164. if (key in obj) {
  35165. Object.defineProperty(obj, key, {
  35166. value: value,
  35167. enumerable: true,
  35168. configurable: true,
  35169. writable: true
  35170. });
  35171. } else {
  35172. obj[key] = value;
  35173. }
  35174. return obj;
  35175. }
  35176. module.exports = _defineProperty;
  35177. /***/ }),
  35178. /* 624 */
  35179. /***/ (function(module, exports, __webpack_require__) {
  35180. var objectWithoutPropertiesLoose = __webpack_require__(625);
  35181. function _objectWithoutProperties(source, excluded) {
  35182. if (source == null) return {};
  35183. var target = objectWithoutPropertiesLoose(source, excluded);
  35184. var key, i;
  35185. if (Object.getOwnPropertySymbols) {
  35186. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  35187. for (i = 0; i < sourceSymbolKeys.length; i++) {
  35188. key = sourceSymbolKeys[i];
  35189. if (excluded.indexOf(key) >= 0) continue;
  35190. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  35191. target[key] = source[key];
  35192. }
  35193. }
  35194. return target;
  35195. }
  35196. module.exports = _objectWithoutProperties;
  35197. /***/ }),
  35198. /* 625 */
  35199. /***/ (function(module, exports) {
  35200. function _objectWithoutPropertiesLoose(source, excluded) {
  35201. if (source == null) return {};
  35202. var target = {};
  35203. var sourceKeys = Object.keys(source);
  35204. var key, i;
  35205. for (i = 0; i < sourceKeys.length; i++) {
  35206. key = sourceKeys[i];
  35207. if (excluded.indexOf(key) >= 0) continue;
  35208. target[key] = source[key];
  35209. }
  35210. return target;
  35211. }
  35212. module.exports = _objectWithoutPropertiesLoose;
  35213. /***/ }),
  35214. /* 626 */
  35215. /***/ (function(module, exports) {
  35216. function _assertThisInitialized(self) {
  35217. if (self === void 0) {
  35218. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  35219. }
  35220. return self;
  35221. }
  35222. module.exports = _assertThisInitialized;
  35223. /***/ }),
  35224. /* 627 */
  35225. /***/ (function(module, exports) {
  35226. function _inheritsLoose(subClass, superClass) {
  35227. subClass.prototype = Object.create(superClass.prototype);
  35228. subClass.prototype.constructor = subClass;
  35229. subClass.__proto__ = superClass;
  35230. }
  35231. module.exports = _inheritsLoose;
  35232. /***/ }),
  35233. /* 628 */
  35234. /***/ (function(module, exports, __webpack_require__) {
  35235. var arrayShuffle = __webpack_require__(629),
  35236. baseShuffle = __webpack_require__(632),
  35237. isArray = __webpack_require__(273);
  35238. /**
  35239. * Creates an array of shuffled values, using a version of the
  35240. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  35241. *
  35242. * @static
  35243. * @memberOf _
  35244. * @since 0.1.0
  35245. * @category Collection
  35246. * @param {Array|Object} collection The collection to shuffle.
  35247. * @returns {Array} Returns the new shuffled array.
  35248. * @example
  35249. *
  35250. * _.shuffle([1, 2, 3, 4]);
  35251. * // => [4, 1, 3, 2]
  35252. */
  35253. function shuffle(collection) {
  35254. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  35255. return func(collection);
  35256. }
  35257. module.exports = shuffle;
  35258. /***/ }),
  35259. /* 629 */
  35260. /***/ (function(module, exports, __webpack_require__) {
  35261. var copyArray = __webpack_require__(630),
  35262. shuffleSelf = __webpack_require__(268);
  35263. /**
  35264. * A specialized version of `_.shuffle` for arrays.
  35265. *
  35266. * @private
  35267. * @param {Array} array The array to shuffle.
  35268. * @returns {Array} Returns the new shuffled array.
  35269. */
  35270. function arrayShuffle(array) {
  35271. return shuffleSelf(copyArray(array));
  35272. }
  35273. module.exports = arrayShuffle;
  35274. /***/ }),
  35275. /* 630 */
  35276. /***/ (function(module, exports) {
  35277. /**
  35278. * Copies the values of `source` to `array`.
  35279. *
  35280. * @private
  35281. * @param {Array} source The array to copy values from.
  35282. * @param {Array} [array=[]] The array to copy values to.
  35283. * @returns {Array} Returns `array`.
  35284. */
  35285. function copyArray(source, array) {
  35286. var index = -1,
  35287. length = source.length;
  35288. array || (array = Array(length));
  35289. while (++index < length) {
  35290. array[index] = source[index];
  35291. }
  35292. return array;
  35293. }
  35294. module.exports = copyArray;
  35295. /***/ }),
  35296. /* 631 */
  35297. /***/ (function(module, exports) {
  35298. /* Built-in method references for those with the same name as other `lodash` methods. */
  35299. var nativeFloor = Math.floor,
  35300. nativeRandom = Math.random;
  35301. /**
  35302. * The base implementation of `_.random` without support for returning
  35303. * floating-point numbers.
  35304. *
  35305. * @private
  35306. * @param {number} lower The lower bound.
  35307. * @param {number} upper The upper bound.
  35308. * @returns {number} Returns the random number.
  35309. */
  35310. function baseRandom(lower, upper) {
  35311. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  35312. }
  35313. module.exports = baseRandom;
  35314. /***/ }),
  35315. /* 632 */
  35316. /***/ (function(module, exports, __webpack_require__) {
  35317. var shuffleSelf = __webpack_require__(268),
  35318. values = __webpack_require__(269);
  35319. /**
  35320. * The base implementation of `_.shuffle`.
  35321. *
  35322. * @private
  35323. * @param {Array|Object} collection The collection to shuffle.
  35324. * @returns {Array} Returns the new shuffled array.
  35325. */
  35326. function baseShuffle(collection) {
  35327. return shuffleSelf(values(collection));
  35328. }
  35329. module.exports = baseShuffle;
  35330. /***/ }),
  35331. /* 633 */
  35332. /***/ (function(module, exports, __webpack_require__) {
  35333. var arrayMap = __webpack_require__(634);
  35334. /**
  35335. * The base implementation of `_.values` and `_.valuesIn` which creates an
  35336. * array of `object` property values corresponding to the property names
  35337. * of `props`.
  35338. *
  35339. * @private
  35340. * @param {Object} object The object to query.
  35341. * @param {Array} props The property names to get values for.
  35342. * @returns {Object} Returns the array of property values.
  35343. */
  35344. function baseValues(object, props) {
  35345. return arrayMap(props, function(key) {
  35346. return object[key];
  35347. });
  35348. }
  35349. module.exports = baseValues;
  35350. /***/ }),
  35351. /* 634 */
  35352. /***/ (function(module, exports) {
  35353. /**
  35354. * A specialized version of `_.map` for arrays without support for iteratee
  35355. * shorthands.
  35356. *
  35357. * @private
  35358. * @param {Array} [array] The array to iterate over.
  35359. * @param {Function} iteratee The function invoked per iteration.
  35360. * @returns {Array} Returns the new mapped array.
  35361. */
  35362. function arrayMap(array, iteratee) {
  35363. var index = -1,
  35364. length = array == null ? 0 : array.length,
  35365. result = Array(length);
  35366. while (++index < length) {
  35367. result[index] = iteratee(array[index], index, array);
  35368. }
  35369. return result;
  35370. }
  35371. module.exports = arrayMap;
  35372. /***/ }),
  35373. /* 635 */
  35374. /***/ (function(module, exports, __webpack_require__) {
  35375. var arrayLikeKeys = __webpack_require__(636),
  35376. baseKeys = __webpack_require__(649),
  35377. isArrayLike = __webpack_require__(652);
  35378. /**
  35379. * Creates an array of the own enumerable property names of `object`.
  35380. *
  35381. * **Note:** Non-object values are coerced to objects. See the
  35382. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  35383. * for more details.
  35384. *
  35385. * @static
  35386. * @since 0.1.0
  35387. * @memberOf _
  35388. * @category Object
  35389. * @param {Object} object The object to query.
  35390. * @returns {Array} Returns the array of property names.
  35391. * @example
  35392. *
  35393. * function Foo() {
  35394. * this.a = 1;
  35395. * this.b = 2;
  35396. * }
  35397. *
  35398. * Foo.prototype.c = 3;
  35399. *
  35400. * _.keys(new Foo);
  35401. * // => ['a', 'b'] (iteration order is not guaranteed)
  35402. *
  35403. * _.keys('hi');
  35404. * // => ['0', '1']
  35405. */
  35406. function keys(object) {
  35407. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  35408. }
  35409. module.exports = keys;
  35410. /***/ }),
  35411. /* 636 */
  35412. /***/ (function(module, exports, __webpack_require__) {
  35413. var baseTimes = __webpack_require__(637),
  35414. isArguments = __webpack_require__(638),
  35415. isArray = __webpack_require__(273),
  35416. isBuffer = __webpack_require__(642),
  35417. isIndex = __webpack_require__(644),
  35418. isTypedArray = __webpack_require__(645);
  35419. /** Used for built-in method references. */
  35420. var objectProto = Object.prototype;
  35421. /** Used to check objects for own properties. */
  35422. var hasOwnProperty = objectProto.hasOwnProperty;
  35423. /**
  35424. * Creates an array of the enumerable property names of the array-like `value`.
  35425. *
  35426. * @private
  35427. * @param {*} value The value to query.
  35428. * @param {boolean} inherited Specify returning inherited property names.
  35429. * @returns {Array} Returns the array of property names.
  35430. */
  35431. function arrayLikeKeys(value, inherited) {
  35432. var isArr = isArray(value),
  35433. isArg = !isArr && isArguments(value),
  35434. isBuff = !isArr && !isArg && isBuffer(value),
  35435. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  35436. skipIndexes = isArr || isArg || isBuff || isType,
  35437. result = skipIndexes ? baseTimes(value.length, String) : [],
  35438. length = result.length;
  35439. for (var key in value) {
  35440. if ((inherited || hasOwnProperty.call(value, key)) &&
  35441. !(skipIndexes && (
  35442. // Safari 9 has enumerable `arguments.length` in strict mode.
  35443. key == 'length' ||
  35444. // Node.js 0.10 has enumerable non-index properties on buffers.
  35445. (isBuff && (key == 'offset' || key == 'parent')) ||
  35446. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  35447. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  35448. // Skip index properties.
  35449. isIndex(key, length)
  35450. ))) {
  35451. result.push(key);
  35452. }
  35453. }
  35454. return result;
  35455. }
  35456. module.exports = arrayLikeKeys;
  35457. /***/ }),
  35458. /* 637 */
  35459. /***/ (function(module, exports) {
  35460. /**
  35461. * The base implementation of `_.times` without support for iteratee shorthands
  35462. * or max array length checks.
  35463. *
  35464. * @private
  35465. * @param {number} n The number of times to invoke `iteratee`.
  35466. * @param {Function} iteratee The function invoked per iteration.
  35467. * @returns {Array} Returns the array of results.
  35468. */
  35469. function baseTimes(n, iteratee) {
  35470. var index = -1,
  35471. result = Array(n);
  35472. while (++index < n) {
  35473. result[index] = iteratee(index);
  35474. }
  35475. return result;
  35476. }
  35477. module.exports = baseTimes;
  35478. /***/ }),
  35479. /* 638 */
  35480. /***/ (function(module, exports, __webpack_require__) {
  35481. var baseIsArguments = __webpack_require__(639),
  35482. isObjectLike = __webpack_require__(119);
  35483. /** Used for built-in method references. */
  35484. var objectProto = Object.prototype;
  35485. /** Used to check objects for own properties. */
  35486. var hasOwnProperty = objectProto.hasOwnProperty;
  35487. /** Built-in value references. */
  35488. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  35489. /**
  35490. * Checks if `value` is likely an `arguments` object.
  35491. *
  35492. * @static
  35493. * @memberOf _
  35494. * @since 0.1.0
  35495. * @category Lang
  35496. * @param {*} value The value to check.
  35497. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  35498. * else `false`.
  35499. * @example
  35500. *
  35501. * _.isArguments(function() { return arguments; }());
  35502. * // => true
  35503. *
  35504. * _.isArguments([1, 2, 3]);
  35505. * // => false
  35506. */
  35507. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  35508. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  35509. !propertyIsEnumerable.call(value, 'callee');
  35510. };
  35511. module.exports = isArguments;
  35512. /***/ }),
  35513. /* 639 */
  35514. /***/ (function(module, exports, __webpack_require__) {
  35515. var baseGetTag = __webpack_require__(118),
  35516. isObjectLike = __webpack_require__(119);
  35517. /** `Object#toString` result references. */
  35518. var argsTag = '[object Arguments]';
  35519. /**
  35520. * The base implementation of `_.isArguments`.
  35521. *
  35522. * @private
  35523. * @param {*} value The value to check.
  35524. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  35525. */
  35526. function baseIsArguments(value) {
  35527. return isObjectLike(value) && baseGetTag(value) == argsTag;
  35528. }
  35529. module.exports = baseIsArguments;
  35530. /***/ }),
  35531. /* 640 */
  35532. /***/ (function(module, exports, __webpack_require__) {
  35533. var Symbol = __webpack_require__(270);
  35534. /** Used for built-in method references. */
  35535. var objectProto = Object.prototype;
  35536. /** Used to check objects for own properties. */
  35537. var hasOwnProperty = objectProto.hasOwnProperty;
  35538. /**
  35539. * Used to resolve the
  35540. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  35541. * of values.
  35542. */
  35543. var nativeObjectToString = objectProto.toString;
  35544. /** Built-in value references. */
  35545. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  35546. /**
  35547. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  35548. *
  35549. * @private
  35550. * @param {*} value The value to query.
  35551. * @returns {string} Returns the raw `toStringTag`.
  35552. */
  35553. function getRawTag(value) {
  35554. var isOwn = hasOwnProperty.call(value, symToStringTag),
  35555. tag = value[symToStringTag];
  35556. try {
  35557. value[symToStringTag] = undefined;
  35558. var unmasked = true;
  35559. } catch (e) {}
  35560. var result = nativeObjectToString.call(value);
  35561. if (unmasked) {
  35562. if (isOwn) {
  35563. value[symToStringTag] = tag;
  35564. } else {
  35565. delete value[symToStringTag];
  35566. }
  35567. }
  35568. return result;
  35569. }
  35570. module.exports = getRawTag;
  35571. /***/ }),
  35572. /* 641 */
  35573. /***/ (function(module, exports) {
  35574. /** Used for built-in method references. */
  35575. var objectProto = Object.prototype;
  35576. /**
  35577. * Used to resolve the
  35578. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  35579. * of values.
  35580. */
  35581. var nativeObjectToString = objectProto.toString;
  35582. /**
  35583. * Converts `value` to a string using `Object.prototype.toString`.
  35584. *
  35585. * @private
  35586. * @param {*} value The value to convert.
  35587. * @returns {string} Returns the converted string.
  35588. */
  35589. function objectToString(value) {
  35590. return nativeObjectToString.call(value);
  35591. }
  35592. module.exports = objectToString;
  35593. /***/ }),
  35594. /* 642 */
  35595. /***/ (function(module, exports, __webpack_require__) {
  35596. /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(271),
  35597. stubFalse = __webpack_require__(643);
  35598. /** Detect free variable `exports`. */
  35599. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  35600. /** Detect free variable `module`. */
  35601. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  35602. /** Detect the popular CommonJS extension `module.exports`. */
  35603. var moduleExports = freeModule && freeModule.exports === freeExports;
  35604. /** Built-in value references. */
  35605. var Buffer = moduleExports ? root.Buffer : undefined;
  35606. /* Built-in method references for those with the same name as other `lodash` methods. */
  35607. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  35608. /**
  35609. * Checks if `value` is a buffer.
  35610. *
  35611. * @static
  35612. * @memberOf _
  35613. * @since 4.3.0
  35614. * @category Lang
  35615. * @param {*} value The value to check.
  35616. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  35617. * @example
  35618. *
  35619. * _.isBuffer(new Buffer(2));
  35620. * // => true
  35621. *
  35622. * _.isBuffer(new Uint8Array(2));
  35623. * // => false
  35624. */
  35625. var isBuffer = nativeIsBuffer || stubFalse;
  35626. module.exports = isBuffer;
  35627. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module)))
  35628. /***/ }),
  35629. /* 643 */
  35630. /***/ (function(module, exports) {
  35631. /**
  35632. * This method returns `false`.
  35633. *
  35634. * @static
  35635. * @memberOf _
  35636. * @since 4.13.0
  35637. * @category Util
  35638. * @returns {boolean} Returns `false`.
  35639. * @example
  35640. *
  35641. * _.times(2, _.stubFalse);
  35642. * // => [false, false]
  35643. */
  35644. function stubFalse() {
  35645. return false;
  35646. }
  35647. module.exports = stubFalse;
  35648. /***/ }),
  35649. /* 644 */
  35650. /***/ (function(module, exports) {
  35651. /** Used as references for various `Number` constants. */
  35652. var MAX_SAFE_INTEGER = 9007199254740991;
  35653. /** Used to detect unsigned integer values. */
  35654. var reIsUint = /^(?:0|[1-9]\d*)$/;
  35655. /**
  35656. * Checks if `value` is a valid array-like index.
  35657. *
  35658. * @private
  35659. * @param {*} value The value to check.
  35660. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  35661. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  35662. */
  35663. function isIndex(value, length) {
  35664. var type = typeof value;
  35665. length = length == null ? MAX_SAFE_INTEGER : length;
  35666. return !!length &&
  35667. (type == 'number' ||
  35668. (type != 'symbol' && reIsUint.test(value))) &&
  35669. (value > -1 && value % 1 == 0 && value < length);
  35670. }
  35671. module.exports = isIndex;
  35672. /***/ }),
  35673. /* 645 */
  35674. /***/ (function(module, exports, __webpack_require__) {
  35675. var baseIsTypedArray = __webpack_require__(646),
  35676. baseUnary = __webpack_require__(647),
  35677. nodeUtil = __webpack_require__(648);
  35678. /* Node.js helper references. */
  35679. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  35680. /**
  35681. * Checks if `value` is classified as a typed array.
  35682. *
  35683. * @static
  35684. * @memberOf _
  35685. * @since 3.0.0
  35686. * @category Lang
  35687. * @param {*} value The value to check.
  35688. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  35689. * @example
  35690. *
  35691. * _.isTypedArray(new Uint8Array);
  35692. * // => true
  35693. *
  35694. * _.isTypedArray([]);
  35695. * // => false
  35696. */
  35697. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  35698. module.exports = isTypedArray;
  35699. /***/ }),
  35700. /* 646 */
  35701. /***/ (function(module, exports, __webpack_require__) {
  35702. var baseGetTag = __webpack_require__(118),
  35703. isLength = __webpack_require__(275),
  35704. isObjectLike = __webpack_require__(119);
  35705. /** `Object#toString` result references. */
  35706. var argsTag = '[object Arguments]',
  35707. arrayTag = '[object Array]',
  35708. boolTag = '[object Boolean]',
  35709. dateTag = '[object Date]',
  35710. errorTag = '[object Error]',
  35711. funcTag = '[object Function]',
  35712. mapTag = '[object Map]',
  35713. numberTag = '[object Number]',
  35714. objectTag = '[object Object]',
  35715. regexpTag = '[object RegExp]',
  35716. setTag = '[object Set]',
  35717. stringTag = '[object String]',
  35718. weakMapTag = '[object WeakMap]';
  35719. var arrayBufferTag = '[object ArrayBuffer]',
  35720. dataViewTag = '[object DataView]',
  35721. float32Tag = '[object Float32Array]',
  35722. float64Tag = '[object Float64Array]',
  35723. int8Tag = '[object Int8Array]',
  35724. int16Tag = '[object Int16Array]',
  35725. int32Tag = '[object Int32Array]',
  35726. uint8Tag = '[object Uint8Array]',
  35727. uint8ClampedTag = '[object Uint8ClampedArray]',
  35728. uint16Tag = '[object Uint16Array]',
  35729. uint32Tag = '[object Uint32Array]';
  35730. /** Used to identify `toStringTag` values of typed arrays. */
  35731. var typedArrayTags = {};
  35732. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  35733. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  35734. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  35735. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  35736. typedArrayTags[uint32Tag] = true;
  35737. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  35738. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  35739. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  35740. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  35741. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  35742. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  35743. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  35744. typedArrayTags[weakMapTag] = false;
  35745. /**
  35746. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  35747. *
  35748. * @private
  35749. * @param {*} value The value to check.
  35750. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  35751. */
  35752. function baseIsTypedArray(value) {
  35753. return isObjectLike(value) &&
  35754. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  35755. }
  35756. module.exports = baseIsTypedArray;
  35757. /***/ }),
  35758. /* 647 */
  35759. /***/ (function(module, exports) {
  35760. /**
  35761. * The base implementation of `_.unary` without support for storing metadata.
  35762. *
  35763. * @private
  35764. * @param {Function} func The function to cap arguments for.
  35765. * @returns {Function} Returns the new capped function.
  35766. */
  35767. function baseUnary(func) {
  35768. return function(value) {
  35769. return func(value);
  35770. };
  35771. }
  35772. module.exports = baseUnary;
  35773. /***/ }),
  35774. /* 648 */
  35775. /***/ (function(module, exports, __webpack_require__) {
  35776. /* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(272);
  35777. /** Detect free variable `exports`. */
  35778. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  35779. /** Detect free variable `module`. */
  35780. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  35781. /** Detect the popular CommonJS extension `module.exports`. */
  35782. var moduleExports = freeModule && freeModule.exports === freeExports;
  35783. /** Detect free variable `process` from Node.js. */
  35784. var freeProcess = moduleExports && freeGlobal.process;
  35785. /** Used to access faster Node.js helpers. */
  35786. var nodeUtil = (function() {
  35787. try {
  35788. // Use `util.types` for Node.js 10+.
  35789. var types = freeModule && freeModule.require && freeModule.require('util').types;
  35790. if (types) {
  35791. return types;
  35792. }
  35793. // Legacy `process.binding('util')` for Node.js < 10.
  35794. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  35795. } catch (e) {}
  35796. }());
  35797. module.exports = nodeUtil;
  35798. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module)))
  35799. /***/ }),
  35800. /* 649 */
  35801. /***/ (function(module, exports, __webpack_require__) {
  35802. var isPrototype = __webpack_require__(650),
  35803. nativeKeys = __webpack_require__(651);
  35804. /** Used for built-in method references. */
  35805. var objectProto = Object.prototype;
  35806. /** Used to check objects for own properties. */
  35807. var hasOwnProperty = objectProto.hasOwnProperty;
  35808. /**
  35809. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  35810. *
  35811. * @private
  35812. * @param {Object} object The object to query.
  35813. * @returns {Array} Returns the array of property names.
  35814. */
  35815. function baseKeys(object) {
  35816. if (!isPrototype(object)) {
  35817. return nativeKeys(object);
  35818. }
  35819. var result = [];
  35820. for (var key in Object(object)) {
  35821. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  35822. result.push(key);
  35823. }
  35824. }
  35825. return result;
  35826. }
  35827. module.exports = baseKeys;
  35828. /***/ }),
  35829. /* 650 */
  35830. /***/ (function(module, exports) {
  35831. /** Used for built-in method references. */
  35832. var objectProto = Object.prototype;
  35833. /**
  35834. * Checks if `value` is likely a prototype object.
  35835. *
  35836. * @private
  35837. * @param {*} value The value to check.
  35838. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  35839. */
  35840. function isPrototype(value) {
  35841. var Ctor = value && value.constructor,
  35842. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  35843. return value === proto;
  35844. }
  35845. module.exports = isPrototype;
  35846. /***/ }),
  35847. /* 651 */
  35848. /***/ (function(module, exports, __webpack_require__) {
  35849. var overArg = __webpack_require__(276);
  35850. /* Built-in method references for those with the same name as other `lodash` methods. */
  35851. var nativeKeys = overArg(Object.keys, Object);
  35852. module.exports = nativeKeys;
  35853. /***/ }),
  35854. /* 652 */
  35855. /***/ (function(module, exports, __webpack_require__) {
  35856. var isFunction = __webpack_require__(653),
  35857. isLength = __webpack_require__(275);
  35858. /**
  35859. * Checks if `value` is array-like. A value is considered array-like if it's
  35860. * not a function and has a `value.length` that's an integer greater than or
  35861. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  35862. *
  35863. * @static
  35864. * @memberOf _
  35865. * @since 4.0.0
  35866. * @category Lang
  35867. * @param {*} value The value to check.
  35868. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  35869. * @example
  35870. *
  35871. * _.isArrayLike([1, 2, 3]);
  35872. * // => true
  35873. *
  35874. * _.isArrayLike(document.body.children);
  35875. * // => true
  35876. *
  35877. * _.isArrayLike('abc');
  35878. * // => true
  35879. *
  35880. * _.isArrayLike(_.noop);
  35881. * // => false
  35882. */
  35883. function isArrayLike(value) {
  35884. return value != null && isLength(value.length) && !isFunction(value);
  35885. }
  35886. module.exports = isArrayLike;
  35887. /***/ }),
  35888. /* 653 */
  35889. /***/ (function(module, exports, __webpack_require__) {
  35890. var baseGetTag = __webpack_require__(118),
  35891. isObject = __webpack_require__(654);
  35892. /** `Object#toString` result references. */
  35893. var asyncTag = '[object AsyncFunction]',
  35894. funcTag = '[object Function]',
  35895. genTag = '[object GeneratorFunction]',
  35896. proxyTag = '[object Proxy]';
  35897. /**
  35898. * Checks if `value` is classified as a `Function` object.
  35899. *
  35900. * @static
  35901. * @memberOf _
  35902. * @since 0.1.0
  35903. * @category Lang
  35904. * @param {*} value The value to check.
  35905. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  35906. * @example
  35907. *
  35908. * _.isFunction(_);
  35909. * // => true
  35910. *
  35911. * _.isFunction(/abc/);
  35912. * // => false
  35913. */
  35914. function isFunction(value) {
  35915. if (!isObject(value)) {
  35916. return false;
  35917. }
  35918. // The use of `Object#toString` avoids issues with the `typeof` operator
  35919. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  35920. var tag = baseGetTag(value);
  35921. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  35922. }
  35923. module.exports = isFunction;
  35924. /***/ }),
  35925. /* 654 */
  35926. /***/ (function(module, exports) {
  35927. /**
  35928. * Checks if `value` is the
  35929. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  35930. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  35931. *
  35932. * @static
  35933. * @memberOf _
  35934. * @since 0.1.0
  35935. * @category Lang
  35936. * @param {*} value The value to check.
  35937. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  35938. * @example
  35939. *
  35940. * _.isObject({});
  35941. * // => true
  35942. *
  35943. * _.isObject([1, 2, 3]);
  35944. * // => true
  35945. *
  35946. * _.isObject(_.noop);
  35947. * // => true
  35948. *
  35949. * _.isObject(null);
  35950. * // => false
  35951. */
  35952. function isObject(value) {
  35953. var type = typeof value;
  35954. return value != null && (type == 'object' || type == 'function');
  35955. }
  35956. module.exports = isObject;
  35957. /***/ }),
  35958. /* 655 */
  35959. /***/ (function(module, exports, __webpack_require__) {
  35960. var arrayWithHoles = __webpack_require__(656);
  35961. var iterableToArray = __webpack_require__(266);
  35962. var unsupportedIterableToArray = __webpack_require__(267);
  35963. var nonIterableRest = __webpack_require__(657);
  35964. function _toArray(arr) {
  35965. return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
  35966. }
  35967. module.exports = _toArray;
  35968. /***/ }),
  35969. /* 656 */
  35970. /***/ (function(module, exports) {
  35971. function _arrayWithHoles(arr) {
  35972. if (Array.isArray(arr)) return arr;
  35973. }
  35974. module.exports = _arrayWithHoles;
  35975. /***/ }),
  35976. /* 657 */
  35977. /***/ (function(module, exports) {
  35978. function _nonIterableRest() {
  35979. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  35980. }
  35981. module.exports = _nonIterableRest;
  35982. /***/ }),
  35983. /* 658 */
  35984. /***/ (function(module, exports) {
  35985. function _defineProperties(target, props) {
  35986. for (var i = 0; i < props.length; i++) {
  35987. var descriptor = props[i];
  35988. descriptor.enumerable = descriptor.enumerable || false;
  35989. descriptor.configurable = true;
  35990. if ("value" in descriptor) descriptor.writable = true;
  35991. Object.defineProperty(target, descriptor.key, descriptor);
  35992. }
  35993. }
  35994. function _createClass(Constructor, protoProps, staticProps) {
  35995. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  35996. if (staticProps) _defineProperties(Constructor, staticProps);
  35997. return Constructor;
  35998. }
  35999. module.exports = _createClass;
  36000. /***/ }),
  36001. /* 659 */
  36002. /***/ (function(module, exports) {
  36003. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
  36004. var desc = {};
  36005. Object.keys(descriptor).forEach(function (key) {
  36006. desc[key] = descriptor[key];
  36007. });
  36008. desc.enumerable = !!desc.enumerable;
  36009. desc.configurable = !!desc.configurable;
  36010. if ('value' in desc || desc.initializer) {
  36011. desc.writable = true;
  36012. }
  36013. desc = decorators.slice().reverse().reduce(function (desc, decorator) {
  36014. return decorator(target, property, desc) || desc;
  36015. }, desc);
  36016. if (context && desc.initializer !== void 0) {
  36017. desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
  36018. desc.initializer = undefined;
  36019. }
  36020. if (desc.initializer === void 0) {
  36021. Object.defineProperty(target, property, desc);
  36022. desc = null;
  36023. }
  36024. return desc;
  36025. }
  36026. module.exports = _applyDecoratedDescriptor;
  36027. /***/ }),
  36028. /* 660 */
  36029. /***/ (function(module, exports, __webpack_require__) {
  36030. /*
  36031. Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
  36032. Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
  36033. Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
  36034. */
  36035. (function () {
  36036. var StateMachine = {
  36037. //---------------------------------------------------------------------------
  36038. VERSION: "2.4.0",
  36039. //---------------------------------------------------------------------------
  36040. Result: {
  36041. SUCCEEDED: 1, // the event transitioned successfully from one state to another
  36042. NOTRANSITION: 2, // the event was successfull but no state transition was necessary
  36043. CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
  36044. PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
  36045. },
  36046. Error: {
  36047. INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
  36048. PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
  36049. INVALID_CALLBACK: 300 // caller provided callback function threw an exception
  36050. },
  36051. WILDCARD: '*',
  36052. ASYNC: 'async',
  36053. //---------------------------------------------------------------------------
  36054. create: function(cfg, target) {
  36055. var initial = (typeof cfg.initial == 'string') ? { state: cfg.initial } : cfg.initial; // allow for a simple string, or an object with { state: 'foo', event: 'setup', defer: true|false }
  36056. var terminal = cfg.terminal || cfg['final'];
  36057. var fsm = target || cfg.target || {};
  36058. var events = cfg.events || [];
  36059. var callbacks = cfg.callbacks || {};
  36060. var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
  36061. var transitions = {}; // track events allowed from a state { state: [ event ] }
  36062. var add = function(e) {
  36063. var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
  36064. map[e.name] = map[e.name] || {};
  36065. for (var n = 0 ; n < from.length ; n++) {
  36066. transitions[from[n]] = transitions[from[n]] || [];
  36067. transitions[from[n]].push(e.name);
  36068. map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
  36069. }
  36070. if (e.to)
  36071. transitions[e.to] = transitions[e.to] || [];
  36072. };
  36073. if (initial) {
  36074. initial.event = initial.event || 'startup';
  36075. add({ name: initial.event, from: 'none', to: initial.state });
  36076. }
  36077. for(var n = 0 ; n < events.length ; n++)
  36078. add(events[n]);
  36079. for(var name in map) {
  36080. if (map.hasOwnProperty(name))
  36081. fsm[name] = StateMachine.buildEvent(name, map[name]);
  36082. }
  36083. for(var name in callbacks) {
  36084. if (callbacks.hasOwnProperty(name))
  36085. fsm[name] = callbacks[name]
  36086. }
  36087. fsm.current = 'none';
  36088. fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
  36089. fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
  36090. fsm.cannot = function(event) { return !this.can(event); };
  36091. fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
  36092. fsm.isFinished = function() { return this.is(terminal); };
  36093. fsm.error = cfg.error || function(name, from, to, args, error, msg, e) { throw e || msg; }; // default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired (see github issue #3 and #17)
  36094. fsm.states = function() { return Object.keys(transitions).sort() };
  36095. if (initial && !initial.defer)
  36096. fsm[initial.event]();
  36097. return fsm;
  36098. },
  36099. //===========================================================================
  36100. doCallback: function(fsm, func, name, from, to, args) {
  36101. if (func) {
  36102. try {
  36103. return func.apply(fsm, [name, from, to].concat(args));
  36104. }
  36105. catch(e) {
  36106. return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
  36107. }
  36108. }
  36109. },
  36110. beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
  36111. afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
  36112. leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
  36113. enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
  36114. changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
  36115. beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
  36116. afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
  36117. leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
  36118. enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
  36119. beforeEvent: function(fsm, name, from, to, args) {
  36120. if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
  36121. (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
  36122. return false;
  36123. },
  36124. afterEvent: function(fsm, name, from, to, args) {
  36125. StateMachine.afterThisEvent(fsm, name, from, to, args);
  36126. StateMachine.afterAnyEvent( fsm, name, from, to, args);
  36127. },
  36128. leaveState: function(fsm, name, from, to, args) {
  36129. var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
  36130. general = StateMachine.leaveAnyState( fsm, name, from, to, args);
  36131. if ((false === specific) || (false === general))
  36132. return false;
  36133. else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
  36134. return StateMachine.ASYNC;
  36135. },
  36136. enterState: function(fsm, name, from, to, args) {
  36137. StateMachine.enterThisState(fsm, name, from, to, args);
  36138. StateMachine.enterAnyState( fsm, name, from, to, args);
  36139. },
  36140. //===========================================================================
  36141. buildEvent: function(name, map) {
  36142. return function() {
  36143. var from = this.current;
  36144. var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
  36145. var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
  36146. if (this.transition)
  36147. return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
  36148. if (this.cannot(name))
  36149. return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
  36150. if (false === StateMachine.beforeEvent(this, name, from, to, args))
  36151. return StateMachine.Result.CANCELLED;
  36152. if (from === to) {
  36153. StateMachine.afterEvent(this, name, from, to, args);
  36154. return StateMachine.Result.NOTRANSITION;
  36155. }
  36156. // prepare a transition method for use EITHER lower down, or by caller if they want an async transition (indicated by an ASYNC return value from leaveState)
  36157. var fsm = this;
  36158. this.transition = function() {
  36159. fsm.transition = null; // this method should only ever be called once
  36160. fsm.current = to;
  36161. StateMachine.enterState( fsm, name, from, to, args);
  36162. StateMachine.changeState(fsm, name, from, to, args);
  36163. StateMachine.afterEvent( fsm, name, from, to, args);
  36164. return StateMachine.Result.SUCCEEDED;
  36165. };
  36166. this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
  36167. fsm.transition = null;
  36168. StateMachine.afterEvent(fsm, name, from, to, args);
  36169. }
  36170. var leave = StateMachine.leaveState(this, name, from, to, args);
  36171. if (false === leave) {
  36172. this.transition = null;
  36173. return StateMachine.Result.CANCELLED;
  36174. }
  36175. else if (StateMachine.ASYNC === leave) {
  36176. return StateMachine.Result.PENDING;
  36177. }
  36178. else {
  36179. if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
  36180. return this.transition();
  36181. }
  36182. };
  36183. }
  36184. }; // StateMachine
  36185. //===========================================================================
  36186. //======
  36187. // NODE
  36188. //======
  36189. if (true) {
  36190. if (typeof module !== 'undefined' && module.exports) {
  36191. exports = module.exports = StateMachine;
  36192. }
  36193. exports.StateMachine = StateMachine;
  36194. }
  36195. //============
  36196. // AMD/REQUIRE
  36197. //============
  36198. else if (typeof define === 'function' && define.amd) {
  36199. define(function(require) { return StateMachine; });
  36200. }
  36201. //========
  36202. // BROWSER
  36203. //========
  36204. else if (typeof window !== 'undefined') {
  36205. window.StateMachine = StateMachine;
  36206. }
  36207. //===========
  36208. // WEB WORKER
  36209. //===========
  36210. else if (typeof self !== 'undefined') {
  36211. self.StateMachine = StateMachine;
  36212. }
  36213. }());
  36214. /***/ }),
  36215. /* 661 */
  36216. /***/ (function(module, exports) {
  36217. function _typeof(obj) {
  36218. "@babel/helpers - typeof";
  36219. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  36220. module.exports = _typeof = function _typeof(obj) {
  36221. return typeof obj;
  36222. };
  36223. } else {
  36224. module.exports = _typeof = function _typeof(obj) {
  36225. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  36226. };
  36227. }
  36228. return _typeof(obj);
  36229. }
  36230. module.exports = _typeof;
  36231. /***/ }),
  36232. /* 662 */
  36233. /***/ (function(module, exports, __webpack_require__) {
  36234. var baseGetTag = __webpack_require__(118),
  36235. getPrototype = __webpack_require__(663),
  36236. isObjectLike = __webpack_require__(119);
  36237. /** `Object#toString` result references. */
  36238. var objectTag = '[object Object]';
  36239. /** Used for built-in method references. */
  36240. var funcProto = Function.prototype,
  36241. objectProto = Object.prototype;
  36242. /** Used to resolve the decompiled source of functions. */
  36243. var funcToString = funcProto.toString;
  36244. /** Used to check objects for own properties. */
  36245. var hasOwnProperty = objectProto.hasOwnProperty;
  36246. /** Used to infer the `Object` constructor. */
  36247. var objectCtorString = funcToString.call(Object);
  36248. /**
  36249. * Checks if `value` is a plain object, that is, an object created by the
  36250. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  36251. *
  36252. * @static
  36253. * @memberOf _
  36254. * @since 0.8.0
  36255. * @category Lang
  36256. * @param {*} value The value to check.
  36257. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  36258. * @example
  36259. *
  36260. * function Foo() {
  36261. * this.a = 1;
  36262. * }
  36263. *
  36264. * _.isPlainObject(new Foo);
  36265. * // => false
  36266. *
  36267. * _.isPlainObject([1, 2, 3]);
  36268. * // => false
  36269. *
  36270. * _.isPlainObject({ 'x': 0, 'y': 0 });
  36271. * // => true
  36272. *
  36273. * _.isPlainObject(Object.create(null));
  36274. * // => true
  36275. */
  36276. function isPlainObject(value) {
  36277. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  36278. return false;
  36279. }
  36280. var proto = getPrototype(value);
  36281. if (proto === null) {
  36282. return true;
  36283. }
  36284. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  36285. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  36286. funcToString.call(Ctor) == objectCtorString;
  36287. }
  36288. module.exports = isPlainObject;
  36289. /***/ }),
  36290. /* 663 */
  36291. /***/ (function(module, exports, __webpack_require__) {
  36292. var overArg = __webpack_require__(276);
  36293. /** Built-in value references. */
  36294. var getPrototype = overArg(Object.getPrototypeOf, Object);
  36295. module.exports = getPrototype;
  36296. /***/ }),
  36297. /* 664 */
  36298. /***/ (function(module, exports, __webpack_require__) {
  36299. "use strict";
  36300. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  36301. var _interopRequireDefault = __webpack_require__(1);
  36302. var _isIterable2 = _interopRequireDefault(__webpack_require__(665));
  36303. var _from = _interopRequireDefault(__webpack_require__(252));
  36304. var _set = _interopRequireDefault(__webpack_require__(264));
  36305. var _concat = _interopRequireDefault(__webpack_require__(22));
  36306. var _assign = _interopRequireDefault(__webpack_require__(152));
  36307. var _map = _interopRequireDefault(__webpack_require__(35));
  36308. var _defineProperty = _interopRequireDefault(__webpack_require__(92));
  36309. var _typeof2 = _interopRequireDefault(__webpack_require__(73));
  36310. (function (global, factory) {
  36311. ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(156)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(156)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  36312. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  36313. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  36314. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
  36315. })(void 0, function (exports, core) {
  36316. 'use strict';
  36317. function _inheritsLoose(subClass, superClass) {
  36318. subClass.prototype = Object.create(superClass.prototype);
  36319. subClass.prototype.constructor = subClass;
  36320. subClass.__proto__ = superClass;
  36321. }
  36322. function _toConsumableArray(arr) {
  36323. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
  36324. }
  36325. function _arrayWithoutHoles(arr) {
  36326. if (Array.isArray(arr)) {
  36327. for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
  36328. arr2[i] = arr[i];
  36329. }
  36330. return arr2;
  36331. }
  36332. }
  36333. function _iterableToArray(iter) {
  36334. if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
  36335. }
  36336. function _nonIterableSpread() {
  36337. throw new TypeError("Invalid attempt to spread non-iterable instance");
  36338. }
  36339. /* eslint-disable import/no-unresolved */
  36340. if (!core.Protocals) {
  36341. throw new Error('LeanCloud Realtime SDK not installed');
  36342. }
  36343. var CommandType = core.Protocals.CommandType,
  36344. GenericCommand = core.Protocals.GenericCommand,
  36345. AckCommand = core.Protocals.AckCommand;
  36346. var warn = function warn(error) {
  36347. return console.warn(error.message);
  36348. };
  36349. var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
  36350. _inheritsLoose(LiveQueryClient, _EventEmitter);
  36351. function LiveQueryClient(appId, subscriptionId, connection) {
  36352. var _this;
  36353. _this = _EventEmitter.call(this) || this;
  36354. _this._appId = appId;
  36355. _this.id = subscriptionId;
  36356. _this._connection = connection;
  36357. _this._eventemitter = new core.EventEmitter();
  36358. _this._querys = new _set.default();
  36359. return _this;
  36360. }
  36361. var _proto = LiveQueryClient.prototype;
  36362. _proto._send = function _send(cmd) {
  36363. var _context;
  36364. var _this$_connection;
  36365. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  36366. args[_key - 1] = arguments[_key];
  36367. }
  36368. return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
  36369. appId: this._appId,
  36370. installationId: this.id,
  36371. service: 1
  36372. })]).call(_context, args));
  36373. };
  36374. _proto._open = function _open() {
  36375. return this._send(new GenericCommand({
  36376. cmd: CommandType.login
  36377. }));
  36378. };
  36379. _proto.close = function close() {
  36380. var _ee = this._eventemitter;
  36381. _ee.emit('beforeclose');
  36382. return this._send(new GenericCommand({
  36383. cmd: CommandType.logout
  36384. })).then(function () {
  36385. return _ee.emit('close');
  36386. });
  36387. };
  36388. _proto.register = function register(liveQuery) {
  36389. this._querys.add(liveQuery);
  36390. };
  36391. _proto.deregister = function deregister(liveQuery) {
  36392. var _this2 = this;
  36393. this._querys.delete(liveQuery);
  36394. setTimeout(function () {
  36395. if (!_this2._querys.size) _this2.close().catch(warn);
  36396. }, 0);
  36397. };
  36398. _proto._dispatchCommand = function _dispatchCommand(command) {
  36399. if (command.cmd !== CommandType.data) {
  36400. this.emit('unhandledmessage', command);
  36401. return core.Promise.resolve();
  36402. }
  36403. return this._dispatchDataCommand(command);
  36404. };
  36405. _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
  36406. var _ref$dataMessage = _ref.dataMessage,
  36407. ids = _ref$dataMessage.ids,
  36408. msg = _ref$dataMessage.msg;
  36409. this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
  36410. var data = _ref2.data;
  36411. return JSON.parse(data);
  36412. })); // send ack
  36413. var command = new GenericCommand({
  36414. cmd: CommandType.ack,
  36415. ackMessage: new AckCommand({
  36416. ids: ids
  36417. })
  36418. });
  36419. return this._send(command, false).catch(warn);
  36420. };
  36421. return LiveQueryClient;
  36422. }(core.EventEmitter);
  36423. var finalize = function finalize(callback) {
  36424. return [// eslint-disable-next-line no-sequences
  36425. function (value) {
  36426. return callback(), value;
  36427. }, function (error) {
  36428. callback();
  36429. throw error;
  36430. }];
  36431. };
  36432. var onRealtimeCreate = function onRealtimeCreate(realtime) {
  36433. /* eslint-disable no-param-reassign */
  36434. realtime._liveQueryClients = {};
  36435. realtime.createLiveQueryClient = function (subscriptionId) {
  36436. var _realtime$_open$then;
  36437. if (realtime._liveQueryClients[subscriptionId] !== undefined) {
  36438. return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
  36439. }
  36440. var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
  36441. var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
  36442. connection.on('reconnect', function () {
  36443. return client._open().then(function () {
  36444. return client.emit('reconnect');
  36445. }, function (error) {
  36446. return client.emit('reconnecterror', error);
  36447. });
  36448. });
  36449. client._eventemitter.on('beforeclose', function () {
  36450. delete realtime._liveQueryClients[client.id];
  36451. }, realtime);
  36452. client._eventemitter.on('close', function () {
  36453. realtime._deregister(client);
  36454. }, realtime);
  36455. return client._open().then(function () {
  36456. realtime._liveQueryClients[client.id] = client;
  36457. realtime._register(client);
  36458. return client;
  36459. });
  36460. })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
  36461. if (realtime._deregisterPending) realtime._deregisterPending(promise);
  36462. })));
  36463. realtime._liveQueryClients[subscriptionId] = promise;
  36464. if (realtime._registerPending) realtime._registerPending(promise);
  36465. return promise;
  36466. };
  36467. /* eslint-enable no-param-reassign */
  36468. };
  36469. var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
  36470. var isLiveQueryCommand = command.installationId && command.service === 1;
  36471. if (!isLiveQueryCommand) return true;
  36472. var targetClient = realtime._liveQueryClients[command.installationId];
  36473. if (targetClient) {
  36474. targetClient._dispatchCommand(command).catch(function (error) {
  36475. return console.warn(error);
  36476. });
  36477. } else {
  36478. console.warn('Unexpected message received without any live client match: %O', command);
  36479. }
  36480. return false;
  36481. }; // eslint-disable-next-line import/prefer-default-export
  36482. var LiveQueryPlugin = {
  36483. name: 'leancloud-realtime-plugin-live-query',
  36484. onRealtimeCreate: onRealtimeCreate,
  36485. beforeCommandDispatch: beforeCommandDispatch
  36486. };
  36487. exports.LiveQueryPlugin = LiveQueryPlugin;
  36488. (0, _defineProperty.default)(exports, '__esModule', {
  36489. value: true
  36490. });
  36491. });
  36492. /***/ }),
  36493. /* 665 */
  36494. /***/ (function(module, exports, __webpack_require__) {
  36495. module.exports = __webpack_require__(666);
  36496. /***/ }),
  36497. /* 666 */
  36498. /***/ (function(module, exports, __webpack_require__) {
  36499. module.exports = __webpack_require__(667);
  36500. /***/ }),
  36501. /* 667 */
  36502. /***/ (function(module, exports, __webpack_require__) {
  36503. var parent = __webpack_require__(668);
  36504. module.exports = parent;
  36505. /***/ }),
  36506. /* 668 */
  36507. /***/ (function(module, exports, __webpack_require__) {
  36508. var parent = __webpack_require__(669);
  36509. module.exports = parent;
  36510. /***/ }),
  36511. /* 669 */
  36512. /***/ (function(module, exports, __webpack_require__) {
  36513. var parent = __webpack_require__(670);
  36514. __webpack_require__(39);
  36515. module.exports = parent;
  36516. /***/ }),
  36517. /* 670 */
  36518. /***/ (function(module, exports, __webpack_require__) {
  36519. __webpack_require__(38);
  36520. __webpack_require__(55);
  36521. var isIterable = __webpack_require__(671);
  36522. module.exports = isIterable;
  36523. /***/ }),
  36524. /* 671 */
  36525. /***/ (function(module, exports, __webpack_require__) {
  36526. var classof = __webpack_require__(51);
  36527. var hasOwn = __webpack_require__(13);
  36528. var wellKnownSymbol = __webpack_require__(9);
  36529. var Iterators = __webpack_require__(50);
  36530. var ITERATOR = wellKnownSymbol('iterator');
  36531. var $Object = Object;
  36532. module.exports = function (it) {
  36533. var O = $Object(it);
  36534. return O[ITERATOR] !== undefined
  36535. || '@@iterator' in O
  36536. || hasOwn(Iterators, classof(O));
  36537. };
  36538. /***/ })
  36539. /******/ ]);
  36540. });
  36541. //# sourceMappingURL=av-live-query-weapp.js.map