parse.weapp.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942
  1. /**
  2. * Parse JavaScript SDK v3.5.1
  3. *
  4. * The source tree of this library can be found at
  5. * https://github.com/ParsePlatform/Parse-SDK-JS
  6. */
  7. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Parse = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
  8. "use strict";
  9. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  10. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  11. _Object$defineProperty(exports, "__esModule", {
  12. value: true
  13. });
  14. exports.track = track;
  15. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  16. /**
  17. * Copyright (c) 2015-present, Parse, LLC.
  18. * All rights reserved.
  19. *
  20. * This source code is licensed under the BSD-style license found in the
  21. * LICENSE file in the root directory of this source tree. An additional grant
  22. * of patent rights can be found in the PATENTS file in the same directory.
  23. *
  24. * @flow
  25. */
  26. /**
  27. * Parse.Analytics provides an interface to Parse's logging and analytics
  28. * backend.
  29. *
  30. * @class Parse.Analytics
  31. * @static
  32. * @hideconstructor
  33. */
  34. /**
  35. * Tracks the occurrence of a custom event with additional dimensions.
  36. * Parse will store a data point at the time of invocation with the given
  37. * event name.
  38. *
  39. * Dimensions will allow segmentation of the occurrences of this custom
  40. * event. Keys and values should be {@code String}s, and will throw
  41. * otherwise.
  42. *
  43. * To track a user signup along with additional metadata, consider the
  44. * following:
  45. * <pre>
  46. * var dimensions = {
  47. * gender: 'm',
  48. * source: 'web',
  49. * dayType: 'weekend'
  50. * };
  51. * Parse.Analytics.track('signup', dimensions);
  52. * </pre>
  53. *
  54. * There is a default limit of 8 dimensions per event tracked.
  55. *
  56. * @function track
  57. * @name Parse.Analytics.track
  58. * @param {string} name The name of the custom event to report to Parse as
  59. * having happened.
  60. * @param {object} dimensions The dictionary of information by which to
  61. * segment this event.
  62. * @returns {Promise} A promise that is resolved when the round-trip
  63. * to the server completes.
  64. */
  65. function track(name
  66. /*: string*/
  67. , dimensions
  68. /*: { [key: string]: string }*/
  69. )
  70. /*: Promise*/
  71. {
  72. name = name || '';
  73. name = name.replace(/^\s*/, '');
  74. name = name.replace(/\s*$/, '');
  75. if (name.length === 0) {
  76. throw new TypeError('A name for the custom event must be provided');
  77. }
  78. for (var _key in dimensions) {
  79. if (typeof _key !== 'string' || typeof dimensions[_key] !== 'string') {
  80. throw new TypeError('track() dimensions expects keys and values of type "string".');
  81. }
  82. }
  83. return _CoreManager.default.getAnalyticsController().track(name, dimensions);
  84. }
  85. var DefaultController = {
  86. track: function (name, dimensions) {
  87. var RESTController = _CoreManager.default.getRESTController();
  88. return RESTController.request('POST', 'events/' + name, {
  89. dimensions: dimensions
  90. });
  91. }
  92. };
  93. _CoreManager.default.setAnalyticsController(DefaultController);
  94. },{"./CoreManager":4,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],2:[function(_dereq_,module,exports){
  95. "use strict";
  96. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  97. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  98. _Object$defineProperty(exports, "__esModule", {
  99. value: true
  100. });
  101. exports.default = void 0;
  102. var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
  103. /**
  104. * Copyright (c) 2015-present, Parse, LLC.
  105. * All rights reserved.
  106. *
  107. * This source code is licensed under the BSD-style license found in the
  108. * LICENSE file in the root directory of this source tree. An additional grant
  109. * of patent rights can be found in the PATENTS file in the same directory.
  110. *
  111. * @flow-weak
  112. */
  113. var uuidv4 = _dereq_('./uuid');
  114. var registered = false;
  115. /**
  116. * Provides utility functions for working with Anonymously logged-in users. <br />
  117. * Anonymous users have some unique characteristics:
  118. * <ul>
  119. * <li>Anonymous users don't need a user name or password.</li>
  120. * <ul>
  121. * <li>Once logged out, an anonymous user cannot be recovered.</li>
  122. * </ul>
  123. * <li>signUp converts an anonymous user to a standard user with the given username and password.</li>
  124. * <ul>
  125. * <li>Data associated with the anonymous user is retained.</li>
  126. * </ul>
  127. * <li>logIn switches users without converting the anonymous user.</li>
  128. * <ul>
  129. * <li>Data associated with the anonymous user will be lost.</li>
  130. * </ul>
  131. * <li>Service logIn (e.g. Facebook, Twitter) will attempt to convert
  132. * the anonymous user into a standard user by linking it to the service.</li>
  133. * <ul>
  134. * <li>If a user already exists that is linked to the service, it will instead switch to the existing user.</li>
  135. * </ul>
  136. * <li>Service linking (e.g. Facebook, Twitter) will convert the anonymous user
  137. * into a standard user by linking it to the service.</li>
  138. * </ul>
  139. *
  140. * @class Parse.AnonymousUtils
  141. * @static
  142. */
  143. var AnonymousUtils = {
  144. /**
  145. * Gets whether the user has their account linked to anonymous user.
  146. *
  147. * @function isLinked
  148. * @name Parse.AnonymousUtils.isLinked
  149. * @param {Parse.User} user User to check for.
  150. * The user must be logged in on this device.
  151. * @returns {boolean} <code>true</code> if the user has their account
  152. * linked to an anonymous user.
  153. * @static
  154. */
  155. isLinked: function (user
  156. /*: ParseUser*/
  157. ) {
  158. var provider = this._getAuthProvider();
  159. return user._isLinked(provider.getAuthType());
  160. },
  161. /**
  162. * Logs in a user Anonymously.
  163. *
  164. * @function logIn
  165. * @name Parse.AnonymousUtils.logIn
  166. * @param {object} options MasterKey / SessionToken.
  167. * @returns {Promise} Logged in user
  168. * @static
  169. */
  170. logIn: function (options
  171. /*:: ?: RequestOptions*/
  172. )
  173. /*: Promise<ParseUser>*/
  174. {
  175. var provider = this._getAuthProvider();
  176. return _ParseUser.default.logInWith(provider.getAuthType(), provider.getAuthData(), options);
  177. },
  178. /**
  179. * Links Anonymous User to an existing PFUser.
  180. *
  181. * @function link
  182. * @name Parse.AnonymousUtils.link
  183. * @param {Parse.User} user User to link. This must be the current user.
  184. * @param {object} options MasterKey / SessionToken.
  185. * @returns {Promise} Linked with User
  186. * @static
  187. */
  188. link: function (user
  189. /*: ParseUser*/
  190. , options
  191. /*:: ?: RequestOptions*/
  192. )
  193. /*: Promise<ParseUser>*/
  194. {
  195. var provider = this._getAuthProvider();
  196. return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
  197. },
  198. /**
  199. * Returns true if Authentication Provider has been registered for use.
  200. *
  201. * @function isRegistered
  202. * @name Parse.AnonymousUtils.isRegistered
  203. * @returns {boolean}
  204. * @static
  205. */
  206. isRegistered: function ()
  207. /*: boolean*/
  208. {
  209. return registered;
  210. },
  211. _getAuthProvider: function () {
  212. var provider = {
  213. restoreAuthentication: function () {
  214. return true;
  215. },
  216. getAuthType: function () {
  217. return 'anonymous';
  218. },
  219. getAuthData: function () {
  220. return {
  221. authData: {
  222. id: uuidv4()
  223. }
  224. };
  225. }
  226. };
  227. if (!registered) {
  228. _ParseUser.default._registerAuthenticationProvider(provider);
  229. registered = true;
  230. }
  231. return provider;
  232. }
  233. };
  234. var _default = AnonymousUtils;
  235. exports.default = _default;
  236. },{"./ParseUser":34,"./uuid":55,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],3:[function(_dereq_,module,exports){
  237. "use strict";
  238. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  239. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  240. _Object$defineProperty(exports, "__esModule", {
  241. value: true
  242. });
  243. exports.getJobStatus = getJobStatus;
  244. exports.getJobsData = getJobsData;
  245. exports.run = run;
  246. exports.startJob = startJob;
  247. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  248. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  249. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  250. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  251. var _decode = _interopRequireDefault(_dereq_("./decode"));
  252. var _encode = _interopRequireDefault(_dereq_("./encode"));
  253. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  254. var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
  255. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  256. /**
  257. * Copyright (c) 2015-present, Parse, LLC.
  258. * All rights reserved.
  259. *
  260. * This source code is licensed under the BSD-style license found in the
  261. * LICENSE file in the root directory of this source tree. An additional grant
  262. * of patent rights can be found in the PATENTS file in the same directory.
  263. *
  264. * @flow
  265. */
  266. /**
  267. * Contains functions for calling and declaring
  268. * <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
  269. * <p><strong><em>
  270. * Some functions are only available from Cloud Code.
  271. * </em></strong></p>
  272. *
  273. * @class Parse.Cloud
  274. * @static
  275. * @hideconstructor
  276. */
  277. /**
  278. * Makes a call to a cloud function.
  279. *
  280. * @function run
  281. * @name Parse.Cloud.run
  282. * @param {string} name The function name.
  283. * @param {object} data The parameters to send to the cloud function.
  284. * @param {object} options
  285. * @returns {Promise} A promise that will be resolved with the result
  286. * of the function.
  287. */
  288. function run(name
  289. /*: string*/
  290. , data
  291. /*: mixed*/
  292. , options
  293. /*: RequestOptions*/
  294. )
  295. /*: Promise<mixed>*/
  296. {
  297. options = options || {};
  298. if (typeof name !== 'string' || name.length === 0) {
  299. throw new TypeError('Cloud function name must be a string.');
  300. }
  301. var requestOptions = {};
  302. if (options.useMasterKey) {
  303. requestOptions.useMasterKey = options.useMasterKey;
  304. }
  305. if (options.sessionToken) {
  306. requestOptions.sessionToken = options.sessionToken;
  307. }
  308. if (options.context && (0, _typeof2.default)(options.context) === 'object') {
  309. requestOptions.context = options.context;
  310. }
  311. return _CoreManager.default.getCloudController().run(name, data, requestOptions);
  312. }
  313. /**
  314. * Gets data for the current set of cloud jobs.
  315. *
  316. * @function getJobsData
  317. * @name Parse.Cloud.getJobsData
  318. * @returns {Promise} A promise that will be resolved with the result
  319. * of the function.
  320. */
  321. function getJobsData()
  322. /*: Promise<Object>*/
  323. {
  324. return _CoreManager.default.getCloudController().getJobsData({
  325. useMasterKey: true
  326. });
  327. }
  328. /**
  329. * Starts a given cloud job, which will process asynchronously.
  330. *
  331. * @function startJob
  332. * @name Parse.Cloud.startJob
  333. * @param {string} name The function name.
  334. * @param {object} data The parameters to send to the cloud function.
  335. * @returns {Promise} A promise that will be resolved with the jobStatusId
  336. * of the job.
  337. */
  338. function startJob(name
  339. /*: string*/
  340. , data
  341. /*: mixed*/
  342. )
  343. /*: Promise<string>*/
  344. {
  345. if (typeof name !== 'string' || name.length === 0) {
  346. throw new TypeError('Cloud job name must be a string.');
  347. }
  348. return _CoreManager.default.getCloudController().startJob(name, data, {
  349. useMasterKey: true
  350. });
  351. }
  352. /**
  353. * Gets job status by Id
  354. *
  355. * @function getJobStatus
  356. * @name Parse.Cloud.getJobStatus
  357. * @param {string} jobStatusId The Id of Job Status.
  358. * @returns {Parse.Object} Status of Job.
  359. */
  360. function getJobStatus(jobStatusId
  361. /*: string*/
  362. )
  363. /*: Promise<ParseObject>*/
  364. {
  365. var query = new _ParseQuery.default('_JobStatus');
  366. return query.get(jobStatusId, {
  367. useMasterKey: true
  368. });
  369. }
  370. var DefaultController = {
  371. run: function (name, data, options
  372. /*: RequestOptions*/
  373. ) {
  374. var RESTController = _CoreManager.default.getRESTController();
  375. var payload = (0, _encode.default)(data, true);
  376. var request = RESTController.request('POST', 'functions/' + name, payload, options);
  377. return request.then(function (res) {
  378. if ((0, _typeof2.default)(res) === 'object' && (0, _keys.default)(res).length > 0 && !res.hasOwnProperty('result')) {
  379. throw new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.');
  380. }
  381. var decoded = (0, _decode.default)(res);
  382. if (decoded && decoded.hasOwnProperty('result')) {
  383. return _promise.default.resolve(decoded.result);
  384. }
  385. return _promise.default.resolve(undefined);
  386. });
  387. },
  388. getJobsData: function (options
  389. /*: RequestOptions*/
  390. ) {
  391. var RESTController = _CoreManager.default.getRESTController();
  392. return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
  393. },
  394. startJob: function (name, data, options
  395. /*: RequestOptions*/
  396. ) {
  397. var RESTController = _CoreManager.default.getRESTController();
  398. var payload = (0, _encode.default)(data, true);
  399. return RESTController.request('POST', 'jobs/' + name, payload, options);
  400. }
  401. };
  402. _CoreManager.default.setCloudController(DefaultController);
  403. },{"./CoreManager":4,"./ParseError":21,"./ParseObject":26,"./ParseQuery":29,"./decode":46,"./encode":47,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],4:[function(_dereq_,module,exports){
  404. (function (process){(function (){
  405. "use strict";
  406. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  407. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  408. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  409. /*
  410. * Copyright (c) 2015-present, Parse, LLC.
  411. * All rights reserved.
  412. *
  413. * This source code is licensed under the BSD-style license found in the
  414. * LICENSE file in the root directory of this source tree. An additional grant
  415. * of patent rights can be found in the PATENTS file in the same directory.
  416. *
  417. * @flow
  418. */
  419. /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
  420. /*:: import type ParseFile from './ParseFile';*/
  421. /*:: import type { FileSource } from './ParseFile';*/
  422. /*:: import type { Op } from './ParseOp';*/
  423. /*:: import type ParseObject from './ParseObject';*/
  424. /*:: import type { QueryJSON } from './ParseQuery';*/
  425. /*:: import type ParseUser from './ParseUser';*/
  426. /*:: import type { AuthData } from './ParseUser';*/
  427. /*:: import type { PushData } from './Push';*/
  428. /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
  429. /*:: type AnalyticsController = {
  430. track: (name: string, dimensions: { [key: string]: string }) => Promise,
  431. };*/
  432. /*:: type CloudController = {
  433. run: (name: string, data: mixed, options: RequestOptions) => Promise,
  434. getJobsData: (options: RequestOptions) => Promise,
  435. startJob: (name: string, data: mixed, options: RequestOptions) => Promise,
  436. };*/
  437. /*:: type ConfigController = {
  438. current: () => Promise,
  439. get: () => Promise,
  440. save: (attrs: { [key: string]: any }) => Promise,
  441. };*/
  442. /*:: type CryptoController = {
  443. encrypt: (obj: any, secretKey: string) => string,
  444. decrypt: (encryptedText: string, secretKey: any) => string,
  445. };*/
  446. /*:: type FileController = {
  447. saveFile: (name: string, source: FileSource, options: FullOptions) => Promise,
  448. saveBase64: (name: string, source: FileSource, options: FullOptions) => Promise,
  449. download: (uri: string) => Promise,
  450. };*/
  451. /*:: type InstallationController = {
  452. currentInstallationId: () => Promise,
  453. };*/
  454. /*:: type ObjectController = {
  455. fetch: (
  456. object: ParseObject | Array<ParseObject>,
  457. forceFetch: boolean,
  458. options: RequestOptions
  459. ) => Promise,
  460. save: (object: ParseObject | Array<ParseObject | ParseFile>, options: RequestOptions) => Promise,
  461. destroy: (object: ParseObject | Array<ParseObject>, options: RequestOptions) => Promise,
  462. };*/
  463. /*:: type ObjectStateController = {
  464. getState: (obj: any) => ?State,
  465. initializeState: (obj: any, initial?: State) => State,
  466. removeState: (obj: any) => ?State,
  467. getServerData: (obj: any) => AttributeMap,
  468. setServerData: (obj: any, attributes: AttributeMap) => void,
  469. getPendingOps: (obj: any) => Array<OpsMap>,
  470. setPendingOp: (obj: any, attr: string, op: ?Op) => void,
  471. pushPendingState: (obj: any) => void,
  472. popPendingState: (obj: any) => OpsMap,
  473. mergeFirstPendingState: (obj: any) => void,
  474. getObjectCache: (obj: any) => ObjectCache,
  475. estimateAttribute: (obj: any, attr: string) => mixed,
  476. estimateAttributes: (obj: any) => AttributeMap,
  477. commitServerChanges: (obj: any, changes: AttributeMap) => void,
  478. enqueueTask: (obj: any, task: () => Promise) => Promise,
  479. clearAllState: () => void,
  480. duplicateState: (source: any, dest: any) => void,
  481. };*/
  482. /*:: type PushController = {
  483. send: (data: PushData) => Promise,
  484. };*/
  485. /*:: type QueryController = {
  486. find: (className: string, params: QueryJSON, options: RequestOptions) => Promise,
  487. aggregate: (className: string, params: any, options: RequestOptions) => Promise,
  488. };*/
  489. /*:: type RESTController = {
  490. request: (method: string, path: string, data: mixed, options: RequestOptions) => Promise,
  491. ajax: (method: string, url: string, data: any, headers?: any, options: FullOptions) => Promise,
  492. };*/
  493. /*:: type SchemaController = {
  494. purge: (className: string) => Promise,
  495. get: (className: string, options: RequestOptions) => Promise,
  496. delete: (className: string, options: RequestOptions) => Promise,
  497. create: (className: string, params: any, options: RequestOptions) => Promise,
  498. update: (className: string, params: any, options: RequestOptions) => Promise,
  499. send(className: string, method: string, params: any, options: RequestOptions): Promise,
  500. };*/
  501. /*:: type SessionController = {
  502. getSession: (token: RequestOptions) => Promise,
  503. };*/
  504. /*:: type StorageController =
  505. | {
  506. async: 0,
  507. getItem: (path: string) => ?string,
  508. setItem: (path: string, value: string) => void,
  509. removeItem: (path: string) => void,
  510. getItemAsync?: (path: string) => Promise,
  511. setItemAsync?: (path: string, value: string) => Promise,
  512. removeItemAsync?: (path: string) => Promise,
  513. clear: () => void,
  514. }
  515. | {
  516. async: 1,
  517. getItem?: (path: string) => ?string,
  518. setItem?: (path: string, value: string) => void,
  519. removeItem?: (path: string) => void,
  520. getItemAsync: (path: string) => Promise,
  521. setItemAsync: (path: string, value: string) => Promise,
  522. removeItemAsync: (path: string) => Promise,
  523. clear: () => void,
  524. };*/
  525. /*:: type LocalDatastoreController = {
  526. fromPinWithName: (name: string) => ?any,
  527. pinWithName: (name: string, objects: any) => void,
  528. unPinWithName: (name: string) => void,
  529. getAllContents: () => ?any,
  530. clear: () => void,
  531. };*/
  532. /*:: type UserController = {
  533. setCurrentUser: (user: ParseUser) => Promise,
  534. currentUser: () => ?ParseUser,
  535. currentUserAsync: () => Promise,
  536. signUp: (user: ParseUser, attrs: AttributeMap, options: RequestOptions) => Promise,
  537. logIn: (user: ParseUser, options: RequestOptions) => Promise,
  538. become: (options: RequestOptions) => Promise,
  539. hydrate: (userJSON: AttributeMap) => Promise,
  540. logOut: (options: RequestOptions) => Promise,
  541. me: (options: RequestOptions) => Promise,
  542. requestPasswordReset: (email: string, options: RequestOptions) => Promise,
  543. updateUserOnDisk: (user: ParseUser) => Promise,
  544. upgradeToRevocableSession: (user: ParseUser, options: RequestOptions) => Promise,
  545. linkWith: (user: ParseUser, authData: AuthData) => Promise,
  546. removeUserFromDisk: () => Promise,
  547. verifyPassword: (username: string, password: string, options: RequestOptions) => Promise,
  548. requestEmailVerification: (email: string, options: RequestOptions) => Promise,
  549. };*/
  550. /*:: type HooksController = {
  551. get: (type: string, functionName?: string, triggerName?: string) => Promise,
  552. create: (hook: mixed) => Promise,
  553. delete: (hook: mixed) => Promise,
  554. update: (hook: mixed) => Promise,
  555. send: (method: string, path: string, body?: mixed) => Promise,
  556. };*/
  557. /*:: type WebSocketController = {
  558. onopen: () => void,
  559. onmessage: (message: any) => void,
  560. onclose: () => void,
  561. onerror: (error: any) => void,
  562. send: (data: any) => void,
  563. close: () => void,
  564. };*/
  565. /*:: type Config = {
  566. AnalyticsController?: AnalyticsController,
  567. CloudController?: CloudController,
  568. ConfigController?: ConfigController,
  569. FileController?: FileController,
  570. InstallationController?: InstallationController,
  571. ObjectController?: ObjectController,
  572. ObjectStateController?: ObjectStateController,
  573. PushController?: PushController,
  574. QueryController?: QueryController,
  575. RESTController?: RESTController,
  576. SchemaController?: SchemaController,
  577. SessionController?: SessionController,
  578. StorageController?: StorageController,
  579. LocalDatastoreController?: LocalDatastoreController,
  580. UserController?: UserController,
  581. HooksController?: HooksController,
  582. WebSocketController?: WebSocketController,
  583. };*/
  584. var config
  585. /*: Config & { [key: string]: mixed }*/
  586. = {
  587. // Defaults
  588. IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
  589. REQUEST_ATTEMPT_LIMIT: 5,
  590. REQUEST_BATCH_SIZE: 20,
  591. REQUEST_HEADERS: {},
  592. SERVER_URL: 'https://api.parse.com/1',
  593. SERVER_AUTH_TYPE: null,
  594. SERVER_AUTH_TOKEN: null,
  595. LIVEQUERY_SERVER_URL: null,
  596. ENCRYPTED_KEY: null,
  597. VERSION: 'js' + "3.5.1",
  598. APPLICATION_ID: null,
  599. JAVASCRIPT_KEY: null,
  600. MASTER_KEY: null,
  601. USE_MASTER_KEY: false,
  602. PERFORM_USER_REWRITE: true,
  603. FORCE_REVOCABLE_SESSION: false,
  604. ENCRYPTED_USER: false,
  605. IDEMPOTENCY: false,
  606. ALLOW_CUSTOM_OBJECT_ID: false
  607. };
  608. function requireMethods(name
  609. /*: string*/
  610. , methods
  611. /*: Array<string>*/
  612. , controller
  613. /*: any*/
  614. ) {
  615. (0, _forEach.default)(methods).call(methods, function (func) {
  616. if (typeof controller[func] !== 'function') {
  617. var _context;
  618. throw new Error((0, _concat.default)(_context = "".concat(name, " must implement ")).call(_context, func, "()"));
  619. }
  620. });
  621. }
  622. module.exports = {
  623. get: function (key
  624. /*: string*/
  625. )
  626. /*: any*/
  627. {
  628. if (config.hasOwnProperty(key)) {
  629. return config[key];
  630. }
  631. throw new Error('Configuration key not found: ' + key);
  632. },
  633. set: function (key
  634. /*: string*/
  635. , value
  636. /*: any*/
  637. )
  638. /*: void*/
  639. {
  640. config[key] = value;
  641. },
  642. /* Specialized Controller Setters/Getters */
  643. setAnalyticsController: function (controller
  644. /*: AnalyticsController*/
  645. ) {
  646. requireMethods('AnalyticsController', ['track'], controller);
  647. config['AnalyticsController'] = controller;
  648. },
  649. getAnalyticsController: function ()
  650. /*: AnalyticsController*/
  651. {
  652. return config['AnalyticsController'];
  653. },
  654. setCloudController: function (controller
  655. /*: CloudController*/
  656. ) {
  657. requireMethods('CloudController', ['run', 'getJobsData', 'startJob'], controller);
  658. config['CloudController'] = controller;
  659. },
  660. getCloudController: function ()
  661. /*: CloudController*/
  662. {
  663. return config['CloudController'];
  664. },
  665. setConfigController: function (controller
  666. /*: ConfigController*/
  667. ) {
  668. requireMethods('ConfigController', ['current', 'get', 'save'], controller);
  669. config['ConfigController'] = controller;
  670. },
  671. getConfigController: function ()
  672. /*: ConfigController*/
  673. {
  674. return config['ConfigController'];
  675. },
  676. setCryptoController: function (controller
  677. /*: CryptoController*/
  678. ) {
  679. requireMethods('CryptoController', ['encrypt', 'decrypt'], controller);
  680. config['CryptoController'] = controller;
  681. },
  682. getCryptoController: function ()
  683. /*: CryptoController*/
  684. {
  685. return config['CryptoController'];
  686. },
  687. setFileController: function (controller
  688. /*: FileController*/
  689. ) {
  690. requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
  691. config['FileController'] = controller;
  692. },
  693. getFileController: function ()
  694. /*: FileController*/
  695. {
  696. return config['FileController'];
  697. },
  698. setInstallationController: function (controller
  699. /*: InstallationController*/
  700. ) {
  701. requireMethods('InstallationController', ['currentInstallationId'], controller);
  702. config['InstallationController'] = controller;
  703. },
  704. getInstallationController: function ()
  705. /*: InstallationController*/
  706. {
  707. return config['InstallationController'];
  708. },
  709. setObjectController: function (controller
  710. /*: ObjectController*/
  711. ) {
  712. requireMethods('ObjectController', ['save', 'fetch', 'destroy'], controller);
  713. config['ObjectController'] = controller;
  714. },
  715. getObjectController: function ()
  716. /*: ObjectController*/
  717. {
  718. return config['ObjectController'];
  719. },
  720. setObjectStateController: function (controller
  721. /*: ObjectStateController*/
  722. ) {
  723. requireMethods('ObjectStateController', ['getState', 'initializeState', 'removeState', 'getServerData', 'setServerData', 'getPendingOps', 'setPendingOp', 'pushPendingState', 'popPendingState', 'mergeFirstPendingState', 'getObjectCache', 'estimateAttribute', 'estimateAttributes', 'commitServerChanges', 'enqueueTask', 'clearAllState'], controller);
  724. config['ObjectStateController'] = controller;
  725. },
  726. getObjectStateController: function ()
  727. /*: ObjectStateController*/
  728. {
  729. return config['ObjectStateController'];
  730. },
  731. setPushController: function (controller
  732. /*: PushController*/
  733. ) {
  734. requireMethods('PushController', ['send'], controller);
  735. config['PushController'] = controller;
  736. },
  737. getPushController: function ()
  738. /*: PushController*/
  739. {
  740. return config['PushController'];
  741. },
  742. setQueryController: function (controller
  743. /*: QueryController*/
  744. ) {
  745. requireMethods('QueryController', ['find', 'aggregate'], controller);
  746. config['QueryController'] = controller;
  747. },
  748. getQueryController: function ()
  749. /*: QueryController*/
  750. {
  751. return config['QueryController'];
  752. },
  753. setRESTController: function (controller
  754. /*: RESTController*/
  755. ) {
  756. requireMethods('RESTController', ['request', 'ajax'], controller);
  757. config['RESTController'] = controller;
  758. },
  759. getRESTController: function ()
  760. /*: RESTController*/
  761. {
  762. return config['RESTController'];
  763. },
  764. setSchemaController: function (controller
  765. /*: SchemaController*/
  766. ) {
  767. requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
  768. config['SchemaController'] = controller;
  769. },
  770. getSchemaController: function ()
  771. /*: SchemaController*/
  772. {
  773. return config['SchemaController'];
  774. },
  775. setSessionController: function (controller
  776. /*: SessionController*/
  777. ) {
  778. requireMethods('SessionController', ['getSession'], controller);
  779. config['SessionController'] = controller;
  780. },
  781. getSessionController: function ()
  782. /*: SessionController*/
  783. {
  784. return config['SessionController'];
  785. },
  786. setStorageController: function (controller
  787. /*: StorageController*/
  788. ) {
  789. if (controller.async) {
  790. requireMethods('An async StorageController', ['getItemAsync', 'setItemAsync', 'removeItemAsync', 'getAllKeysAsync'], controller);
  791. } else {
  792. requireMethods('A synchronous StorageController', ['getItem', 'setItem', 'removeItem', 'getAllKeys'], controller);
  793. }
  794. config['StorageController'] = controller;
  795. },
  796. setLocalDatastoreController: function (controller
  797. /*: LocalDatastoreController*/
  798. ) {
  799. requireMethods('LocalDatastoreController', ['pinWithName', 'fromPinWithName', 'unPinWithName', 'getAllContents', 'clear'], controller);
  800. config['LocalDatastoreController'] = controller;
  801. },
  802. getLocalDatastoreController: function ()
  803. /*: LocalDatastoreController*/
  804. {
  805. return config['LocalDatastoreController'];
  806. },
  807. setLocalDatastore: function (store
  808. /*: any*/
  809. ) {
  810. config['LocalDatastore'] = store;
  811. },
  812. getLocalDatastore: function () {
  813. return config['LocalDatastore'];
  814. },
  815. getStorageController: function ()
  816. /*: StorageController*/
  817. {
  818. return config['StorageController'];
  819. },
  820. setAsyncStorage: function (storage
  821. /*: any*/
  822. ) {
  823. config['AsyncStorage'] = storage;
  824. },
  825. getAsyncStorage: function () {
  826. return config['AsyncStorage'];
  827. },
  828. setWebSocketController: function (controller
  829. /*: WebSocketController*/
  830. ) {
  831. config['WebSocketController'] = controller;
  832. },
  833. getWebSocketController: function ()
  834. /*: WebSocketController*/
  835. {
  836. return config['WebSocketController'];
  837. },
  838. setUserController: function (controller
  839. /*: UserController*/
  840. ) {
  841. requireMethods('UserController', ['setCurrentUser', 'currentUser', 'currentUserAsync', 'signUp', 'logIn', 'become', 'logOut', 'me', 'requestPasswordReset', 'upgradeToRevocableSession', 'requestEmailVerification', 'verifyPassword', 'linkWith'], controller);
  842. config['UserController'] = controller;
  843. },
  844. getUserController: function ()
  845. /*: UserController*/
  846. {
  847. return config['UserController'];
  848. },
  849. setLiveQueryController: function (controller
  850. /*: any*/
  851. ) {
  852. requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
  853. config['LiveQueryController'] = controller;
  854. },
  855. getLiveQueryController: function ()
  856. /*: any*/
  857. {
  858. return config['LiveQueryController'];
  859. },
  860. setHooksController: function (controller
  861. /*: HooksController*/
  862. ) {
  863. requireMethods('HooksController', ['create', 'get', 'update', 'remove'], controller);
  864. config['HooksController'] = controller;
  865. },
  866. getHooksController: function ()
  867. /*: HooksController*/
  868. {
  869. return config['HooksController'];
  870. }
  871. };
  872. }).call(this)}).call(this,_dereq_('_process'))
  873. },{"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"_process":146}],5:[function(_dereq_,module,exports){
  874. "use strict";
  875. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  876. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  877. var AES;
  878. var ENC;
  879. AES = _dereq_('crypto-js/aes');
  880. ENC = _dereq_('crypto-js/enc-utf8');
  881. var CryptoJS;
  882. var CryptoController = {
  883. encrypt: function (obj
  884. /*: any*/
  885. , secretKey
  886. /*: string*/
  887. )
  888. /*: ?string*/
  889. {
  890. var encrypted = AES.encrypt((0, _stringify.default)(obj), secretKey);
  891. return encrypted.toString();
  892. },
  893. decrypt: function (encryptedText
  894. /*: string*/
  895. , secretKey
  896. /*: string*/
  897. )
  898. /*: ?string*/
  899. {
  900. var decryptedStr = AES.decrypt(encryptedText, secretKey).toString(ENC);
  901. return decryptedStr;
  902. }
  903. };
  904. module.exports = CryptoController;
  905. },{"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"crypto-js/aes":597,"crypto-js/enc-utf8":601}],6:[function(_dereq_,module,exports){
  906. "use strict";
  907. /**
  908. * Copyright (c) 2015-present, Parse, LLC.
  909. * All rights reserved.
  910. *
  911. * This source code is licensed under the BSD-style license found in the
  912. * LICENSE file in the root directory of this source tree. An additional grant
  913. * of patent rights can be found in the PATENTS file in the same directory.
  914. *
  915. * This is a simple wrapper to unify EventEmitter implementations across platforms.
  916. */
  917. module.exports = _dereq_('events').EventEmitter;
  918. var EventEmitter;
  919. },{"events":606}],7:[function(_dereq_,module,exports){
  920. "use strict";
  921. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  922. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  923. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  924. var _Promise = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  925. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  926. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  927. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  928. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  929. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  930. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  931. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  932. var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
  933. var _setInterval2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set-interval"));
  934. var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
  935. var _findIndex = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
  936. var _splice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/splice"));
  937. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  938. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  939. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  940. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  941. var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
  942. var _Storage = _interopRequireDefault(_dereq_("./Storage"));
  943. function _regeneratorRuntime() {
  944. "use strict";
  945. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  946. _regeneratorRuntime = function () {
  947. return exports;
  948. };
  949. var exports = {},
  950. Op = Object.prototype,
  951. hasOwn = Op.hasOwnProperty,
  952. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  953. iteratorSymbol = $Symbol.iterator || "@@iterator",
  954. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  955. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  956. function define(obj, key, value) {
  957. return _Object$defineProperty(obj, key, {
  958. value: value,
  959. enumerable: !0,
  960. configurable: !0,
  961. writable: !0
  962. }), obj[key];
  963. }
  964. try {
  965. define({}, "");
  966. } catch (err) {
  967. define = function (obj, key, value) {
  968. return obj[key] = value;
  969. };
  970. }
  971. function wrap(innerFn, outerFn, self, tryLocsList) {
  972. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  973. generator = _Object$create(protoGenerator.prototype),
  974. context = new Context(tryLocsList || []);
  975. return generator._invoke = function (innerFn, self, context) {
  976. var state = "suspendedStart";
  977. return function (method, arg) {
  978. if ("executing" === state) throw new Error("Generator is already running");
  979. if ("completed" === state) {
  980. if ("throw" === method) throw arg;
  981. return doneResult();
  982. }
  983. for (context.method = method, context.arg = arg;;) {
  984. var delegate = context.delegate;
  985. if (delegate) {
  986. var delegateResult = maybeInvokeDelegate(delegate, context);
  987. if (delegateResult) {
  988. if (delegateResult === ContinueSentinel) continue;
  989. return delegateResult;
  990. }
  991. }
  992. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  993. if ("suspendedStart" === state) throw state = "completed", context.arg;
  994. context.dispatchException(context.arg);
  995. } else "return" === context.method && context.abrupt("return", context.arg);
  996. state = "executing";
  997. var record = tryCatch(innerFn, self, context);
  998. if ("normal" === record.type) {
  999. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  1000. return {
  1001. value: record.arg,
  1002. done: context.done
  1003. };
  1004. }
  1005. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  1006. }
  1007. };
  1008. }(innerFn, self, context), generator;
  1009. }
  1010. function tryCatch(fn, obj, arg) {
  1011. try {
  1012. return {
  1013. type: "normal",
  1014. arg: fn.call(obj, arg)
  1015. };
  1016. } catch (err) {
  1017. return {
  1018. type: "throw",
  1019. arg: err
  1020. };
  1021. }
  1022. }
  1023. exports.wrap = wrap;
  1024. var ContinueSentinel = {};
  1025. function Generator() {}
  1026. function GeneratorFunction() {}
  1027. function GeneratorFunctionPrototype() {}
  1028. var IteratorPrototype = {};
  1029. define(IteratorPrototype, iteratorSymbol, function () {
  1030. return this;
  1031. });
  1032. var getProto = _Object$getPrototypeOf,
  1033. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  1034. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  1035. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  1036. function defineIteratorMethods(prototype) {
  1037. var _context9;
  1038. _forEachInstanceProperty(_context9 = ["next", "throw", "return"]).call(_context9, function (method) {
  1039. define(prototype, method, function (arg) {
  1040. return this._invoke(method, arg);
  1041. });
  1042. });
  1043. }
  1044. function AsyncIterator(generator, PromiseImpl) {
  1045. function invoke(method, arg, resolve, reject) {
  1046. var record = tryCatch(generator[method], generator, arg);
  1047. if ("throw" !== record.type) {
  1048. var result = record.arg,
  1049. value = result.value;
  1050. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  1051. invoke("next", value, resolve, reject);
  1052. }, function (err) {
  1053. invoke("throw", err, resolve, reject);
  1054. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  1055. result.value = unwrapped, resolve(result);
  1056. }, function (error) {
  1057. return invoke("throw", error, resolve, reject);
  1058. });
  1059. }
  1060. reject(record.arg);
  1061. }
  1062. var previousPromise;
  1063. this._invoke = function (method, arg) {
  1064. function callInvokeWithMethodAndArg() {
  1065. return new PromiseImpl(function (resolve, reject) {
  1066. invoke(method, arg, resolve, reject);
  1067. });
  1068. }
  1069. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  1070. };
  1071. }
  1072. function maybeInvokeDelegate(delegate, context) {
  1073. var method = delegate.iterator[context.method];
  1074. if (undefined === method) {
  1075. if (context.delegate = null, "throw" === context.method) {
  1076. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  1077. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  1078. }
  1079. return ContinueSentinel;
  1080. }
  1081. var record = tryCatch(method, delegate.iterator, context.arg);
  1082. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  1083. var info = record.arg;
  1084. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  1085. }
  1086. function pushTryEntry(locs) {
  1087. var entry = {
  1088. tryLoc: locs[0]
  1089. };
  1090. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  1091. }
  1092. function resetTryEntry(entry) {
  1093. var record = entry.completion || {};
  1094. record.type = "normal", delete record.arg, entry.completion = record;
  1095. }
  1096. function Context(tryLocsList) {
  1097. this.tryEntries = [{
  1098. tryLoc: "root"
  1099. }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  1100. }
  1101. function values(iterable) {
  1102. if (iterable) {
  1103. var iteratorMethod = iterable[iteratorSymbol];
  1104. if (iteratorMethod) return iteratorMethod.call(iterable);
  1105. if ("function" == typeof iterable.next) return iterable;
  1106. if (!isNaN(iterable.length)) {
  1107. var i = -1,
  1108. next = function next() {
  1109. for (; ++i < iterable.length;) {
  1110. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  1111. }
  1112. return next.value = undefined, next.done = !0, next;
  1113. };
  1114. return next.next = next;
  1115. }
  1116. }
  1117. return {
  1118. next: doneResult
  1119. };
  1120. }
  1121. function doneResult() {
  1122. return {
  1123. value: undefined,
  1124. done: !0
  1125. };
  1126. }
  1127. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  1128. var ctor = "function" == typeof genFun && genFun.constructor;
  1129. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  1130. }, exports.mark = function (genFun) {
  1131. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  1132. }, exports.awrap = function (arg) {
  1133. return {
  1134. __await: arg
  1135. };
  1136. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  1137. return this;
  1138. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  1139. void 0 === PromiseImpl && (PromiseImpl = _Promise);
  1140. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  1141. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  1142. return result.done ? result.value : iter.next();
  1143. });
  1144. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  1145. return this;
  1146. }), define(Gp, "toString", function () {
  1147. return "[object Generator]";
  1148. }), exports.keys = function (object) {
  1149. var keys = [];
  1150. for (var key in object) {
  1151. keys.push(key);
  1152. }
  1153. return _reverseInstanceProperty(keys).call(keys), function next() {
  1154. for (; keys.length;) {
  1155. var key = keys.pop();
  1156. if (key in object) return next.value = key, next.done = !1, next;
  1157. }
  1158. return next.done = !0, next;
  1159. };
  1160. }, exports.values = values, Context.prototype = {
  1161. constructor: Context,
  1162. reset: function (skipTempReset) {
  1163. var _context10;
  1164. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context10 = this.tryEntries).call(_context10, resetTryEntry), !skipTempReset) for (var name in this) {
  1165. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
  1166. }
  1167. },
  1168. stop: function () {
  1169. this.done = !0;
  1170. var rootRecord = this.tryEntries[0].completion;
  1171. if ("throw" === rootRecord.type) throw rootRecord.arg;
  1172. return this.rval;
  1173. },
  1174. dispatchException: function (exception) {
  1175. if (this.done) throw exception;
  1176. var context = this;
  1177. function handle(loc, caught) {
  1178. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  1179. }
  1180. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1181. var entry = this.tryEntries[i],
  1182. record = entry.completion;
  1183. if ("root" === entry.tryLoc) return handle("end");
  1184. if (entry.tryLoc <= this.prev) {
  1185. var hasCatch = hasOwn.call(entry, "catchLoc"),
  1186. hasFinally = hasOwn.call(entry, "finallyLoc");
  1187. if (hasCatch && hasFinally) {
  1188. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  1189. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  1190. } else if (hasCatch) {
  1191. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  1192. } else {
  1193. if (!hasFinally) throw new Error("try statement without catch or finally");
  1194. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  1195. }
  1196. }
  1197. }
  1198. },
  1199. abrupt: function (type, arg) {
  1200. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1201. var entry = this.tryEntries[i];
  1202. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  1203. var finallyEntry = entry;
  1204. break;
  1205. }
  1206. }
  1207. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  1208. var record = finallyEntry ? finallyEntry.completion : {};
  1209. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  1210. },
  1211. complete: function (record, afterLoc) {
  1212. if ("throw" === record.type) throw record.arg;
  1213. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  1214. },
  1215. finish: function (finallyLoc) {
  1216. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1217. var entry = this.tryEntries[i];
  1218. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  1219. }
  1220. },
  1221. catch: function (tryLoc) {
  1222. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1223. var entry = this.tryEntries[i];
  1224. if (entry.tryLoc === tryLoc) {
  1225. var record = entry.completion;
  1226. if ("throw" === record.type) {
  1227. var thrown = record.arg;
  1228. resetTryEntry(entry);
  1229. }
  1230. return thrown;
  1231. }
  1232. }
  1233. throw new Error("illegal catch attempt");
  1234. },
  1235. delegateYield: function (iterable, resultName, nextLoc) {
  1236. return this.delegate = {
  1237. iterator: values(iterable),
  1238. resultName: resultName,
  1239. nextLoc: nextLoc
  1240. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  1241. }
  1242. }, exports;
  1243. }
  1244. var QUEUE_KEY = 'Parse/Eventually/Queue';
  1245. var queueCache = [];
  1246. var dirtyCache = true;
  1247. var polling = undefined;
  1248. /**
  1249. * Provides utility functions to queue objects that will be
  1250. * saved to the server at a later date.
  1251. *
  1252. * @class Parse.EventuallyQueue
  1253. * @static
  1254. */
  1255. var EventuallyQueue = {
  1256. /**
  1257. * Add object to queue with save operation.
  1258. *
  1259. * @function save
  1260. * @name Parse.EventuallyQueue.save
  1261. * @param {ParseObject} object Parse.Object to be saved eventually
  1262. * @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#save Parse.Object.save} options.
  1263. * @returns {Promise} A promise that is fulfilled if object is added to queue.
  1264. * @static
  1265. * @see Parse.Object#saveEventually
  1266. */
  1267. save: function (object
  1268. /*: ParseObject*/
  1269. )
  1270. /*: Promise*/
  1271. {
  1272. var serverOptions
  1273. /*: SaveOptions*/
  1274. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1275. return this.enqueue('save', object, serverOptions);
  1276. },
  1277. /**
  1278. * Add object to queue with save operation.
  1279. *
  1280. * @function destroy
  1281. * @name Parse.EventuallyQueue.destroy
  1282. * @param {ParseObject} object Parse.Object to be destroyed eventually
  1283. * @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#destroy Parse.Object.destroy} options
  1284. * @returns {Promise} A promise that is fulfilled if object is added to queue.
  1285. * @static
  1286. * @see Parse.Object#destroyEventually
  1287. */
  1288. destroy: function (object
  1289. /*: ParseObject*/
  1290. )
  1291. /*: Promise*/
  1292. {
  1293. var serverOptions
  1294. /*: RequestOptions*/
  1295. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1296. return this.enqueue('destroy', object, serverOptions);
  1297. },
  1298. /**
  1299. * Generate unique identifier to avoid duplicates and maintain previous state.
  1300. *
  1301. * @param {string} action save / destroy
  1302. * @param {object} object Parse.Object to be queued
  1303. * @returns {string}
  1304. * @static
  1305. * @ignore
  1306. */
  1307. generateQueueId: function (action
  1308. /*: string*/
  1309. , object
  1310. /*: ParseObject*/
  1311. )
  1312. /*: string*/
  1313. {
  1314. object._getId();
  1315. var className = object.className,
  1316. id = object.id,
  1317. _localId = object._localId;
  1318. var uniqueId = object.get('hash') || _localId;
  1319. return [action, className, id, uniqueId].join('_');
  1320. },
  1321. /**
  1322. * Build queue object and add to queue.
  1323. *
  1324. * @param {string} action save / destroy
  1325. * @param {object} object Parse.Object to be queued
  1326. * @param {object} [serverOptions]
  1327. * @returns {Promise} A promise that is fulfilled if object is added to queue.
  1328. * @static
  1329. * @ignore
  1330. */
  1331. enqueue: function (action
  1332. /*: string*/
  1333. , object
  1334. /*: ParseObject*/
  1335. , serverOptions
  1336. /*: SaveOptions | RequestOptions*/
  1337. )
  1338. /*: Promise*/
  1339. {
  1340. var _this = this;
  1341. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  1342. var queueData, queueId, index, prop;
  1343. return _regeneratorRuntime().wrap(function _callee$(_context) {
  1344. while (1) {
  1345. switch (_context.prev = _context.next) {
  1346. case 0:
  1347. _context.next = 2;
  1348. return _this.getQueue();
  1349. case 2:
  1350. queueData = _context.sent;
  1351. queueId = _this.generateQueueId(action, object);
  1352. index = _this.queueItemExists(queueData, queueId);
  1353. if (index > -1) {
  1354. // Add cached values to new object if they don't exist
  1355. for (prop in queueData[index].object) {
  1356. if (typeof object.get(prop) === 'undefined') {
  1357. object.set(prop, queueData[index].object[prop]);
  1358. }
  1359. }
  1360. } else {
  1361. index = queueData.length;
  1362. }
  1363. queueData[index] = {
  1364. queueId: queueId,
  1365. action: action,
  1366. object: object.toJSON(),
  1367. serverOptions: serverOptions,
  1368. id: object.id,
  1369. className: object.className,
  1370. hash: object.get('hash'),
  1371. createdAt: new Date()
  1372. };
  1373. return _context.abrupt("return", _this.setQueue(queueData));
  1374. case 8:
  1375. case "end":
  1376. return _context.stop();
  1377. }
  1378. }
  1379. }, _callee);
  1380. }))();
  1381. },
  1382. store: function store(data) {
  1383. return _Storage.default.setItemAsync(QUEUE_KEY, (0, _stringify.default)(data));
  1384. },
  1385. load: function load() {
  1386. return _Storage.default.getItemAsync(QUEUE_KEY);
  1387. },
  1388. /**
  1389. * Sets the in-memory queue from local storage and returns.
  1390. *
  1391. * @function getQueue
  1392. * @name Parse.EventuallyQueue.getQueue
  1393. * @returns {Promise<Array>}
  1394. * @static
  1395. */
  1396. getQueue: function getQueue()
  1397. /*: Promise<Array>*/
  1398. {
  1399. var _this2 = this;
  1400. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
  1401. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  1402. while (1) {
  1403. switch (_context2.prev = _context2.next) {
  1404. case 0:
  1405. if (!dirtyCache) {
  1406. _context2.next = 10;
  1407. break;
  1408. }
  1409. _context2.t0 = JSON;
  1410. _context2.next = 4;
  1411. return _this2.load();
  1412. case 4:
  1413. _context2.t1 = _context2.sent;
  1414. if (_context2.t1) {
  1415. _context2.next = 7;
  1416. break;
  1417. }
  1418. _context2.t1 = '[]';
  1419. case 7:
  1420. _context2.t2 = _context2.t1;
  1421. queueCache = _context2.t0.parse.call(_context2.t0, _context2.t2);
  1422. dirtyCache = false;
  1423. case 10:
  1424. return _context2.abrupt("return", queueCache);
  1425. case 11:
  1426. case "end":
  1427. return _context2.stop();
  1428. }
  1429. }
  1430. }, _callee2);
  1431. }))();
  1432. },
  1433. /**
  1434. * Saves the queue to local storage
  1435. *
  1436. * @param {Queue} queue Queue containing Parse.Object data.
  1437. * @returns {Promise} A promise that is fulfilled when queue is stored.
  1438. * @static
  1439. * @ignore
  1440. */
  1441. setQueue: function setQueue(queue
  1442. /*: Queue*/
  1443. )
  1444. /*: Promise<void>*/
  1445. {
  1446. queueCache = queue;
  1447. return this.store(queueCache);
  1448. },
  1449. /**
  1450. * Removes Parse.Object data from queue.
  1451. *
  1452. * @param {string} queueId Unique identifier for Parse.Object data.
  1453. * @returns {Promise} A promise that is fulfilled when queue is stored.
  1454. * @static
  1455. * @ignore
  1456. */
  1457. remove: function remove(queueId
  1458. /*: string*/
  1459. )
  1460. /*: Promise<void>*/
  1461. {
  1462. var _this3 = this;
  1463. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  1464. var queueData, index;
  1465. return _regeneratorRuntime().wrap(function _callee3$(_context3) {
  1466. while (1) {
  1467. switch (_context3.prev = _context3.next) {
  1468. case 0:
  1469. _context3.next = 2;
  1470. return _this3.getQueue();
  1471. case 2:
  1472. queueData = _context3.sent;
  1473. index = _this3.queueItemExists(queueData, queueId);
  1474. if (!(index > -1)) {
  1475. _context3.next = 8;
  1476. break;
  1477. }
  1478. (0, _splice.default)(queueData).call(queueData, index, 1);
  1479. _context3.next = 8;
  1480. return _this3.setQueue(queueData);
  1481. case 8:
  1482. case "end":
  1483. return _context3.stop();
  1484. }
  1485. }
  1486. }, _callee3);
  1487. }))();
  1488. },
  1489. /**
  1490. * Removes all objects from queue.
  1491. *
  1492. * @function clear
  1493. * @name Parse.EventuallyQueue.clear
  1494. * @returns {Promise} A promise that is fulfilled when queue is cleared.
  1495. * @static
  1496. */
  1497. clear: function clear()
  1498. /*: Promise*/
  1499. {
  1500. queueCache = [];
  1501. return this.store([]);
  1502. },
  1503. /**
  1504. * Return the index of a queueId in the queue. Returns -1 if not found.
  1505. *
  1506. * @param {Queue} queue Queue containing Parse.Object data.
  1507. * @param {string} queueId Unique identifier for Parse.Object data.
  1508. * @returns {number}
  1509. * @static
  1510. * @ignore
  1511. */
  1512. queueItemExists: function queueItemExists(queue
  1513. /*: Queue*/
  1514. , queueId
  1515. /*: string*/
  1516. )
  1517. /*: number*/
  1518. {
  1519. return (0, _findIndex.default)(queue).call(queue, function (data) {
  1520. return data.queueId === queueId;
  1521. });
  1522. },
  1523. /**
  1524. * Return the number of objects in the queue.
  1525. *
  1526. * @function length
  1527. * @name Parse.EventuallyQueue.length
  1528. * @returns {number}
  1529. * @static
  1530. */
  1531. length: function length()
  1532. /*: number*/
  1533. {
  1534. var _this4 = this;
  1535. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
  1536. var queueData;
  1537. return _regeneratorRuntime().wrap(function _callee4$(_context4) {
  1538. while (1) {
  1539. switch (_context4.prev = _context4.next) {
  1540. case 0:
  1541. _context4.next = 2;
  1542. return _this4.getQueue();
  1543. case 2:
  1544. queueData = _context4.sent;
  1545. return _context4.abrupt("return", queueData.length);
  1546. case 4:
  1547. case "end":
  1548. return _context4.stop();
  1549. }
  1550. }
  1551. }, _callee4);
  1552. }))();
  1553. },
  1554. /**
  1555. * Sends the queue to the server.
  1556. *
  1557. * @function sendQueue
  1558. * @name Parse.EventuallyQueue.sendQueue
  1559. * @returns {Promise<boolean>} Returns true if queue was sent successfully.
  1560. * @static
  1561. */
  1562. sendQueue: function sendQueue()
  1563. /*: Promise<boolean>*/
  1564. {
  1565. var _this5 = this;
  1566. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
  1567. var queue, queueData, i, queueObject, id, hash, className, ObjectType;
  1568. return _regeneratorRuntime().wrap(function _callee5$(_context5) {
  1569. while (1) {
  1570. switch (_context5.prev = _context5.next) {
  1571. case 0:
  1572. _context5.next = 2;
  1573. return _this5.getQueue();
  1574. case 2:
  1575. queue = _context5.sent;
  1576. queueData = (0, _toConsumableArray2.default)(queue);
  1577. if (!(queueData.length === 0)) {
  1578. _context5.next = 6;
  1579. break;
  1580. }
  1581. return _context5.abrupt("return", false);
  1582. case 6:
  1583. i = 0;
  1584. case 7:
  1585. if (!(i < queueData.length)) {
  1586. _context5.next = 26;
  1587. break;
  1588. }
  1589. queueObject = queueData[i];
  1590. id = queueObject.id, hash = queueObject.hash, className = queueObject.className;
  1591. ObjectType = _ParseObject.default.extend(className);
  1592. if (!id) {
  1593. _context5.next = 16;
  1594. break;
  1595. }
  1596. _context5.next = 14;
  1597. return _this5.process.byId(ObjectType, queueObject);
  1598. case 14:
  1599. _context5.next = 23;
  1600. break;
  1601. case 16:
  1602. if (!hash) {
  1603. _context5.next = 21;
  1604. break;
  1605. }
  1606. _context5.next = 19;
  1607. return _this5.process.byHash(ObjectType, queueObject);
  1608. case 19:
  1609. _context5.next = 23;
  1610. break;
  1611. case 21:
  1612. _context5.next = 23;
  1613. return _this5.process.create(ObjectType, queueObject);
  1614. case 23:
  1615. i += 1;
  1616. _context5.next = 7;
  1617. break;
  1618. case 26:
  1619. return _context5.abrupt("return", true);
  1620. case 27:
  1621. case "end":
  1622. return _context5.stop();
  1623. }
  1624. }
  1625. }, _callee5);
  1626. }))();
  1627. },
  1628. /**
  1629. * Build queue object and add to queue.
  1630. *
  1631. * @param {ParseObject} object Parse.Object to be processed
  1632. * @param {QueueObject} queueObject Parse.Object data from the queue
  1633. * @returns {Promise} A promise that is fulfilled when operation is performed.
  1634. * @static
  1635. * @ignore
  1636. */
  1637. sendQueueCallback: function sendQueueCallback(object
  1638. /*: ParseObject*/
  1639. , queueObject
  1640. /*: QueueObject*/
  1641. )
  1642. /*: Promise<void>*/
  1643. {
  1644. var _this6 = this;
  1645. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
  1646. return _regeneratorRuntime().wrap(function _callee6$(_context6) {
  1647. while (1) {
  1648. switch (_context6.prev = _context6.next) {
  1649. case 0:
  1650. if (object) {
  1651. _context6.next = 2;
  1652. break;
  1653. }
  1654. return _context6.abrupt("return", _this6.remove(queueObject.queueId));
  1655. case 2:
  1656. _context6.t0 = queueObject.action;
  1657. _context6.next = _context6.t0 === 'save' ? 5 : _context6.t0 === 'destroy' ? 20 : 33;
  1658. break;
  1659. case 5:
  1660. if (!(typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt))) {
  1661. _context6.next = 7;
  1662. break;
  1663. }
  1664. return _context6.abrupt("return", _this6.remove(queueObject.queueId));
  1665. case 7:
  1666. _context6.prev = 7;
  1667. _context6.next = 10;
  1668. return object.save(queueObject.object, queueObject.serverOptions);
  1669. case 10:
  1670. _context6.next = 12;
  1671. return _this6.remove(queueObject.queueId);
  1672. case 12:
  1673. _context6.next = 19;
  1674. break;
  1675. case 14:
  1676. _context6.prev = 14;
  1677. _context6.t1 = _context6["catch"](7);
  1678. if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
  1679. _context6.next = 19;
  1680. break;
  1681. }
  1682. _context6.next = 19;
  1683. return _this6.remove(queueObject.queueId);
  1684. case 19:
  1685. return _context6.abrupt("break", 33);
  1686. case 20:
  1687. _context6.prev = 20;
  1688. _context6.next = 23;
  1689. return object.destroy(queueObject.serverOptions);
  1690. case 23:
  1691. _context6.next = 25;
  1692. return _this6.remove(queueObject.queueId);
  1693. case 25:
  1694. _context6.next = 32;
  1695. break;
  1696. case 27:
  1697. _context6.prev = 27;
  1698. _context6.t2 = _context6["catch"](20);
  1699. if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
  1700. _context6.next = 32;
  1701. break;
  1702. }
  1703. _context6.next = 32;
  1704. return _this6.remove(queueObject.queueId);
  1705. case 32:
  1706. return _context6.abrupt("break", 33);
  1707. case 33:
  1708. case "end":
  1709. return _context6.stop();
  1710. }
  1711. }
  1712. }, _callee6, null, [[7, 14], [20, 27]]);
  1713. }))();
  1714. },
  1715. /**
  1716. * Start polling server for network connection.
  1717. * Will send queue if connection is established.
  1718. *
  1719. * @function poll
  1720. * @name Parse.EventuallyQueue.poll
  1721. * @param [ms] Milliseconds to ping the server. Default 2000ms
  1722. * @static
  1723. */
  1724. poll: function poll() {
  1725. var _this7 = this;
  1726. var ms
  1727. /*: number*/
  1728. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
  1729. if (polling) {
  1730. return;
  1731. }
  1732. polling = (0, _setInterval2.default)(function () {
  1733. var RESTController = _CoreManager.default.getRESTController();
  1734. RESTController.request('GET', 'health').then(function (_ref) {
  1735. var status = _ref.status;
  1736. if (status === 'ok') {
  1737. _this7.stopPoll();
  1738. return _this7.sendQueue();
  1739. }
  1740. }).catch(function (e) {
  1741. return e;
  1742. });
  1743. }, ms);
  1744. },
  1745. /**
  1746. * Turns off polling.
  1747. *
  1748. * @function stopPoll
  1749. * @name Parse.EventuallyQueue.stopPoll
  1750. * @static
  1751. */
  1752. stopPoll: function stopPoll() {
  1753. clearInterval(polling);
  1754. polling = undefined;
  1755. },
  1756. /**
  1757. * Return true if pinging the server.
  1758. *
  1759. * @function isPolling
  1760. * @name Parse.EventuallyQueue.isPolling
  1761. * @returns {boolean}
  1762. * @static
  1763. */
  1764. isPolling: function isPolling()
  1765. /*: boolean*/
  1766. {
  1767. return !!polling;
  1768. },
  1769. _setPolling: function _setPolling(flag
  1770. /*: boolean*/
  1771. ) {
  1772. polling = flag;
  1773. },
  1774. process: {
  1775. create: function create(ObjectType, queueObject) {
  1776. var object = new ObjectType();
  1777. return EventuallyQueue.sendQueueCallback(object, queueObject);
  1778. },
  1779. byId: function byId(ObjectType, queueObject) {
  1780. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
  1781. var sessionToken, query, results;
  1782. return _regeneratorRuntime().wrap(function _callee7$(_context7) {
  1783. while (1) {
  1784. switch (_context7.prev = _context7.next) {
  1785. case 0:
  1786. sessionToken = queueObject.serverOptions.sessionToken;
  1787. query = new _ParseQuery.default(ObjectType);
  1788. query.equalTo('objectId', queueObject.id);
  1789. _context7.next = 5;
  1790. return (0, _find.default)(query).call(query, {
  1791. sessionToken: sessionToken
  1792. });
  1793. case 5:
  1794. results = _context7.sent;
  1795. return _context7.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
  1796. case 7:
  1797. case "end":
  1798. return _context7.stop();
  1799. }
  1800. }
  1801. }, _callee7);
  1802. }))();
  1803. },
  1804. byHash: function byHash(ObjectType, queueObject) {
  1805. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
  1806. var sessionToken, query, results;
  1807. return _regeneratorRuntime().wrap(function _callee8$(_context8) {
  1808. while (1) {
  1809. switch (_context8.prev = _context8.next) {
  1810. case 0:
  1811. sessionToken = queueObject.serverOptions.sessionToken;
  1812. query = new _ParseQuery.default(ObjectType);
  1813. query.equalTo('hash', queueObject.hash);
  1814. _context8.next = 5;
  1815. return (0, _find.default)(query).call(query, {
  1816. sessionToken: sessionToken
  1817. });
  1818. case 5:
  1819. results = _context8.sent;
  1820. if (!(results.length > 0)) {
  1821. _context8.next = 8;
  1822. break;
  1823. }
  1824. return _context8.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
  1825. case 8:
  1826. return _context8.abrupt("return", EventuallyQueue.process.create(ObjectType, queueObject));
  1827. case 9:
  1828. case "end":
  1829. return _context8.stop();
  1830. }
  1831. }
  1832. }, _callee8);
  1833. }))();
  1834. }
  1835. }
  1836. };
  1837. module.exports = EventuallyQueue;
  1838. },{"./CoreManager":4,"./ParseObject":26,"./ParseQuery":29,"./Storage":39,"@babel/runtime-corejs3/core-js-stable/instance/find":64,"@babel/runtime-corejs3/core-js-stable/instance/find-index":63,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/instance/splice":74,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/set-interval":95,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/toConsumableArray":140,"@babel/runtime-corejs3/helpers/typeof":141}],8:[function(_dereq_,module,exports){
  1839. "use strict";
  1840. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  1841. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  1842. _Object$defineProperty(exports, "__esModule", {
  1843. value: true
  1844. });
  1845. exports.default = void 0;
  1846. var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
  1847. /**
  1848. * Copyright (c) 2015-present, Parse, LLC.
  1849. * All rights reserved.
  1850. *
  1851. * This source code is licensed under the BSD-style license found in the
  1852. * LICENSE file in the root directory of this source tree. An additional grant
  1853. * of patent rights can be found in the PATENTS file in the same directory.
  1854. *
  1855. * @flow-weak
  1856. */
  1857. /* global FB */
  1858. var initialized = false;
  1859. var requestedPermissions;
  1860. var initOptions;
  1861. var provider = {
  1862. authenticate: function (options) {
  1863. var _this = this;
  1864. if (typeof FB === 'undefined') {
  1865. options.error(this, 'Facebook SDK not found.');
  1866. }
  1867. FB.login(function (response) {
  1868. if (response.authResponse) {
  1869. if (options.success) {
  1870. options.success(_this, {
  1871. id: response.authResponse.userID,
  1872. access_token: response.authResponse.accessToken,
  1873. expiration_date: new Date(response.authResponse.expiresIn * 1000 + new Date().getTime()).toJSON()
  1874. });
  1875. }
  1876. } else {
  1877. if (options.error) {
  1878. options.error(_this, response);
  1879. }
  1880. }
  1881. }, {
  1882. scope: requestedPermissions
  1883. });
  1884. },
  1885. restoreAuthentication: function (authData) {
  1886. if (authData) {
  1887. var newOptions = {};
  1888. if (initOptions) {
  1889. for (var key in initOptions) {
  1890. newOptions[key] = initOptions[key];
  1891. }
  1892. } // Suppress checks for login status from the browser.
  1893. newOptions.status = false; // If the user doesn't match the one known by the FB SDK, log out.
  1894. // Most of the time, the users will match -- it's only in cases where
  1895. // the FB SDK knows of a different user than the one being restored
  1896. // from a Parse User that logged in with username/password.
  1897. var existingResponse = FB.getAuthResponse();
  1898. if (existingResponse && existingResponse.userID !== authData.id) {
  1899. FB.logout();
  1900. }
  1901. FB.init(newOptions);
  1902. }
  1903. return true;
  1904. },
  1905. getAuthType: function () {
  1906. return 'facebook';
  1907. },
  1908. deauthenticate: function () {
  1909. this.restoreAuthentication(null);
  1910. }
  1911. };
  1912. /**
  1913. * Provides a set of utilities for using Parse with Facebook.
  1914. *
  1915. * @class Parse.FacebookUtils
  1916. * @static
  1917. * @hideconstructor
  1918. */
  1919. var FacebookUtils = {
  1920. /**
  1921. * Initializes Parse Facebook integration. Call this function after you
  1922. * have loaded the Facebook Javascript SDK with the same parameters
  1923. * as you would pass to<code>
  1924. * <a href=
  1925. * "https://developers.facebook.com/docs/reference/javascript/FB.init/">
  1926. * FB.init()</a></code>. Parse.FacebookUtils will invoke FB.init() for you
  1927. * with these arguments.
  1928. *
  1929. * @function init
  1930. * @name Parse.FacebookUtils.init
  1931. * @param {object} options Facebook options argument as described here:
  1932. * <a href=
  1933. * "https://developers.facebook.com/docs/reference/javascript/FB.init/">
  1934. * FB.init()</a>. The status flag will be coerced to 'false' because it
  1935. * interferes with Parse Facebook integration. Call FB.getLoginStatus()
  1936. * explicitly if this behavior is required by your application.
  1937. */
  1938. init: function (options) {
  1939. if (typeof FB === 'undefined') {
  1940. throw new Error('The Facebook JavaScript SDK must be loaded before calling init.');
  1941. }
  1942. initOptions = {};
  1943. if (options) {
  1944. for (var key in options) {
  1945. initOptions[key] = options[key];
  1946. }
  1947. }
  1948. if (initOptions.status && typeof console !== 'undefined') {
  1949. var warn = console.warn || console.log || function () {}; // eslint-disable-line no-console
  1950. warn.call(console, 'The "status" flag passed into' + ' FB.init, when set to true, can interfere with Parse Facebook' + ' integration, so it has been suppressed. Please call' + ' FB.getLoginStatus() explicitly if you require this behavior.');
  1951. }
  1952. initOptions.status = false;
  1953. FB.init(initOptions);
  1954. _ParseUser.default._registerAuthenticationProvider(provider);
  1955. initialized = true;
  1956. },
  1957. /**
  1958. * Gets whether the user has their account linked to Facebook.
  1959. *
  1960. * @function isLinked
  1961. * @name Parse.FacebookUtils.isLinked
  1962. * @param {Parse.User} user User to check for a facebook link.
  1963. * The user must be logged in on this device.
  1964. * @returns {boolean} <code>true</code> if the user has their account
  1965. * linked to Facebook.
  1966. */
  1967. isLinked: function (user) {
  1968. return user._isLinked('facebook');
  1969. },
  1970. /**
  1971. * Logs in a user using Facebook. This method delegates to the Facebook
  1972. * SDK to authenticate the user, and then automatically logs in (or
  1973. * creates, in the case where it is a new user) a Parse.User.
  1974. *
  1975. * Standard API:
  1976. *
  1977. * <code>logIn(permission: string, authData: Object);</code>
  1978. *
  1979. * Advanced API: Used for handling your own oAuth tokens
  1980. * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
  1981. *
  1982. * <code>logIn(authData: Object, options?: Object);</code>
  1983. *
  1984. * @function logIn
  1985. * @name Parse.FacebookUtils.logIn
  1986. * @param {(string | object)} permissions The permissions required for Facebook
  1987. * log in. This is a comma-separated string of permissions.
  1988. * Alternatively, supply a Facebook authData object as described in our
  1989. * REST API docs if you want to handle getting facebook auth tokens
  1990. * yourself.
  1991. * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
  1992. * @returns {Promise}
  1993. */
  1994. logIn: function (permissions, options) {
  1995. if (!permissions || typeof permissions === 'string') {
  1996. if (!initialized) {
  1997. throw new Error('You must initialize FacebookUtils before calling logIn.');
  1998. }
  1999. requestedPermissions = permissions;
  2000. return _ParseUser.default.logInWith('facebook', options);
  2001. }
  2002. return _ParseUser.default.logInWith('facebook', {
  2003. authData: permissions
  2004. }, options);
  2005. },
  2006. /**
  2007. * Links Facebook to an existing PFUser. This method delegates to the
  2008. * Facebook SDK to authenticate the user, and then automatically links
  2009. * the account to the Parse.User.
  2010. *
  2011. * Standard API:
  2012. *
  2013. * <code>link(user: Parse.User, permission: string, authData?: Object);</code>
  2014. *
  2015. * Advanced API: Used for handling your own oAuth tokens
  2016. * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
  2017. *
  2018. * <code>link(user: Parse.User, authData: Object, options?: FullOptions);</code>
  2019. *
  2020. * @function link
  2021. * @name Parse.FacebookUtils.link
  2022. * @param {Parse.User} user User to link to Facebook. This must be the
  2023. * current user.
  2024. * @param {(string | object)} permissions The permissions required for Facebook
  2025. * log in. This is a comma-separated string of permissions.
  2026. * Alternatively, supply a Facebook authData object as described in our
  2027. * REST API docs if you want to handle getting facebook auth tokens
  2028. * yourself.
  2029. * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
  2030. * @returns {Promise}
  2031. */
  2032. link: function (user, permissions, options) {
  2033. if (!permissions || typeof permissions === 'string') {
  2034. if (!initialized) {
  2035. throw new Error('You must initialize FacebookUtils before calling link.');
  2036. }
  2037. requestedPermissions = permissions;
  2038. return user.linkWith('facebook', options);
  2039. }
  2040. return user.linkWith('facebook', {
  2041. authData: permissions
  2042. }, options);
  2043. },
  2044. /**
  2045. * Unlinks the Parse.User from a Facebook account.
  2046. *
  2047. * @function unlink
  2048. * @name Parse.FacebookUtils.unlink
  2049. * @param {Parse.User} user User to unlink from Facebook. This must be the
  2050. * current user.
  2051. * @param {object} options Standard options object with success and error
  2052. * callbacks.
  2053. * @returns {Promise}
  2054. */
  2055. unlink: function (user, options) {
  2056. if (!initialized) {
  2057. throw new Error('You must initialize FacebookUtils before calling unlink.');
  2058. }
  2059. return user._unlinkFrom('facebook', options);
  2060. },
  2061. // Used for testing purposes
  2062. _getAuthProvider: function () {
  2063. return provider;
  2064. }
  2065. };
  2066. var _default = FacebookUtils;
  2067. exports.default = _default;
  2068. },{"./ParseUser":34,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],9:[function(_dereq_,module,exports){
  2069. "use strict";
  2070. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  2071. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  2072. var _Storage = _interopRequireDefault(_dereq_("./Storage"));
  2073. /**
  2074. * Copyright (c) 2015-present, Parse, LLC.
  2075. * All rights reserved.
  2076. *
  2077. * This source code is licensed under the BSD-style license found in the
  2078. * LICENSE file in the root directory of this source tree. An additional grant
  2079. * of patent rights can be found in the PATENTS file in the same directory.
  2080. *
  2081. * @flow
  2082. */
  2083. var uuidv4 = _dereq_('./uuid');
  2084. var iidCache = null;
  2085. var InstallationController = {
  2086. currentInstallationId: function ()
  2087. /*: Promise<string>*/
  2088. {
  2089. if (typeof iidCache === 'string') {
  2090. return _promise.default.resolve(iidCache);
  2091. }
  2092. var path = _Storage.default.generatePath('installationId');
  2093. return _Storage.default.getItemAsync(path).then(function (iid) {
  2094. if (!iid) {
  2095. iid = uuidv4();
  2096. return _Storage.default.setItemAsync(path, iid).then(function () {
  2097. iidCache = iid;
  2098. return iid;
  2099. });
  2100. }
  2101. iidCache = iid;
  2102. return iid;
  2103. });
  2104. },
  2105. _clearCache: function () {
  2106. iidCache = null;
  2107. },
  2108. _setInstallationIdCache: function (iid
  2109. /*: string*/
  2110. ) {
  2111. iidCache = iid;
  2112. }
  2113. };
  2114. module.exports = InstallationController;
  2115. },{"./Storage":39,"./uuid":55,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],10:[function(_dereq_,module,exports){
  2116. "use strict";
  2117. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  2118. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  2119. var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
  2120. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  2121. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  2122. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
  2123. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  2124. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  2125. _Object$defineProperty(exports, "__esModule", {
  2126. value: true
  2127. });
  2128. exports.default = void 0;
  2129. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  2130. var _bind = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/bind"));
  2131. var _setTimeout2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set-timeout"));
  2132. var _values = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/values"));
  2133. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  2134. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  2135. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
  2136. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/map"));
  2137. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  2138. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  2139. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  2140. var _assertThisInitialized2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/assertThisInitialized"));
  2141. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  2142. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  2143. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  2144. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  2145. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  2146. var _EventEmitter2 = _interopRequireDefault(_dereq_("./EventEmitter"));
  2147. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  2148. var _LiveQuerySubscription = _interopRequireDefault(_dereq_("./LiveQuerySubscription"));
  2149. var _promiseUtils = _dereq_("./promiseUtils");
  2150. function _createForOfIteratorHelper(o, allowArrayLike) {
  2151. var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
  2152. if (!it) {
  2153. if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  2154. if (it) o = it;
  2155. var i = 0;
  2156. var F = function () {};
  2157. return {
  2158. s: F,
  2159. n: function () {
  2160. if (i >= o.length) return {
  2161. done: true
  2162. };
  2163. return {
  2164. done: false,
  2165. value: o[i++]
  2166. };
  2167. },
  2168. e: function (_e) {
  2169. throw _e;
  2170. },
  2171. f: F
  2172. };
  2173. }
  2174. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2175. }
  2176. var normalCompletion = true,
  2177. didErr = false,
  2178. err;
  2179. return {
  2180. s: function () {
  2181. it = it.call(o);
  2182. },
  2183. n: function () {
  2184. var step = it.next();
  2185. normalCompletion = step.done;
  2186. return step;
  2187. },
  2188. e: function (_e2) {
  2189. didErr = true;
  2190. err = _e2;
  2191. },
  2192. f: function () {
  2193. try {
  2194. if (!normalCompletion && it.return != null) it.return();
  2195. } finally {
  2196. if (didErr) throw err;
  2197. }
  2198. }
  2199. };
  2200. }
  2201. function _unsupportedIterableToArray(o, minLen) {
  2202. var _context6;
  2203. if (!o) return;
  2204. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  2205. var n = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(o)).call(_context6, 8, -1);
  2206. if (n === "Object" && o.constructor) n = o.constructor.name;
  2207. if (n === "Map" || n === "Set") return _Array$from(o);
  2208. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  2209. }
  2210. function _arrayLikeToArray(arr, len) {
  2211. if (len == null || len > arr.length) len = arr.length;
  2212. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  2213. arr2[i] = arr[i];
  2214. }
  2215. return arr2;
  2216. }
  2217. function _createSuper(Derived) {
  2218. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  2219. return function () {
  2220. var Super = (0, _getPrototypeOf2.default)(Derived),
  2221. result;
  2222. if (hasNativeReflectConstruct) {
  2223. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  2224. result = _Reflect$construct(Super, arguments, NewTarget);
  2225. } else {
  2226. result = Super.apply(this, arguments);
  2227. }
  2228. return (0, _possibleConstructorReturn2.default)(this, result);
  2229. };
  2230. }
  2231. function _isNativeReflectConstruct() {
  2232. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  2233. if (_Reflect$construct.sham) return false;
  2234. if (typeof Proxy === "function") return true;
  2235. try {
  2236. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  2237. return true;
  2238. } catch (e) {
  2239. return false;
  2240. }
  2241. } // The LiveQuery client inner state
  2242. var CLIENT_STATE = {
  2243. INITIALIZED: 'initialized',
  2244. CONNECTING: 'connecting',
  2245. CONNECTED: 'connected',
  2246. CLOSED: 'closed',
  2247. RECONNECTING: 'reconnecting',
  2248. DISCONNECTED: 'disconnected'
  2249. }; // The event type the LiveQuery client should sent to server
  2250. var OP_TYPES = {
  2251. CONNECT: 'connect',
  2252. SUBSCRIBE: 'subscribe',
  2253. UNSUBSCRIBE: 'unsubscribe',
  2254. ERROR: 'error'
  2255. }; // The event we get back from LiveQuery server
  2256. var OP_EVENTS = {
  2257. CONNECTED: 'connected',
  2258. SUBSCRIBED: 'subscribed',
  2259. UNSUBSCRIBED: 'unsubscribed',
  2260. ERROR: 'error',
  2261. CREATE: 'create',
  2262. UPDATE: 'update',
  2263. ENTER: 'enter',
  2264. LEAVE: 'leave',
  2265. DELETE: 'delete'
  2266. }; // The event the LiveQuery client should emit
  2267. var CLIENT_EMMITER_TYPES = {
  2268. CLOSE: 'close',
  2269. ERROR: 'error',
  2270. OPEN: 'open'
  2271. }; // The event the LiveQuery subscription should emit
  2272. var SUBSCRIPTION_EMMITER_TYPES = {
  2273. OPEN: 'open',
  2274. CLOSE: 'close',
  2275. ERROR: 'error',
  2276. CREATE: 'create',
  2277. UPDATE: 'update',
  2278. ENTER: 'enter',
  2279. LEAVE: 'leave',
  2280. DELETE: 'delete'
  2281. };
  2282. var generateInterval = function (k) {
  2283. return Math.random() * Math.min(30, Math.pow(2, k) - 1) * 1000;
  2284. };
  2285. /**
  2286. * Creates a new LiveQueryClient.
  2287. * Extends events.EventEmitter
  2288. * <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
  2289. *
  2290. * A wrapper of a standard WebSocket client. We add several useful methods to
  2291. * help you connect/disconnect to LiveQueryServer, subscribe/unsubscribe a ParseQuery easily.
  2292. *
  2293. * javascriptKey and masterKey are used for verifying the LiveQueryClient when it tries
  2294. * to connect to the LiveQuery server
  2295. *
  2296. * We expose three events to help you monitor the status of the LiveQueryClient.
  2297. *
  2298. * <pre>
  2299. * let Parse = require('parse/node');
  2300. * let LiveQueryClient = Parse.LiveQueryClient;
  2301. * let client = new LiveQueryClient({
  2302. * applicationId: '',
  2303. * serverURL: '',
  2304. * javascriptKey: '',
  2305. * masterKey: ''
  2306. * });
  2307. * </pre>
  2308. *
  2309. * Open - When we establish the WebSocket connection to the LiveQuery server, you'll get this event.
  2310. * <pre>
  2311. * client.on('open', () => {
  2312. *
  2313. * });</pre>
  2314. *
  2315. * Close - When we lose the WebSocket connection to the LiveQuery server, you'll get this event.
  2316. * <pre>
  2317. * client.on('close', () => {
  2318. *
  2319. * });</pre>
  2320. *
  2321. * Error - When some network error or LiveQuery server error happens, you'll get this event.
  2322. * <pre>
  2323. * client.on('error', (error) => {
  2324. *
  2325. * });</pre>
  2326. *
  2327. * @alias Parse.LiveQueryClient
  2328. */
  2329. var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
  2330. (0, _inherits2.default)(LiveQueryClient, _EventEmitter);
  2331. var _super = _createSuper(LiveQueryClient);
  2332. /**
  2333. * @param {object} options
  2334. * @param {string} options.applicationId - applicationId of your Parse app
  2335. * @param {string} options.serverURL - <b>the URL of your LiveQuery server</b>
  2336. * @param {string} options.javascriptKey (optional)
  2337. * @param {string} options.masterKey (optional) Your Parse Master Key. (Node.js only!)
  2338. * @param {string} options.sessionToken (optional)
  2339. * @param {string} options.installationId (optional)
  2340. */
  2341. function LiveQueryClient(_ref) {
  2342. var _this;
  2343. var applicationId = _ref.applicationId,
  2344. serverURL = _ref.serverURL,
  2345. javascriptKey = _ref.javascriptKey,
  2346. masterKey = _ref.masterKey,
  2347. sessionToken = _ref.sessionToken,
  2348. installationId = _ref.installationId;
  2349. (0, _classCallCheck2.default)(this, LiveQueryClient);
  2350. _this = _super.call(this);
  2351. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "attempts", void 0);
  2352. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "id", void 0);
  2353. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "requestId", void 0);
  2354. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "applicationId", void 0);
  2355. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "serverURL", void 0);
  2356. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "javascriptKey", void 0);
  2357. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "masterKey", void 0);
  2358. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sessionToken", void 0);
  2359. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "installationId", void 0);
  2360. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "additionalProperties", void 0);
  2361. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "connectPromise", void 0);
  2362. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "subscriptions", void 0);
  2363. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "socket", void 0);
  2364. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", void 0);
  2365. if (!serverURL || (0, _indexOf.default)(serverURL).call(serverURL, 'ws') !== 0) {
  2366. throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
  2367. }
  2368. _this.reconnectHandle = null;
  2369. _this.attempts = 1;
  2370. _this.id = 0;
  2371. _this.requestId = 1;
  2372. _this.serverURL = serverURL;
  2373. _this.applicationId = applicationId;
  2374. _this.javascriptKey = javascriptKey || undefined;
  2375. _this.masterKey = masterKey || undefined;
  2376. _this.sessionToken = sessionToken || undefined;
  2377. _this.installationId = installationId || undefined;
  2378. _this.additionalProperties = true;
  2379. _this.connectPromise = (0, _promiseUtils.resolvingPromise)();
  2380. _this.subscriptions = new _map.default();
  2381. _this.state = CLIENT_STATE.INITIALIZED; // adding listener so process does not crash
  2382. // best practice is for developer to register their own listener
  2383. _this.on('error', function () {});
  2384. return _this;
  2385. }
  2386. (0, _createClass2.default)(LiveQueryClient, [{
  2387. key: "shouldOpen",
  2388. value: function ()
  2389. /*: any*/
  2390. {
  2391. return this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED;
  2392. }
  2393. /**
  2394. * Subscribes to a ParseQuery
  2395. *
  2396. * If you provide the sessionToken, when the LiveQuery server gets ParseObject's
  2397. * updates from parse server, it'll try to check whether the sessionToken fulfills
  2398. * the ParseObject's ACL. The LiveQuery server will only send updates to clients whose
  2399. * sessionToken is fit for the ParseObject's ACL. You can check the LiveQuery protocol
  2400. * <a href="https://github.com/parse-community/parse-server/wiki/Parse-LiveQuery-Protocol-Specification">here</a> for more details. The subscription you get is the same subscription you get
  2401. * from our Standard API.
  2402. *
  2403. * @param {object} query - the ParseQuery you want to subscribe to
  2404. * @param {string} sessionToken (optional)
  2405. * @returns {LiveQuerySubscription} subscription
  2406. */
  2407. }, {
  2408. key: "subscribe",
  2409. value: function (query
  2410. /*: Object*/
  2411. , sessionToken
  2412. /*: ?string*/
  2413. )
  2414. /*: LiveQuerySubscription*/
  2415. {
  2416. var _this2 = this;
  2417. if (!query) {
  2418. return;
  2419. }
  2420. var className = query.className;
  2421. var queryJSON = query.toJSON();
  2422. var where = queryJSON.where;
  2423. var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
  2424. var subscribeRequest = {
  2425. op: OP_TYPES.SUBSCRIBE,
  2426. requestId: this.requestId,
  2427. query: {
  2428. className: className,
  2429. where: where,
  2430. fields: fields
  2431. }
  2432. };
  2433. if (sessionToken) {
  2434. subscribeRequest.sessionToken = sessionToken;
  2435. }
  2436. var subscription = new _LiveQuerySubscription.default(this.requestId, query, sessionToken);
  2437. this.subscriptions.set(this.requestId, subscription);
  2438. this.requestId += 1;
  2439. this.connectPromise.then(function () {
  2440. _this2.socket.send((0, _stringify.default)(subscribeRequest));
  2441. });
  2442. return subscription;
  2443. }
  2444. /**
  2445. * After calling unsubscribe you'll stop receiving events from the subscription object.
  2446. *
  2447. * @param {object} subscription - subscription you would like to unsubscribe from.
  2448. */
  2449. }, {
  2450. key: "unsubscribe",
  2451. value: function (subscription
  2452. /*: Object*/
  2453. ) {
  2454. var _this3 = this;
  2455. if (!subscription) {
  2456. return;
  2457. }
  2458. this.subscriptions.delete(subscription.id);
  2459. var unsubscribeRequest = {
  2460. op: OP_TYPES.UNSUBSCRIBE,
  2461. requestId: subscription.id
  2462. };
  2463. this.connectPromise.then(function () {
  2464. _this3.socket.send((0, _stringify.default)(unsubscribeRequest));
  2465. });
  2466. }
  2467. /**
  2468. * After open is called, the LiveQueryClient will try to send a connect request
  2469. * to the LiveQuery server.
  2470. *
  2471. */
  2472. }, {
  2473. key: "open",
  2474. value: function () {
  2475. var _this4 = this;
  2476. var WebSocketImplementation = _CoreManager.default.getWebSocketController();
  2477. if (!WebSocketImplementation) {
  2478. this.emit(CLIENT_EMMITER_TYPES.ERROR, 'Can not find WebSocket implementation');
  2479. return;
  2480. }
  2481. if (this.state !== CLIENT_STATE.RECONNECTING) {
  2482. this.state = CLIENT_STATE.CONNECTING;
  2483. }
  2484. this.socket = new WebSocketImplementation(this.serverURL); // Bind WebSocket callbacks
  2485. this.socket.onopen = function () {
  2486. _this4._handleWebSocketOpen();
  2487. };
  2488. this.socket.onmessage = function (event) {
  2489. _this4._handleWebSocketMessage(event);
  2490. };
  2491. this.socket.onclose = function () {
  2492. _this4._handleWebSocketClose();
  2493. };
  2494. this.socket.onerror = function (error) {
  2495. _this4._handleWebSocketError(error);
  2496. };
  2497. }
  2498. }, {
  2499. key: "resubscribe",
  2500. value: function () {
  2501. var _context,
  2502. _this5 = this;
  2503. (0, _forEach.default)(_context = this.subscriptions).call(_context, function (subscription, requestId) {
  2504. var query = subscription.query;
  2505. var queryJSON = query.toJSON();
  2506. var where = queryJSON.where;
  2507. var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
  2508. var className = query.className;
  2509. var sessionToken = subscription.sessionToken;
  2510. var subscribeRequest = {
  2511. op: OP_TYPES.SUBSCRIBE,
  2512. requestId: requestId,
  2513. query: {
  2514. className: className,
  2515. where: where,
  2516. fields: fields
  2517. }
  2518. };
  2519. if (sessionToken) {
  2520. subscribeRequest.sessionToken = sessionToken;
  2521. }
  2522. _this5.connectPromise.then(function () {
  2523. _this5.socket.send((0, _stringify.default)(subscribeRequest));
  2524. });
  2525. });
  2526. }
  2527. /**
  2528. * This method will close the WebSocket connection to this LiveQueryClient,
  2529. * cancel the auto reconnect and unsubscribe all subscriptions based on it.
  2530. *
  2531. */
  2532. }, {
  2533. key: "close",
  2534. value: function () {
  2535. var _context2;
  2536. if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
  2537. return;
  2538. }
  2539. this.state = CLIENT_STATE.DISCONNECTED;
  2540. this.socket.close(); // Notify each subscription about the close
  2541. var _iterator = _createForOfIteratorHelper((0, _values.default)(_context2 = this.subscriptions).call(_context2)),
  2542. _step;
  2543. try {
  2544. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2545. var subscription = _step.value;
  2546. subscription.subscribed = false;
  2547. subscription.emit(SUBSCRIPTION_EMMITER_TYPES.CLOSE);
  2548. }
  2549. } catch (err) {
  2550. _iterator.e(err);
  2551. } finally {
  2552. _iterator.f();
  2553. }
  2554. this._handleReset();
  2555. this.emit(CLIENT_EMMITER_TYPES.CLOSE);
  2556. } // ensure we start with valid state if connect is called again after close
  2557. }, {
  2558. key: "_handleReset",
  2559. value: function () {
  2560. this.attempts = 1;
  2561. this.id = 0;
  2562. this.requestId = 1;
  2563. this.connectPromise = (0, _promiseUtils.resolvingPromise)();
  2564. this.subscriptions = new _map.default();
  2565. }
  2566. }, {
  2567. key: "_handleWebSocketOpen",
  2568. value: function () {
  2569. this.attempts = 1;
  2570. var connectRequest = {
  2571. op: OP_TYPES.CONNECT,
  2572. applicationId: this.applicationId,
  2573. javascriptKey: this.javascriptKey,
  2574. masterKey: this.masterKey,
  2575. sessionToken: this.sessionToken
  2576. };
  2577. if (this.additionalProperties) {
  2578. connectRequest.installationId = this.installationId;
  2579. }
  2580. this.socket.send((0, _stringify.default)(connectRequest));
  2581. }
  2582. }, {
  2583. key: "_handleWebSocketMessage",
  2584. value: function (event
  2585. /*: any*/
  2586. ) {
  2587. var data = event.data;
  2588. if (typeof data === 'string') {
  2589. data = JSON.parse(data);
  2590. }
  2591. var subscription = null;
  2592. if (data.requestId) {
  2593. subscription = this.subscriptions.get(data.requestId);
  2594. }
  2595. var response = {
  2596. clientId: data.clientId,
  2597. installationId: data.installationId
  2598. };
  2599. switch (data.op) {
  2600. case OP_EVENTS.CONNECTED:
  2601. if (this.state === CLIENT_STATE.RECONNECTING) {
  2602. this.resubscribe();
  2603. }
  2604. this.emit(CLIENT_EMMITER_TYPES.OPEN);
  2605. this.id = data.clientId;
  2606. this.connectPromise.resolve();
  2607. this.state = CLIENT_STATE.CONNECTED;
  2608. break;
  2609. case OP_EVENTS.SUBSCRIBED:
  2610. if (subscription) {
  2611. subscription.subscribed = true;
  2612. subscription.subscribePromise.resolve();
  2613. (0, _setTimeout2.default)(function () {
  2614. return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.OPEN, response);
  2615. }, 200);
  2616. }
  2617. break;
  2618. case OP_EVENTS.ERROR:
  2619. if (data.requestId) {
  2620. if (subscription) {
  2621. subscription.subscribePromise.resolve();
  2622. (0, _setTimeout2.default)(function () {
  2623. return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
  2624. }, 200);
  2625. }
  2626. } else {
  2627. this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
  2628. }
  2629. if (data.error === 'Additional properties not allowed') {
  2630. this.additionalProperties = false;
  2631. }
  2632. if (data.reconnect) {
  2633. this._handleReconnect();
  2634. }
  2635. break;
  2636. case OP_EVENTS.UNSUBSCRIBED:
  2637. // We have already deleted subscription in unsubscribe(), do nothing here
  2638. break;
  2639. default:
  2640. {
  2641. // create, update, enter, leave, delete cases
  2642. if (!subscription) {
  2643. break;
  2644. }
  2645. var override = false;
  2646. if (data.original) {
  2647. override = true;
  2648. delete data.original.__type; // Check for removed fields
  2649. for (var field in data.original) {
  2650. if (!(field in data.object)) {
  2651. data.object[field] = undefined;
  2652. }
  2653. }
  2654. data.original = _ParseObject.default.fromJSON(data.original, false);
  2655. }
  2656. delete data.object.__type;
  2657. var parseObject = _ParseObject.default.fromJSON(data.object, !(subscription.query && subscription.query._select) ? override : false);
  2658. if (data.original) {
  2659. subscription.emit(data.op, parseObject, data.original, response);
  2660. } else {
  2661. subscription.emit(data.op, parseObject, response);
  2662. }
  2663. var localDatastore = _CoreManager.default.getLocalDatastore();
  2664. if (override && localDatastore.isEnabled) {
  2665. localDatastore._updateObjectIfPinned(parseObject).then(function () {});
  2666. }
  2667. }
  2668. }
  2669. }
  2670. }, {
  2671. key: "_handleWebSocketClose",
  2672. value: function () {
  2673. var _context3;
  2674. if (this.state === CLIENT_STATE.DISCONNECTED) {
  2675. return;
  2676. }
  2677. this.state = CLIENT_STATE.CLOSED;
  2678. this.emit(CLIENT_EMMITER_TYPES.CLOSE); // Notify each subscription about the close
  2679. var _iterator2 = _createForOfIteratorHelper((0, _values.default)(_context3 = this.subscriptions).call(_context3)),
  2680. _step2;
  2681. try {
  2682. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  2683. var subscription = _step2.value;
  2684. subscription.emit(SUBSCRIPTION_EMMITER_TYPES.CLOSE);
  2685. }
  2686. } catch (err) {
  2687. _iterator2.e(err);
  2688. } finally {
  2689. _iterator2.f();
  2690. }
  2691. this._handleReconnect();
  2692. }
  2693. }, {
  2694. key: "_handleWebSocketError",
  2695. value: function (error
  2696. /*: any*/
  2697. ) {
  2698. var _context4;
  2699. this.emit(CLIENT_EMMITER_TYPES.ERROR, error);
  2700. var _iterator3 = _createForOfIteratorHelper((0, _values.default)(_context4 = this.subscriptions).call(_context4)),
  2701. _step3;
  2702. try {
  2703. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  2704. var subscription = _step3.value;
  2705. subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, error);
  2706. }
  2707. } catch (err) {
  2708. _iterator3.e(err);
  2709. } finally {
  2710. _iterator3.f();
  2711. }
  2712. this._handleReconnect();
  2713. }
  2714. }, {
  2715. key: "_handleReconnect",
  2716. value: function () {
  2717. var _context5,
  2718. _this6 = this; // if closed or currently reconnecting we stop attempting to reconnect
  2719. if (this.state === CLIENT_STATE.DISCONNECTED) {
  2720. return;
  2721. }
  2722. this.state = CLIENT_STATE.RECONNECTING;
  2723. var time = generateInterval(this.attempts); // handle case when both close/error occur at frequent rates we ensure we do not reconnect unnecessarily.
  2724. // we're unable to distinguish different between close/error when we're unable to reconnect therefore
  2725. // we try to reconnect in both cases
  2726. // server side ws and browser WebSocket behave differently in when close/error get triggered
  2727. if (this.reconnectHandle) {
  2728. clearTimeout(this.reconnectHandle);
  2729. }
  2730. this.reconnectHandle = (0, _setTimeout2.default)((0, _bind.default)(_context5 = function () {
  2731. _this6.attempts++;
  2732. _this6.connectPromise = (0, _promiseUtils.resolvingPromise)();
  2733. _this6.open();
  2734. }).call(_context5, this), time);
  2735. }
  2736. }]);
  2737. return LiveQueryClient;
  2738. }(_EventEmitter2.default);
  2739. _CoreManager.default.setWebSocketController(_dereq_('./Socket.weapp'));
  2740. var _default = LiveQueryClient;
  2741. exports.default = _default;
  2742. },{"./CoreManager":4,"./EventEmitter":6,"./LiveQuerySubscription":11,"./ParseObject":26,"./Socket.weapp":38,"./promiseUtils":52,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/bind":58,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/keys":68,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/instance/values":76,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/map":78,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/core-js-stable/set-timeout":96,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/assertThisInitialized":120,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/typeof":141}],11:[function(_dereq_,module,exports){
  2743. "use strict";
  2744. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  2745. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  2746. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  2747. _Object$defineProperty(exports, "__esModule", {
  2748. value: true
  2749. });
  2750. exports.default = void 0;
  2751. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  2752. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  2753. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  2754. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  2755. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  2756. var _EventEmitter2 = _interopRequireDefault(_dereq_("./EventEmitter"));
  2757. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  2758. var _promiseUtils = _dereq_("./promiseUtils");
  2759. function _createSuper(Derived) {
  2760. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  2761. return function () {
  2762. var Super = (0, _getPrototypeOf2.default)(Derived),
  2763. result;
  2764. if (hasNativeReflectConstruct) {
  2765. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  2766. result = _Reflect$construct(Super, arguments, NewTarget);
  2767. } else {
  2768. result = Super.apply(this, arguments);
  2769. }
  2770. return (0, _possibleConstructorReturn2.default)(this, result);
  2771. };
  2772. }
  2773. function _isNativeReflectConstruct() {
  2774. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  2775. if (_Reflect$construct.sham) return false;
  2776. if (typeof Proxy === "function") return true;
  2777. try {
  2778. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  2779. return true;
  2780. } catch (e) {
  2781. return false;
  2782. }
  2783. }
  2784. /**
  2785. * Creates a new LiveQuery Subscription.
  2786. * Extends events.EventEmitter
  2787. * <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
  2788. *
  2789. * <p>Response Object - Contains data from the client that made the request
  2790. * <ul>
  2791. * <li>clientId</li>
  2792. * <li>installationId - requires Parse Server 4.0.0+</li>
  2793. * </ul>
  2794. * </p>
  2795. *
  2796. * <p>Open Event - When you call query.subscribe(), we send a subscribe request to
  2797. * the LiveQuery server, when we get the confirmation from the LiveQuery server,
  2798. * this event will be emitted. When the client loses WebSocket connection to the
  2799. * LiveQuery server, we will try to auto reconnect the LiveQuery server. If we
  2800. * reconnect the LiveQuery server and successfully resubscribe the ParseQuery,
  2801. * you'll also get this event.
  2802. *
  2803. * <pre>
  2804. * subscription.on('open', (response) => {
  2805. *
  2806. * });</pre></p>
  2807. *
  2808. * <p>Create Event - When a new ParseObject is created and it fulfills the ParseQuery you subscribe,
  2809. * you'll get this event. The object is the ParseObject which is created.
  2810. *
  2811. * <pre>
  2812. * subscription.on('create', (object, response) => {
  2813. *
  2814. * });</pre></p>
  2815. *
  2816. * <p>Update Event - When an existing ParseObject (original) which fulfills the ParseQuery you subscribe
  2817. * is updated (The ParseObject fulfills the ParseQuery before and after changes),
  2818. * you'll get this event. The object is the ParseObject which is updated.
  2819. * Its content is the latest value of the ParseObject.
  2820. *
  2821. * Parse-Server 3.1.3+ Required for original object parameter
  2822. *
  2823. * <pre>
  2824. * subscription.on('update', (object, original, response) => {
  2825. *
  2826. * });</pre></p>
  2827. *
  2828. * <p>Enter Event - When an existing ParseObject's (original) old value doesn't fulfill the ParseQuery
  2829. * but its new value fulfills the ParseQuery, you'll get this event. The object is the
  2830. * ParseObject which enters the ParseQuery. Its content is the latest value of the ParseObject.
  2831. *
  2832. * Parse-Server 3.1.3+ Required for original object parameter
  2833. *
  2834. * <pre>
  2835. * subscription.on('enter', (object, original, response) => {
  2836. *
  2837. * });</pre></p>
  2838. *
  2839. *
  2840. * <p>Update Event - When an existing ParseObject's old value fulfills the ParseQuery but its new value
  2841. * doesn't fulfill the ParseQuery, you'll get this event. The object is the ParseObject
  2842. * which leaves the ParseQuery. Its content is the latest value of the ParseObject.
  2843. *
  2844. * <pre>
  2845. * subscription.on('leave', (object, response) => {
  2846. *
  2847. * });</pre></p>
  2848. *
  2849. *
  2850. * <p>Delete Event - When an existing ParseObject which fulfills the ParseQuery is deleted, you'll
  2851. * get this event. The object is the ParseObject which is deleted.
  2852. *
  2853. * <pre>
  2854. * subscription.on('delete', (object, response) => {
  2855. *
  2856. * });</pre></p>
  2857. *
  2858. *
  2859. * <p>Close Event - When the client loses the WebSocket connection to the LiveQuery
  2860. * server and we stop receiving events, you'll get this event.
  2861. *
  2862. * <pre>
  2863. * subscription.on('close', () => {
  2864. *
  2865. * });</pre></p>
  2866. *
  2867. * @alias Parse.LiveQuerySubscription
  2868. */
  2869. var Subscription = /*#__PURE__*/function (_EventEmitter) {
  2870. (0, _inherits2.default)(Subscription, _EventEmitter);
  2871. var _super = _createSuper(Subscription);
  2872. /*
  2873. * @param {string} id - subscription id
  2874. * @param {string} query - query to subscribe to
  2875. * @param {string} sessionToken - optional session token
  2876. */
  2877. function Subscription(id, query, sessionToken) {
  2878. var _this;
  2879. (0, _classCallCheck2.default)(this, Subscription);
  2880. _this = _super.call(this);
  2881. _this.id = id;
  2882. _this.query = query;
  2883. _this.sessionToken = sessionToken;
  2884. _this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
  2885. _this.subscribed = false; // adding listener so process does not crash
  2886. // best practice is for developer to register their own listener
  2887. _this.on('error', function () {});
  2888. return _this;
  2889. }
  2890. /**
  2891. * Close the subscription
  2892. *
  2893. * @returns {Promise}
  2894. */
  2895. (0, _createClass2.default)(Subscription, [{
  2896. key: "unsubscribe",
  2897. value: function ()
  2898. /*: Promise*/
  2899. {
  2900. var _this2 = this;
  2901. return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient().then(function (liveQueryClient) {
  2902. liveQueryClient.unsubscribe(_this2);
  2903. _this2.emit('close');
  2904. });
  2905. }
  2906. }]);
  2907. return Subscription;
  2908. }(_EventEmitter2.default);
  2909. var _default = Subscription;
  2910. exports.default = _default;
  2911. },{"./CoreManager":4,"./EventEmitter":6,"./promiseUtils":52,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136}],12:[function(_dereq_,module,exports){
  2912. "use strict";
  2913. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  2914. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  2915. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  2916. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  2917. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  2918. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  2919. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  2920. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  2921. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  2922. var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
  2923. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  2924. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  2925. var _Array$from2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
  2926. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  2927. var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
  2928. var _from = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/from"));
  2929. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  2930. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  2931. var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regenerator"));
  2932. var _keys2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
  2933. var _startsWith = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
  2934. var _keys3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  2935. var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  2936. var _filter = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter"));
  2937. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  2938. var _set = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set"));
  2939. var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
  2940. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  2941. var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
  2942. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  2943. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  2944. var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
  2945. var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
  2946. function _regeneratorRuntime() {
  2947. "use strict";
  2948. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  2949. _regeneratorRuntime = function () {
  2950. return exports;
  2951. };
  2952. var exports = {},
  2953. Op = Object.prototype,
  2954. hasOwn = Op.hasOwnProperty,
  2955. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  2956. iteratorSymbol = $Symbol.iterator || "@@iterator",
  2957. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  2958. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  2959. function define(obj, key, value) {
  2960. return _Object$defineProperty(obj, key, {
  2961. value: value,
  2962. enumerable: !0,
  2963. configurable: !0,
  2964. writable: !0
  2965. }), obj[key];
  2966. }
  2967. try {
  2968. define({}, "");
  2969. } catch (err) {
  2970. define = function (obj, key, value) {
  2971. return obj[key] = value;
  2972. };
  2973. }
  2974. function wrap(innerFn, outerFn, self, tryLocsList) {
  2975. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  2976. generator = _Object$create(protoGenerator.prototype),
  2977. context = new Context(tryLocsList || []);
  2978. return generator._invoke = function (innerFn, self, context) {
  2979. var state = "suspendedStart";
  2980. return function (method, arg) {
  2981. if ("executing" === state) throw new Error("Generator is already running");
  2982. if ("completed" === state) {
  2983. if ("throw" === method) throw arg;
  2984. return doneResult();
  2985. }
  2986. for (context.method = method, context.arg = arg;;) {
  2987. var delegate = context.delegate;
  2988. if (delegate) {
  2989. var delegateResult = maybeInvokeDelegate(delegate, context);
  2990. if (delegateResult) {
  2991. if (delegateResult === ContinueSentinel) continue;
  2992. return delegateResult;
  2993. }
  2994. }
  2995. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  2996. if ("suspendedStart" === state) throw state = "completed", context.arg;
  2997. context.dispatchException(context.arg);
  2998. } else "return" === context.method && context.abrupt("return", context.arg);
  2999. state = "executing";
  3000. var record = tryCatch(innerFn, self, context);
  3001. if ("normal" === record.type) {
  3002. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  3003. return {
  3004. value: record.arg,
  3005. done: context.done
  3006. };
  3007. }
  3008. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  3009. }
  3010. };
  3011. }(innerFn, self, context), generator;
  3012. }
  3013. function tryCatch(fn, obj, arg) {
  3014. try {
  3015. return {
  3016. type: "normal",
  3017. arg: fn.call(obj, arg)
  3018. };
  3019. } catch (err) {
  3020. return {
  3021. type: "throw",
  3022. arg: err
  3023. };
  3024. }
  3025. }
  3026. exports.wrap = wrap;
  3027. var ContinueSentinel = {};
  3028. function Generator() {}
  3029. function GeneratorFunction() {}
  3030. function GeneratorFunctionPrototype() {}
  3031. var IteratorPrototype = {};
  3032. define(IteratorPrototype, iteratorSymbol, function () {
  3033. return this;
  3034. });
  3035. var getProto = _Object$getPrototypeOf,
  3036. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  3037. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  3038. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  3039. function defineIteratorMethods(prototype) {
  3040. var _context19;
  3041. _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, function (method) {
  3042. define(prototype, method, function (arg) {
  3043. return this._invoke(method, arg);
  3044. });
  3045. });
  3046. }
  3047. function AsyncIterator(generator, PromiseImpl) {
  3048. function invoke(method, arg, resolve, reject) {
  3049. var record = tryCatch(generator[method], generator, arg);
  3050. if ("throw" !== record.type) {
  3051. var result = record.arg,
  3052. value = result.value;
  3053. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  3054. invoke("next", value, resolve, reject);
  3055. }, function (err) {
  3056. invoke("throw", err, resolve, reject);
  3057. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  3058. result.value = unwrapped, resolve(result);
  3059. }, function (error) {
  3060. return invoke("throw", error, resolve, reject);
  3061. });
  3062. }
  3063. reject(record.arg);
  3064. }
  3065. var previousPromise;
  3066. this._invoke = function (method, arg) {
  3067. function callInvokeWithMethodAndArg() {
  3068. return new PromiseImpl(function (resolve, reject) {
  3069. invoke(method, arg, resolve, reject);
  3070. });
  3071. }
  3072. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  3073. };
  3074. }
  3075. function maybeInvokeDelegate(delegate, context) {
  3076. var method = delegate.iterator[context.method];
  3077. if (undefined === method) {
  3078. if (context.delegate = null, "throw" === context.method) {
  3079. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  3080. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  3081. }
  3082. return ContinueSentinel;
  3083. }
  3084. var record = tryCatch(method, delegate.iterator, context.arg);
  3085. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  3086. var info = record.arg;
  3087. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  3088. }
  3089. function pushTryEntry(locs) {
  3090. var entry = {
  3091. tryLoc: locs[0]
  3092. };
  3093. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  3094. }
  3095. function resetTryEntry(entry) {
  3096. var record = entry.completion || {};
  3097. record.type = "normal", delete record.arg, entry.completion = record;
  3098. }
  3099. function Context(tryLocsList) {
  3100. this.tryEntries = [{
  3101. tryLoc: "root"
  3102. }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  3103. }
  3104. function values(iterable) {
  3105. if (iterable) {
  3106. var iteratorMethod = iterable[iteratorSymbol];
  3107. if (iteratorMethod) return iteratorMethod.call(iterable);
  3108. if ("function" == typeof iterable.next) return iterable;
  3109. if (!isNaN(iterable.length)) {
  3110. var i = -1,
  3111. next = function next() {
  3112. for (; ++i < iterable.length;) {
  3113. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  3114. }
  3115. return next.value = undefined, next.done = !0, next;
  3116. };
  3117. return next.next = next;
  3118. }
  3119. }
  3120. return {
  3121. next: doneResult
  3122. };
  3123. }
  3124. function doneResult() {
  3125. return {
  3126. value: undefined,
  3127. done: !0
  3128. };
  3129. }
  3130. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  3131. var ctor = "function" == typeof genFun && genFun.constructor;
  3132. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  3133. }, exports.mark = function (genFun) {
  3134. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  3135. }, exports.awrap = function (arg) {
  3136. return {
  3137. __await: arg
  3138. };
  3139. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  3140. return this;
  3141. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  3142. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  3143. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  3144. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  3145. return result.done ? result.value : iter.next();
  3146. });
  3147. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  3148. return this;
  3149. }), define(Gp, "toString", function () {
  3150. return "[object Generator]";
  3151. }), exports.keys = function (object) {
  3152. var keys = [];
  3153. for (var key in object) {
  3154. keys.push(key);
  3155. }
  3156. return _reverseInstanceProperty(keys).call(keys), function next() {
  3157. for (; keys.length;) {
  3158. var key = keys.pop();
  3159. if (key in object) return next.value = key, next.done = !1, next;
  3160. }
  3161. return next.done = !0, next;
  3162. };
  3163. }, exports.values = values, Context.prototype = {
  3164. constructor: Context,
  3165. reset: function (skipTempReset) {
  3166. var _context20;
  3167. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context20 = this.tryEntries).call(_context20, resetTryEntry), !skipTempReset) for (var name in this) {
  3168. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
  3169. }
  3170. },
  3171. stop: function () {
  3172. this.done = !0;
  3173. var rootRecord = this.tryEntries[0].completion;
  3174. if ("throw" === rootRecord.type) throw rootRecord.arg;
  3175. return this.rval;
  3176. },
  3177. dispatchException: function (exception) {
  3178. if (this.done) throw exception;
  3179. var context = this;
  3180. function handle(loc, caught) {
  3181. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  3182. }
  3183. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  3184. var entry = this.tryEntries[i],
  3185. record = entry.completion;
  3186. if ("root" === entry.tryLoc) return handle("end");
  3187. if (entry.tryLoc <= this.prev) {
  3188. var hasCatch = hasOwn.call(entry, "catchLoc"),
  3189. hasFinally = hasOwn.call(entry, "finallyLoc");
  3190. if (hasCatch && hasFinally) {
  3191. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  3192. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  3193. } else if (hasCatch) {
  3194. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  3195. } else {
  3196. if (!hasFinally) throw new Error("try statement without catch or finally");
  3197. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  3198. }
  3199. }
  3200. }
  3201. },
  3202. abrupt: function (type, arg) {
  3203. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  3204. var entry = this.tryEntries[i];
  3205. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  3206. var finallyEntry = entry;
  3207. break;
  3208. }
  3209. }
  3210. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  3211. var record = finallyEntry ? finallyEntry.completion : {};
  3212. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  3213. },
  3214. complete: function (record, afterLoc) {
  3215. if ("throw" === record.type) throw record.arg;
  3216. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  3217. },
  3218. finish: function (finallyLoc) {
  3219. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  3220. var entry = this.tryEntries[i];
  3221. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  3222. }
  3223. },
  3224. catch: function (tryLoc) {
  3225. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  3226. var entry = this.tryEntries[i];
  3227. if (entry.tryLoc === tryLoc) {
  3228. var record = entry.completion;
  3229. if ("throw" === record.type) {
  3230. var thrown = record.arg;
  3231. resetTryEntry(entry);
  3232. }
  3233. return thrown;
  3234. }
  3235. }
  3236. throw new Error("illegal catch attempt");
  3237. },
  3238. delegateYield: function (iterable, resultName, nextLoc) {
  3239. return this.delegate = {
  3240. iterator: values(iterable),
  3241. resultName: resultName,
  3242. nextLoc: nextLoc
  3243. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  3244. }
  3245. }, exports;
  3246. }
  3247. function _createForOfIteratorHelper(o, allowArrayLike) {
  3248. var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
  3249. if (!it) {
  3250. if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  3251. if (it) o = it;
  3252. var i = 0;
  3253. var F = function () {};
  3254. return {
  3255. s: F,
  3256. n: function () {
  3257. if (i >= o.length) return {
  3258. done: true
  3259. };
  3260. return {
  3261. done: false,
  3262. value: o[i++]
  3263. };
  3264. },
  3265. e: function (_e) {
  3266. throw _e;
  3267. },
  3268. f: F
  3269. };
  3270. }
  3271. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  3272. }
  3273. var normalCompletion = true,
  3274. didErr = false,
  3275. err;
  3276. return {
  3277. s: function () {
  3278. it = it.call(o);
  3279. },
  3280. n: function () {
  3281. var step = it.next();
  3282. normalCompletion = step.done;
  3283. return step;
  3284. },
  3285. e: function (_e2) {
  3286. didErr = true;
  3287. err = _e2;
  3288. },
  3289. f: function () {
  3290. try {
  3291. if (!normalCompletion && it.return != null) it.return();
  3292. } finally {
  3293. if (didErr) throw err;
  3294. }
  3295. }
  3296. };
  3297. }
  3298. function _unsupportedIterableToArray(o, minLen) {
  3299. var _context18;
  3300. if (!o) return;
  3301. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  3302. var n = _sliceInstanceProperty(_context18 = Object.prototype.toString.call(o)).call(_context18, 8, -1);
  3303. if (n === "Object" && o.constructor) n = o.constructor.name;
  3304. if (n === "Map" || n === "Set") return _Array$from2(o);
  3305. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  3306. }
  3307. function _arrayLikeToArray(arr, len) {
  3308. if (len == null || len > arr.length) len = arr.length;
  3309. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  3310. arr2[i] = arr[i];
  3311. }
  3312. return arr2;
  3313. }
  3314. /**
  3315. * Provides a local datastore which can be used to store and retrieve <code>Parse.Object</code>. <br />
  3316. * To enable this functionality, call <code>Parse.enableLocalDatastore()</code>.
  3317. *
  3318. * Pin object to add to local datastore
  3319. *
  3320. * <pre>await object.pin();</pre>
  3321. * <pre>await object.pinWithName('pinName');</pre>
  3322. *
  3323. * Query pinned objects
  3324. *
  3325. * <pre>query.fromLocalDatastore();</pre>
  3326. * <pre>query.fromPin();</pre>
  3327. * <pre>query.fromPinWithName();</pre>
  3328. *
  3329. * <pre>const localObjects = await query.find();</pre>
  3330. *
  3331. * @class Parse.LocalDatastore
  3332. * @static
  3333. */
  3334. var LocalDatastore = {
  3335. isEnabled: false,
  3336. isSyncing: false,
  3337. fromPinWithName: function (name
  3338. /*: string*/
  3339. )
  3340. /*: Promise<Array<Object>>*/
  3341. {
  3342. var controller = _CoreManager.default.getLocalDatastoreController();
  3343. return controller.fromPinWithName(name);
  3344. },
  3345. pinWithName: function (name
  3346. /*: string*/
  3347. , value
  3348. /*: any*/
  3349. )
  3350. /*: Promise<void>*/
  3351. {
  3352. var controller = _CoreManager.default.getLocalDatastoreController();
  3353. return controller.pinWithName(name, value);
  3354. },
  3355. unPinWithName: function (name
  3356. /*: string*/
  3357. )
  3358. /*: Promise<void>*/
  3359. {
  3360. var controller = _CoreManager.default.getLocalDatastoreController();
  3361. return controller.unPinWithName(name);
  3362. },
  3363. _getAllContents: function ()
  3364. /*: Promise<Object>*/
  3365. {
  3366. var controller = _CoreManager.default.getLocalDatastoreController();
  3367. return controller.getAllContents();
  3368. },
  3369. // Use for testing
  3370. _getRawStorage: function ()
  3371. /*: Promise<Object>*/
  3372. {
  3373. var controller = _CoreManager.default.getLocalDatastoreController();
  3374. return controller.getRawStorage();
  3375. },
  3376. _clear: function ()
  3377. /*: Promise<void>*/
  3378. {
  3379. var controller = _CoreManager.default.getLocalDatastoreController();
  3380. return controller.clear();
  3381. },
  3382. // Pin the object and children recursively
  3383. // Saves the object and children key to Pin Name
  3384. _handlePinAllWithName: function (name
  3385. /*: string*/
  3386. , objects
  3387. /*: Array<ParseObject>*/
  3388. )
  3389. /*: Promise<void>*/
  3390. {
  3391. var _this = this;
  3392. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  3393. var _context;
  3394. var pinName, toPinPromises, objectKeys, _iterator, _step, parent, children, parentKey, json, objectKey, fromPinPromise, _yield$Promise$all, _yield$Promise$all2, pinned, toPin;
  3395. return _regeneratorRuntime().wrap(function _callee$(_context2) {
  3396. while (1) {
  3397. switch (_context2.prev = _context2.next) {
  3398. case 0:
  3399. pinName = _this.getPinName(name);
  3400. toPinPromises = [];
  3401. objectKeys = [];
  3402. _iterator = _createForOfIteratorHelper(objects);
  3403. try {
  3404. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  3405. parent = _step.value;
  3406. children = _this._getChildren(parent);
  3407. parentKey = _this.getKeyForObject(parent);
  3408. json = parent._toFullJSON(undefined, true);
  3409. if (parent._localId) {
  3410. json._localId = parent._localId;
  3411. }
  3412. children[parentKey] = json;
  3413. for (objectKey in children) {
  3414. objectKeys.push(objectKey);
  3415. toPinPromises.push(_this.pinWithName(objectKey, [children[objectKey]]));
  3416. }
  3417. }
  3418. } catch (err) {
  3419. _iterator.e(err);
  3420. } finally {
  3421. _iterator.f();
  3422. }
  3423. fromPinPromise = _this.fromPinWithName(pinName);
  3424. _context2.next = 8;
  3425. return _promise.default.all([fromPinPromise, toPinPromises]);
  3426. case 8:
  3427. _yield$Promise$all = _context2.sent;
  3428. _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
  3429. pinned = _yield$Promise$all2[0];
  3430. toPin = (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context = []).call(_context, (0, _toConsumableArray2.default)(pinned || []), objectKeys)));
  3431. return _context2.abrupt("return", _this.pinWithName(pinName, toPin));
  3432. case 13:
  3433. case "end":
  3434. return _context2.stop();
  3435. }
  3436. }
  3437. }, _callee);
  3438. }))();
  3439. },
  3440. // Removes object and children keys from pin name
  3441. // Keeps the object and children pinned
  3442. _handleUnPinAllWithName: function _handleUnPinAllWithName(name
  3443. /*: string*/
  3444. , objects
  3445. /*: Array<ParseObject>*/
  3446. ) {
  3447. var _this2 = this;
  3448. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
  3449. var localDatastore, pinName, promises, objectKeys, _iterator2, _step2, _objectKeys, _context3, parent, children, parentKey, pinned, _iterator3, _step3, objectKey, hasReference, key, pinnedObjects;
  3450. return _regeneratorRuntime().wrap(function _callee2$(_context4) {
  3451. while (1) {
  3452. switch (_context4.prev = _context4.next) {
  3453. case 0:
  3454. _context4.next = 2;
  3455. return _this2._getAllContents();
  3456. case 2:
  3457. localDatastore = _context4.sent;
  3458. pinName = _this2.getPinName(name);
  3459. promises = [];
  3460. objectKeys = [];
  3461. _iterator2 = _createForOfIteratorHelper(objects);
  3462. try {
  3463. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  3464. parent = _step2.value;
  3465. children = _this2._getChildren(parent);
  3466. parentKey = _this2.getKeyForObject(parent);
  3467. (_objectKeys = objectKeys).push.apply(_objectKeys, (0, _concat.default)(_context3 = [parentKey]).call(_context3, (0, _toConsumableArray2.default)((0, _keys3.default)(children))));
  3468. }
  3469. } catch (err) {
  3470. _iterator2.e(err);
  3471. } finally {
  3472. _iterator2.f();
  3473. }
  3474. objectKeys = (0, _toConsumableArray2.default)(new _set.default(objectKeys));
  3475. pinned = localDatastore[pinName] || [];
  3476. pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
  3477. return !(0, _includes.default)(objectKeys).call(objectKeys, item);
  3478. });
  3479. if (pinned.length == 0) {
  3480. promises.push(_this2.unPinWithName(pinName));
  3481. delete localDatastore[pinName];
  3482. } else {
  3483. promises.push(_this2.pinWithName(pinName, pinned));
  3484. localDatastore[pinName] = pinned;
  3485. }
  3486. _iterator3 = _createForOfIteratorHelper(objectKeys);
  3487. _context4.prev = 13;
  3488. _iterator3.s();
  3489. case 15:
  3490. if ((_step3 = _iterator3.n()).done) {
  3491. _context4.next = 31;
  3492. break;
  3493. }
  3494. objectKey = _step3.value;
  3495. hasReference = false;
  3496. _context4.t0 = (0, _keys2.default)(_regenerator.default).call(_regenerator.default, localDatastore);
  3497. case 19:
  3498. if ((_context4.t1 = _context4.t0()).done) {
  3499. _context4.next = 28;
  3500. break;
  3501. }
  3502. key = _context4.t1.value;
  3503. if (!(key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX))) {
  3504. _context4.next = 26;
  3505. break;
  3506. }
  3507. pinnedObjects = localDatastore[key] || [];
  3508. if (!(0, _includes.default)(pinnedObjects).call(pinnedObjects, objectKey)) {
  3509. _context4.next = 26;
  3510. break;
  3511. }
  3512. hasReference = true;
  3513. return _context4.abrupt("break", 28);
  3514. case 26:
  3515. _context4.next = 19;
  3516. break;
  3517. case 28:
  3518. if (!hasReference) {
  3519. promises.push(_this2.unPinWithName(objectKey));
  3520. }
  3521. case 29:
  3522. _context4.next = 15;
  3523. break;
  3524. case 31:
  3525. _context4.next = 36;
  3526. break;
  3527. case 33:
  3528. _context4.prev = 33;
  3529. _context4.t2 = _context4["catch"](13);
  3530. _iterator3.e(_context4.t2);
  3531. case 36:
  3532. _context4.prev = 36;
  3533. _iterator3.f();
  3534. return _context4.finish(36);
  3535. case 39:
  3536. return _context4.abrupt("return", _promise.default.all(promises));
  3537. case 40:
  3538. case "end":
  3539. return _context4.stop();
  3540. }
  3541. }
  3542. }, _callee2, null, [[13, 33, 36, 39]]);
  3543. }))();
  3544. },
  3545. // Retrieve all pointer fields from object recursively
  3546. _getChildren: function _getChildren(object
  3547. /*: ParseObject*/
  3548. ) {
  3549. var encountered = {};
  3550. var json = object._toFullJSON(undefined, true);
  3551. for (var key in json) {
  3552. if (json[key] && json[key].__type && json[key].__type === 'Object') {
  3553. this._traverse(json[key], encountered);
  3554. }
  3555. }
  3556. return encountered;
  3557. },
  3558. _traverse: function _traverse(object
  3559. /*: any*/
  3560. , encountered
  3561. /*: any*/
  3562. ) {
  3563. if (!object.objectId) {
  3564. return;
  3565. } else {
  3566. var objectKey = this.getKeyForObject(object);
  3567. if (encountered[objectKey]) {
  3568. return;
  3569. }
  3570. encountered[objectKey] = object;
  3571. }
  3572. for (var key in object) {
  3573. var json = object[key];
  3574. if (!object[key]) {
  3575. json = object;
  3576. }
  3577. if (json.__type && json.__type === 'Object') {
  3578. this._traverse(json, encountered);
  3579. }
  3580. }
  3581. },
  3582. // Transform keys in pin name to objects
  3583. _serializeObjectsFromPinName: function _serializeObjectsFromPinName(name
  3584. /*: string*/
  3585. ) {
  3586. var _this3 = this;
  3587. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  3588. var _context5, _concatInstanceProper, _context6;
  3589. var localDatastore, allObjects, key, pinName, pinned, promises, objects;
  3590. return _regeneratorRuntime().wrap(function _callee3$(_context7) {
  3591. while (1) {
  3592. switch (_context7.prev = _context7.next) {
  3593. case 0:
  3594. _context7.next = 2;
  3595. return _this3._getAllContents();
  3596. case 2:
  3597. localDatastore = _context7.sent;
  3598. allObjects = [];
  3599. for (key in localDatastore) {
  3600. if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
  3601. allObjects.push(localDatastore[key][0]);
  3602. }
  3603. }
  3604. if (name) {
  3605. _context7.next = 7;
  3606. break;
  3607. }
  3608. return _context7.abrupt("return", allObjects);
  3609. case 7:
  3610. pinName = _this3.getPinName(name);
  3611. pinned = localDatastore[pinName];
  3612. if ((0, _isArray.default)(pinned)) {
  3613. _context7.next = 11;
  3614. break;
  3615. }
  3616. return _context7.abrupt("return", []);
  3617. case 11:
  3618. promises = (0, _map.default)(pinned).call(pinned, function (objectKey) {
  3619. return _this3.fromPinWithName(objectKey);
  3620. });
  3621. _context7.next = 14;
  3622. return _promise.default.all(promises);
  3623. case 14:
  3624. objects = _context7.sent;
  3625. objects = (_concatInstanceProper = (0, _concat.default)(_context5 = [])).call.apply(_concatInstanceProper, (0, _concat.default)(_context6 = [_context5]).call(_context6, (0, _toConsumableArray2.default)(objects)));
  3626. return _context7.abrupt("return", (0, _filter.default)(objects).call(objects, function (object) {
  3627. return object != null;
  3628. }));
  3629. case 17:
  3630. case "end":
  3631. return _context7.stop();
  3632. }
  3633. }
  3634. }, _callee3);
  3635. }))();
  3636. },
  3637. // Replaces object pointers with pinned pointers
  3638. // The object pointers may contain old data
  3639. // Uses Breadth First Search Algorithm
  3640. _serializeObject: function _serializeObject(objectKey
  3641. /*: string*/
  3642. , localDatastore
  3643. /*: any*/
  3644. ) {
  3645. var _this4 = this;
  3646. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
  3647. var LDS, root, queue, meta, uniqueId, nodeId, subTreeRoot, field, value, key, pointer;
  3648. return _regeneratorRuntime().wrap(function _callee4$(_context8) {
  3649. while (1) {
  3650. switch (_context8.prev = _context8.next) {
  3651. case 0:
  3652. LDS = localDatastore;
  3653. if (LDS) {
  3654. _context8.next = 5;
  3655. break;
  3656. }
  3657. _context8.next = 4;
  3658. return _this4._getAllContents();
  3659. case 4:
  3660. LDS = _context8.sent;
  3661. case 5:
  3662. if (!(!LDS[objectKey] || LDS[objectKey].length === 0)) {
  3663. _context8.next = 7;
  3664. break;
  3665. }
  3666. return _context8.abrupt("return", null);
  3667. case 7:
  3668. root = LDS[objectKey][0];
  3669. queue = [];
  3670. meta = {};
  3671. uniqueId = 0;
  3672. meta[uniqueId] = root;
  3673. queue.push(uniqueId);
  3674. while (queue.length !== 0) {
  3675. nodeId = queue.shift();
  3676. subTreeRoot = meta[nodeId];
  3677. for (field in subTreeRoot) {
  3678. value = subTreeRoot[field];
  3679. if (value.__type && value.__type === 'Object') {
  3680. key = _this4.getKeyForObject(value);
  3681. if (LDS[key] && LDS[key].length > 0) {
  3682. pointer = LDS[key][0];
  3683. uniqueId++;
  3684. meta[uniqueId] = pointer;
  3685. subTreeRoot[field] = pointer;
  3686. queue.push(uniqueId);
  3687. }
  3688. }
  3689. }
  3690. }
  3691. return _context8.abrupt("return", root);
  3692. case 15:
  3693. case "end":
  3694. return _context8.stop();
  3695. }
  3696. }
  3697. }, _callee4);
  3698. }))();
  3699. },
  3700. // Called when an object is save / fetched
  3701. // Update object pin value
  3702. _updateObjectIfPinned: function _updateObjectIfPinned(object
  3703. /*: ParseObject*/
  3704. )
  3705. /*: Promise<void>*/
  3706. {
  3707. var _this5 = this;
  3708. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
  3709. var objectKey, pinned;
  3710. return _regeneratorRuntime().wrap(function _callee5$(_context9) {
  3711. while (1) {
  3712. switch (_context9.prev = _context9.next) {
  3713. case 0:
  3714. if (_this5.isEnabled) {
  3715. _context9.next = 2;
  3716. break;
  3717. }
  3718. return _context9.abrupt("return");
  3719. case 2:
  3720. objectKey = _this5.getKeyForObject(object);
  3721. _context9.next = 5;
  3722. return _this5.fromPinWithName(objectKey);
  3723. case 5:
  3724. pinned = _context9.sent;
  3725. if (!(!pinned || pinned.length === 0)) {
  3726. _context9.next = 8;
  3727. break;
  3728. }
  3729. return _context9.abrupt("return");
  3730. case 8:
  3731. return _context9.abrupt("return", _this5.pinWithName(objectKey, [object._toFullJSON()]));
  3732. case 9:
  3733. case "end":
  3734. return _context9.stop();
  3735. }
  3736. }
  3737. }, _callee5);
  3738. }))();
  3739. },
  3740. // Called when object is destroyed
  3741. // Unpin object and remove all references from pin names
  3742. // TODO: Destroy children?
  3743. _destroyObjectIfPinned: function _destroyObjectIfPinned(object
  3744. /*: ParseObject*/
  3745. ) {
  3746. var _this6 = this;
  3747. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
  3748. var localDatastore, objectKey, pin, promises, key, pinned;
  3749. return _regeneratorRuntime().wrap(function _callee6$(_context10) {
  3750. while (1) {
  3751. switch (_context10.prev = _context10.next) {
  3752. case 0:
  3753. if (_this6.isEnabled) {
  3754. _context10.next = 2;
  3755. break;
  3756. }
  3757. return _context10.abrupt("return");
  3758. case 2:
  3759. _context10.next = 4;
  3760. return _this6._getAllContents();
  3761. case 4:
  3762. localDatastore = _context10.sent;
  3763. objectKey = _this6.getKeyForObject(object);
  3764. pin = localDatastore[objectKey];
  3765. if (pin) {
  3766. _context10.next = 9;
  3767. break;
  3768. }
  3769. return _context10.abrupt("return");
  3770. case 9:
  3771. promises = [_this6.unPinWithName(objectKey)];
  3772. delete localDatastore[objectKey];
  3773. for (key in localDatastore) {
  3774. if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
  3775. pinned = localDatastore[key] || [];
  3776. if ((0, _includes.default)(pinned).call(pinned, objectKey)) {
  3777. pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
  3778. return item !== objectKey;
  3779. });
  3780. if (pinned.length == 0) {
  3781. promises.push(_this6.unPinWithName(key));
  3782. delete localDatastore[key];
  3783. } else {
  3784. promises.push(_this6.pinWithName(key, pinned));
  3785. localDatastore[key] = pinned;
  3786. }
  3787. }
  3788. }
  3789. }
  3790. return _context10.abrupt("return", _promise.default.all(promises));
  3791. case 13:
  3792. case "end":
  3793. return _context10.stop();
  3794. }
  3795. }
  3796. }, _callee6);
  3797. }))();
  3798. },
  3799. // Update pin and references of the unsaved object
  3800. _updateLocalIdForObject: function _updateLocalIdForObject(localId
  3801. /*: string*/
  3802. , object
  3803. /*: ParseObject*/
  3804. ) {
  3805. var _this7 = this;
  3806. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
  3807. var _context11, _context12;
  3808. var localKey, objectKey, unsaved, promises, localDatastore, key, pinned;
  3809. return _regeneratorRuntime().wrap(function _callee7$(_context13) {
  3810. while (1) {
  3811. switch (_context13.prev = _context13.next) {
  3812. case 0:
  3813. if (_this7.isEnabled) {
  3814. _context13.next = 2;
  3815. break;
  3816. }
  3817. return _context13.abrupt("return");
  3818. case 2:
  3819. localKey = (0, _concat.default)(_context11 = (0, _concat.default)(_context12 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context12, object.className, "_")).call(_context11, localId);
  3820. objectKey = _this7.getKeyForObject(object);
  3821. _context13.next = 6;
  3822. return _this7.fromPinWithName(localKey);
  3823. case 6:
  3824. unsaved = _context13.sent;
  3825. if (!(!unsaved || unsaved.length === 0)) {
  3826. _context13.next = 9;
  3827. break;
  3828. }
  3829. return _context13.abrupt("return");
  3830. case 9:
  3831. promises = [_this7.unPinWithName(localKey), _this7.pinWithName(objectKey, unsaved)];
  3832. _context13.next = 12;
  3833. return _this7._getAllContents();
  3834. case 12:
  3835. localDatastore = _context13.sent;
  3836. for (key in localDatastore) {
  3837. if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
  3838. pinned = localDatastore[key] || [];
  3839. if ((0, _includes.default)(pinned).call(pinned, localKey)) {
  3840. pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
  3841. return item !== localKey;
  3842. });
  3843. pinned.push(objectKey);
  3844. promises.push(_this7.pinWithName(key, pinned));
  3845. localDatastore[key] = pinned;
  3846. }
  3847. }
  3848. }
  3849. return _context13.abrupt("return", _promise.default.all(promises));
  3850. case 15:
  3851. case "end":
  3852. return _context13.stop();
  3853. }
  3854. }
  3855. }, _callee7);
  3856. }))();
  3857. },
  3858. /**
  3859. * Updates Local Datastore from Server
  3860. *
  3861. * <pre>
  3862. * await Parse.LocalDatastore.updateFromServer();
  3863. * </pre>
  3864. *
  3865. * @function updateFromServer
  3866. * @name Parse.LocalDatastore.updateFromServer
  3867. * @static
  3868. */
  3869. updateFromServer: function updateFromServer() {
  3870. var _this8 = this;
  3871. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
  3872. var _context14;
  3873. var localDatastore, keys, key, pointersHash, _i, _keys, _key, _key$split, _key$split2, className, objectId, queryPromises, responses, objects, pinPromises;
  3874. return _regeneratorRuntime().wrap(function _callee8$(_context15) {
  3875. while (1) {
  3876. switch (_context15.prev = _context15.next) {
  3877. case 0:
  3878. if (!(!_this8.checkIfEnabled() || _this8.isSyncing)) {
  3879. _context15.next = 2;
  3880. break;
  3881. }
  3882. return _context15.abrupt("return");
  3883. case 2:
  3884. _context15.next = 4;
  3885. return _this8._getAllContents();
  3886. case 4:
  3887. localDatastore = _context15.sent;
  3888. keys = [];
  3889. for (key in localDatastore) {
  3890. if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
  3891. keys.push(key);
  3892. }
  3893. }
  3894. if (!(keys.length === 0)) {
  3895. _context15.next = 9;
  3896. break;
  3897. }
  3898. return _context15.abrupt("return");
  3899. case 9:
  3900. _this8.isSyncing = true;
  3901. pointersHash = {};
  3902. _i = 0, _keys = keys;
  3903. case 12:
  3904. if (!(_i < _keys.length)) {
  3905. _context15.next = 23;
  3906. break;
  3907. }
  3908. _key = _keys[_i]; // Ignore the OBJECT_PREFIX
  3909. _key$split = _key.split('_'), _key$split2 = (0, _slicedToArray2.default)(_key$split, 4), className = _key$split2[2], objectId = _key$split2[3]; // User key is split into [ 'Parse', 'LDS', '', 'User', 'objectId' ]
  3910. if (_key.split('_').length === 5 && _key.split('_')[3] === 'User') {
  3911. className = '_User';
  3912. objectId = _key.split('_')[4];
  3913. }
  3914. if (!(0, _startsWith.default)(objectId).call(objectId, 'local')) {
  3915. _context15.next = 18;
  3916. break;
  3917. }
  3918. return _context15.abrupt("continue", 20);
  3919. case 18:
  3920. if (!(className in pointersHash)) {
  3921. pointersHash[className] = new _set.default();
  3922. }
  3923. pointersHash[className].add(objectId);
  3924. case 20:
  3925. _i++;
  3926. _context15.next = 12;
  3927. break;
  3928. case 23:
  3929. queryPromises = (0, _map.default)(_context14 = (0, _keys3.default)(pointersHash)).call(_context14, function (className) {
  3930. var objectIds = (0, _from.default)(pointersHash[className]);
  3931. var query = new _ParseQuery.default(className);
  3932. query.limit(objectIds.length);
  3933. if (objectIds.length === 1) {
  3934. query.equalTo('objectId', objectIds[0]);
  3935. } else {
  3936. query.containedIn('objectId', objectIds);
  3937. }
  3938. return (0, _find.default)(query).call(query);
  3939. });
  3940. _context15.prev = 24;
  3941. _context15.next = 27;
  3942. return _promise.default.all(queryPromises);
  3943. case 27:
  3944. responses = _context15.sent;
  3945. objects = (0, _concat.default)([]).apply([], responses);
  3946. pinPromises = (0, _map.default)(objects).call(objects, function (object) {
  3947. var objectKey = _this8.getKeyForObject(object);
  3948. return _this8.pinWithName(objectKey, object._toFullJSON());
  3949. });
  3950. _context15.next = 32;
  3951. return _promise.default.all(pinPromises);
  3952. case 32:
  3953. _this8.isSyncing = false;
  3954. _context15.next = 39;
  3955. break;
  3956. case 35:
  3957. _context15.prev = 35;
  3958. _context15.t0 = _context15["catch"](24);
  3959. console.error('Error syncing LocalDatastore: ', _context15.t0);
  3960. _this8.isSyncing = false;
  3961. case 39:
  3962. case "end":
  3963. return _context15.stop();
  3964. }
  3965. }
  3966. }, _callee8, null, [[24, 35]]);
  3967. }))();
  3968. },
  3969. getKeyForObject: function getKeyForObject(object
  3970. /*: any*/
  3971. ) {
  3972. var _context16, _context17;
  3973. var objectId = object.objectId || object._getId();
  3974. return (0, _concat.default)(_context16 = (0, _concat.default)(_context17 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context17, object.className, "_")).call(_context16, objectId);
  3975. },
  3976. getPinName: function getPinName(pinName
  3977. /*: ?string*/
  3978. ) {
  3979. if (!pinName || pinName === _LocalDatastoreUtils.DEFAULT_PIN) {
  3980. return _LocalDatastoreUtils.DEFAULT_PIN;
  3981. }
  3982. return _LocalDatastoreUtils.PIN_PREFIX + pinName;
  3983. },
  3984. checkIfEnabled: function checkIfEnabled() {
  3985. if (!this.isEnabled) {
  3986. console.error('Parse.enableLocalDatastore() must be called first');
  3987. }
  3988. return this.isEnabled;
  3989. }
  3990. };
  3991. module.exports = LocalDatastore;
  3992. _CoreManager.default.setLocalDatastoreController(_dereq_('./LocalDatastoreController'));
  3993. _CoreManager.default.setLocalDatastore(LocalDatastore);
  3994. },{"./CoreManager":4,"./LocalDatastoreController":13,"./LocalDatastoreUtils":14,"./ParseQuery":29,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/find":64,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/includes":66,"@babel/runtime-corejs3/core-js-stable/instance/keys":68,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/instance/starts-with":75,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/set":97,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/slicedToArray":138,"@babel/runtime-corejs3/helpers/toConsumableArray":140,"@babel/runtime-corejs3/helpers/typeof":141,"@babel/runtime-corejs3/regenerator":145}],13:[function(_dereq_,module,exports){
  3995. "use strict";
  3996. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  3997. var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
  3998. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  3999. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
  4000. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  4001. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  4002. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  4003. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  4004. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  4005. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  4006. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  4007. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  4008. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  4009. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  4010. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  4011. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  4012. var _reduce = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
  4013. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  4014. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  4015. var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
  4016. var _Storage = _interopRequireDefault(_dereq_("./Storage"));
  4017. function _createForOfIteratorHelper(o, allowArrayLike) {
  4018. var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
  4019. if (!it) {
  4020. if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  4021. if (it) o = it;
  4022. var i = 0;
  4023. var F = function () {};
  4024. return {
  4025. s: F,
  4026. n: function () {
  4027. if (i >= o.length) return {
  4028. done: true
  4029. };
  4030. return {
  4031. done: false,
  4032. value: o[i++]
  4033. };
  4034. },
  4035. e: function (_e) {
  4036. throw _e;
  4037. },
  4038. f: F
  4039. };
  4040. }
  4041. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  4042. }
  4043. var normalCompletion = true,
  4044. didErr = false,
  4045. err;
  4046. return {
  4047. s: function () {
  4048. it = it.call(o);
  4049. },
  4050. n: function () {
  4051. var step = it.next();
  4052. normalCompletion = step.done;
  4053. return step;
  4054. },
  4055. e: function (_e2) {
  4056. didErr = true;
  4057. err = _e2;
  4058. },
  4059. f: function () {
  4060. try {
  4061. if (!normalCompletion && it.return != null) it.return();
  4062. } finally {
  4063. if (didErr) throw err;
  4064. }
  4065. }
  4066. };
  4067. }
  4068. function _unsupportedIterableToArray(o, minLen) {
  4069. var _context9;
  4070. if (!o) return;
  4071. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  4072. var n = _sliceInstanceProperty(_context9 = Object.prototype.toString.call(o)).call(_context9, 8, -1);
  4073. if (n === "Object" && o.constructor) n = o.constructor.name;
  4074. if (n === "Map" || n === "Set") return _Array$from(o);
  4075. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  4076. }
  4077. function _arrayLikeToArray(arr, len) {
  4078. if (len == null || len > arr.length) len = arr.length;
  4079. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  4080. arr2[i] = arr[i];
  4081. }
  4082. return arr2;
  4083. }
  4084. function _regeneratorRuntime() {
  4085. "use strict";
  4086. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  4087. _regeneratorRuntime = function () {
  4088. return exports;
  4089. };
  4090. var exports = {},
  4091. Op = Object.prototype,
  4092. hasOwn = Op.hasOwnProperty,
  4093. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  4094. iteratorSymbol = $Symbol.iterator || "@@iterator",
  4095. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  4096. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  4097. function define(obj, key, value) {
  4098. return _Object$defineProperty(obj, key, {
  4099. value: value,
  4100. enumerable: !0,
  4101. configurable: !0,
  4102. writable: !0
  4103. }), obj[key];
  4104. }
  4105. try {
  4106. define({}, "");
  4107. } catch (err) {
  4108. define = function (obj, key, value) {
  4109. return obj[key] = value;
  4110. };
  4111. }
  4112. function wrap(innerFn, outerFn, self, tryLocsList) {
  4113. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  4114. generator = _Object$create(protoGenerator.prototype),
  4115. context = new Context(tryLocsList || []);
  4116. return generator._invoke = function (innerFn, self, context) {
  4117. var state = "suspendedStart";
  4118. return function (method, arg) {
  4119. if ("executing" === state) throw new Error("Generator is already running");
  4120. if ("completed" === state) {
  4121. if ("throw" === method) throw arg;
  4122. return doneResult();
  4123. }
  4124. for (context.method = method, context.arg = arg;;) {
  4125. var delegate = context.delegate;
  4126. if (delegate) {
  4127. var delegateResult = maybeInvokeDelegate(delegate, context);
  4128. if (delegateResult) {
  4129. if (delegateResult === ContinueSentinel) continue;
  4130. return delegateResult;
  4131. }
  4132. }
  4133. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  4134. if ("suspendedStart" === state) throw state = "completed", context.arg;
  4135. context.dispatchException(context.arg);
  4136. } else "return" === context.method && context.abrupt("return", context.arg);
  4137. state = "executing";
  4138. var record = tryCatch(innerFn, self, context);
  4139. if ("normal" === record.type) {
  4140. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  4141. return {
  4142. value: record.arg,
  4143. done: context.done
  4144. };
  4145. }
  4146. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  4147. }
  4148. };
  4149. }(innerFn, self, context), generator;
  4150. }
  4151. function tryCatch(fn, obj, arg) {
  4152. try {
  4153. return {
  4154. type: "normal",
  4155. arg: fn.call(obj, arg)
  4156. };
  4157. } catch (err) {
  4158. return {
  4159. type: "throw",
  4160. arg: err
  4161. };
  4162. }
  4163. }
  4164. exports.wrap = wrap;
  4165. var ContinueSentinel = {};
  4166. function Generator() {}
  4167. function GeneratorFunction() {}
  4168. function GeneratorFunctionPrototype() {}
  4169. var IteratorPrototype = {};
  4170. define(IteratorPrototype, iteratorSymbol, function () {
  4171. return this;
  4172. });
  4173. var getProto = _Object$getPrototypeOf,
  4174. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  4175. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  4176. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  4177. function defineIteratorMethods(prototype) {
  4178. var _context7;
  4179. _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, function (method) {
  4180. define(prototype, method, function (arg) {
  4181. return this._invoke(method, arg);
  4182. });
  4183. });
  4184. }
  4185. function AsyncIterator(generator, PromiseImpl) {
  4186. function invoke(method, arg, resolve, reject) {
  4187. var record = tryCatch(generator[method], generator, arg);
  4188. if ("throw" !== record.type) {
  4189. var result = record.arg,
  4190. value = result.value;
  4191. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  4192. invoke("next", value, resolve, reject);
  4193. }, function (err) {
  4194. invoke("throw", err, resolve, reject);
  4195. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  4196. result.value = unwrapped, resolve(result);
  4197. }, function (error) {
  4198. return invoke("throw", error, resolve, reject);
  4199. });
  4200. }
  4201. reject(record.arg);
  4202. }
  4203. var previousPromise;
  4204. this._invoke = function (method, arg) {
  4205. function callInvokeWithMethodAndArg() {
  4206. return new PromiseImpl(function (resolve, reject) {
  4207. invoke(method, arg, resolve, reject);
  4208. });
  4209. }
  4210. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  4211. };
  4212. }
  4213. function maybeInvokeDelegate(delegate, context) {
  4214. var method = delegate.iterator[context.method];
  4215. if (undefined === method) {
  4216. if (context.delegate = null, "throw" === context.method) {
  4217. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  4218. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  4219. }
  4220. return ContinueSentinel;
  4221. }
  4222. var record = tryCatch(method, delegate.iterator, context.arg);
  4223. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  4224. var info = record.arg;
  4225. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  4226. }
  4227. function pushTryEntry(locs) {
  4228. var entry = {
  4229. tryLoc: locs[0]
  4230. };
  4231. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  4232. }
  4233. function resetTryEntry(entry) {
  4234. var record = entry.completion || {};
  4235. record.type = "normal", delete record.arg, entry.completion = record;
  4236. }
  4237. function Context(tryLocsList) {
  4238. this.tryEntries = [{
  4239. tryLoc: "root"
  4240. }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  4241. }
  4242. function values(iterable) {
  4243. if (iterable) {
  4244. var iteratorMethod = iterable[iteratorSymbol];
  4245. if (iteratorMethod) return iteratorMethod.call(iterable);
  4246. if ("function" == typeof iterable.next) return iterable;
  4247. if (!isNaN(iterable.length)) {
  4248. var i = -1,
  4249. next = function next() {
  4250. for (; ++i < iterable.length;) {
  4251. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  4252. }
  4253. return next.value = undefined, next.done = !0, next;
  4254. };
  4255. return next.next = next;
  4256. }
  4257. }
  4258. return {
  4259. next: doneResult
  4260. };
  4261. }
  4262. function doneResult() {
  4263. return {
  4264. value: undefined,
  4265. done: !0
  4266. };
  4267. }
  4268. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  4269. var ctor = "function" == typeof genFun && genFun.constructor;
  4270. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  4271. }, exports.mark = function (genFun) {
  4272. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  4273. }, exports.awrap = function (arg) {
  4274. return {
  4275. __await: arg
  4276. };
  4277. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  4278. return this;
  4279. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  4280. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  4281. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  4282. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  4283. return result.done ? result.value : iter.next();
  4284. });
  4285. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  4286. return this;
  4287. }), define(Gp, "toString", function () {
  4288. return "[object Generator]";
  4289. }), exports.keys = function (object) {
  4290. var keys = [];
  4291. for (var key in object) {
  4292. keys.push(key);
  4293. }
  4294. return _reverseInstanceProperty(keys).call(keys), function next() {
  4295. for (; keys.length;) {
  4296. var key = keys.pop();
  4297. if (key in object) return next.value = key, next.done = !1, next;
  4298. }
  4299. return next.done = !0, next;
  4300. };
  4301. }, exports.values = values, Context.prototype = {
  4302. constructor: Context,
  4303. reset: function (skipTempReset) {
  4304. var _context8;
  4305. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) {
  4306. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
  4307. }
  4308. },
  4309. stop: function () {
  4310. this.done = !0;
  4311. var rootRecord = this.tryEntries[0].completion;
  4312. if ("throw" === rootRecord.type) throw rootRecord.arg;
  4313. return this.rval;
  4314. },
  4315. dispatchException: function (exception) {
  4316. if (this.done) throw exception;
  4317. var context = this;
  4318. function handle(loc, caught) {
  4319. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  4320. }
  4321. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  4322. var entry = this.tryEntries[i],
  4323. record = entry.completion;
  4324. if ("root" === entry.tryLoc) return handle("end");
  4325. if (entry.tryLoc <= this.prev) {
  4326. var hasCatch = hasOwn.call(entry, "catchLoc"),
  4327. hasFinally = hasOwn.call(entry, "finallyLoc");
  4328. if (hasCatch && hasFinally) {
  4329. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  4330. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  4331. } else if (hasCatch) {
  4332. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  4333. } else {
  4334. if (!hasFinally) throw new Error("try statement without catch or finally");
  4335. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  4336. }
  4337. }
  4338. }
  4339. },
  4340. abrupt: function (type, arg) {
  4341. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  4342. var entry = this.tryEntries[i];
  4343. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  4344. var finallyEntry = entry;
  4345. break;
  4346. }
  4347. }
  4348. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  4349. var record = finallyEntry ? finallyEntry.completion : {};
  4350. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  4351. },
  4352. complete: function (record, afterLoc) {
  4353. if ("throw" === record.type) throw record.arg;
  4354. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  4355. },
  4356. finish: function (finallyLoc) {
  4357. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  4358. var entry = this.tryEntries[i];
  4359. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  4360. }
  4361. },
  4362. catch: function (tryLoc) {
  4363. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  4364. var entry = this.tryEntries[i];
  4365. if (entry.tryLoc === tryLoc) {
  4366. var record = entry.completion;
  4367. if ("throw" === record.type) {
  4368. var thrown = record.arg;
  4369. resetTryEntry(entry);
  4370. }
  4371. return thrown;
  4372. }
  4373. }
  4374. throw new Error("illegal catch attempt");
  4375. },
  4376. delegateYield: function (iterable, resultName, nextLoc) {
  4377. return this.delegate = {
  4378. iterator: values(iterable),
  4379. resultName: resultName,
  4380. nextLoc: nextLoc
  4381. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  4382. }
  4383. }, exports;
  4384. }
  4385. var LocalDatastoreController = {
  4386. fromPinWithName: function (name
  4387. /*: string*/
  4388. )
  4389. /*: Array<Object>*/
  4390. {
  4391. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  4392. var values, objects;
  4393. return _regeneratorRuntime().wrap(function _callee$(_context) {
  4394. while (1) {
  4395. switch (_context.prev = _context.next) {
  4396. case 0:
  4397. _context.next = 2;
  4398. return _Storage.default.getItemAsync(name);
  4399. case 2:
  4400. values = _context.sent;
  4401. if (values) {
  4402. _context.next = 5;
  4403. break;
  4404. }
  4405. return _context.abrupt("return", []);
  4406. case 5:
  4407. objects = JSON.parse(values);
  4408. return _context.abrupt("return", objects);
  4409. case 7:
  4410. case "end":
  4411. return _context.stop();
  4412. }
  4413. }
  4414. }, _callee);
  4415. }))();
  4416. },
  4417. pinWithName: function pinWithName(name
  4418. /*: string*/
  4419. , value
  4420. /*: any*/
  4421. ) {
  4422. var values = (0, _stringify.default)(value);
  4423. return _Storage.default.setItemAsync(name, values);
  4424. },
  4425. unPinWithName: function unPinWithName(name
  4426. /*: string*/
  4427. ) {
  4428. return _Storage.default.removeItemAsync(name);
  4429. },
  4430. getAllContents: function getAllContents()
  4431. /*: Object*/
  4432. {
  4433. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  4434. var keys;
  4435. return _regeneratorRuntime().wrap(function _callee3$(_context3) {
  4436. while (1) {
  4437. switch (_context3.prev = _context3.next) {
  4438. case 0:
  4439. _context3.next = 2;
  4440. return _Storage.default.getAllKeysAsync();
  4441. case 2:
  4442. keys = _context3.sent;
  4443. return _context3.abrupt("return", (0, _reduce.default)(keys).call(keys, /*#__PURE__*/function () {
  4444. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(previousPromise, key) {
  4445. var LDS, value;
  4446. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  4447. while (1) {
  4448. switch (_context2.prev = _context2.next) {
  4449. case 0:
  4450. _context2.next = 2;
  4451. return previousPromise;
  4452. case 2:
  4453. LDS = _context2.sent;
  4454. if (!(0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
  4455. _context2.next = 8;
  4456. break;
  4457. }
  4458. _context2.next = 6;
  4459. return _Storage.default.getItemAsync(key);
  4460. case 6:
  4461. value = _context2.sent;
  4462. try {
  4463. LDS[key] = JSON.parse(value);
  4464. } catch (error) {
  4465. console.error('Error getAllContents: ', error);
  4466. }
  4467. case 8:
  4468. return _context2.abrupt("return", LDS);
  4469. case 9:
  4470. case "end":
  4471. return _context2.stop();
  4472. }
  4473. }
  4474. }, _callee2);
  4475. }));
  4476. return function (_x, _x2) {
  4477. return _ref.apply(this, arguments);
  4478. };
  4479. }(), _promise.default.resolve({})));
  4480. case 4:
  4481. case "end":
  4482. return _context3.stop();
  4483. }
  4484. }
  4485. }, _callee3);
  4486. }))();
  4487. },
  4488. // Used for testing
  4489. getRawStorage: function getRawStorage()
  4490. /*: Object*/
  4491. {
  4492. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
  4493. var keys;
  4494. return _regeneratorRuntime().wrap(function _callee5$(_context5) {
  4495. while (1) {
  4496. switch (_context5.prev = _context5.next) {
  4497. case 0:
  4498. _context5.next = 2;
  4499. return _Storage.default.getAllKeysAsync();
  4500. case 2:
  4501. keys = _context5.sent;
  4502. return _context5.abrupt("return", (0, _reduce.default)(keys).call(keys, /*#__PURE__*/function () {
  4503. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(previousPromise, key) {
  4504. var LDS, value;
  4505. return _regeneratorRuntime().wrap(function _callee4$(_context4) {
  4506. while (1) {
  4507. switch (_context4.prev = _context4.next) {
  4508. case 0:
  4509. _context4.next = 2;
  4510. return previousPromise;
  4511. case 2:
  4512. LDS = _context4.sent;
  4513. _context4.next = 5;
  4514. return _Storage.default.getItemAsync(key);
  4515. case 5:
  4516. value = _context4.sent;
  4517. LDS[key] = value;
  4518. return _context4.abrupt("return", LDS);
  4519. case 8:
  4520. case "end":
  4521. return _context4.stop();
  4522. }
  4523. }
  4524. }, _callee4);
  4525. }));
  4526. return function (_x3, _x4) {
  4527. return _ref2.apply(this, arguments);
  4528. };
  4529. }(), _promise.default.resolve({})));
  4530. case 4:
  4531. case "end":
  4532. return _context5.stop();
  4533. }
  4534. }
  4535. }, _callee5);
  4536. }))();
  4537. },
  4538. clear: function clear()
  4539. /*: Promise*/
  4540. {
  4541. var _this = this;
  4542. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
  4543. var keys, toRemove, _iterator, _step, key, promises;
  4544. return _regeneratorRuntime().wrap(function _callee6$(_context6) {
  4545. while (1) {
  4546. switch (_context6.prev = _context6.next) {
  4547. case 0:
  4548. _context6.next = 2;
  4549. return _Storage.default.getAllKeysAsync();
  4550. case 2:
  4551. keys = _context6.sent;
  4552. toRemove = [];
  4553. _iterator = _createForOfIteratorHelper(keys);
  4554. try {
  4555. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4556. key = _step.value;
  4557. if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
  4558. toRemove.push(key);
  4559. }
  4560. }
  4561. } catch (err) {
  4562. _iterator.e(err);
  4563. } finally {
  4564. _iterator.f();
  4565. }
  4566. promises = (0, _map.default)(toRemove).call(toRemove, _this.unPinWithName);
  4567. return _context6.abrupt("return", _promise.default.all(promises));
  4568. case 8:
  4569. case "end":
  4570. return _context6.stop();
  4571. }
  4572. }
  4573. }, _callee6);
  4574. }))();
  4575. }
  4576. };
  4577. module.exports = LocalDatastoreController;
  4578. },{"./LocalDatastoreUtils":14,"./Storage":39,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/reduce":70,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],14:[function(_dereq_,module,exports){
  4579. "use strict";
  4580. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  4581. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  4582. _Object$defineProperty(exports, "__esModule", {
  4583. value: true
  4584. });
  4585. exports.PIN_PREFIX = exports.OBJECT_PREFIX = exports.DEFAULT_PIN = void 0;
  4586. exports.isLocalDatastoreKey = isLocalDatastoreKey;
  4587. var _startsWith = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
  4588. /**
  4589. * Copyright (c) 2015-present, Parse, LLC.
  4590. * All rights reserved.
  4591. *
  4592. * This source code is licensed under the BSD-style license found in the
  4593. * LICENSE file in the root directory of this source tree. An additional grant
  4594. * of patent rights can be found in the PATENTS file in the same directory.
  4595. *
  4596. * @flow
  4597. * @private
  4598. */
  4599. var DEFAULT_PIN = '_default';
  4600. exports.DEFAULT_PIN = DEFAULT_PIN;
  4601. var PIN_PREFIX = 'parsePin_';
  4602. exports.PIN_PREFIX = PIN_PREFIX;
  4603. var OBJECT_PREFIX = 'Parse_LDS_';
  4604. exports.OBJECT_PREFIX = OBJECT_PREFIX;
  4605. function isLocalDatastoreKey(key
  4606. /*: string*/
  4607. )
  4608. /*: boolean*/
  4609. {
  4610. return !!(key && (key === DEFAULT_PIN || (0, _startsWith.default)(key).call(key, PIN_PREFIX) || (0, _startsWith.default)(key).call(key, OBJECT_PREFIX)));
  4611. }
  4612. },{"@babel/runtime-corejs3/core-js-stable/instance/starts-with":75,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],15:[function(_dereq_,module,exports){
  4613. "use strict";
  4614. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  4615. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  4616. var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
  4617. var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
  4618. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  4619. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  4620. var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
  4621. var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
  4622. var _Object$keys = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
  4623. _Object$defineProperty(exports, "__esModule", {
  4624. value: true
  4625. });
  4626. exports.commitServerChanges = commitServerChanges;
  4627. exports.defaultState = defaultState;
  4628. exports.estimateAttribute = estimateAttribute;
  4629. exports.estimateAttributes = estimateAttributes;
  4630. exports.mergeFirstPendingState = mergeFirstPendingState;
  4631. exports.popPendingState = popPendingState;
  4632. exports.pushPendingState = pushPendingState;
  4633. exports.setPendingOp = setPendingOp;
  4634. exports.setServerData = setServerData;
  4635. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  4636. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  4637. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  4638. var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  4639. var _encode = _interopRequireDefault(_dereq_("./encode"));
  4640. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  4641. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  4642. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  4643. var _TaskQueue = _interopRequireDefault(_dereq_("./TaskQueue"));
  4644. var _ParseOp = _dereq_("./ParseOp");
  4645. function ownKeys(object, enumerableOnly) {
  4646. var keys = _Object$keys(object);
  4647. if (_Object$getOwnPropertySymbols) {
  4648. var symbols = _Object$getOwnPropertySymbols(object);
  4649. enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
  4650. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  4651. })), keys.push.apply(keys, symbols);
  4652. }
  4653. return keys;
  4654. }
  4655. function _objectSpread(target) {
  4656. for (var i = 1; i < arguments.length; i++) {
  4657. var _context, _context2;
  4658. var source = null != arguments[i] ? arguments[i] : {};
  4659. i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) {
  4660. (0, _defineProperty2.default)(target, key, source[key]);
  4661. }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) {
  4662. _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
  4663. });
  4664. }
  4665. return target;
  4666. }
  4667. function defaultState()
  4668. /*: State*/
  4669. {
  4670. return {
  4671. serverData: {},
  4672. pendingOps: [{}],
  4673. objectCache: {},
  4674. tasks: new _TaskQueue.default(),
  4675. existed: false
  4676. };
  4677. }
  4678. function setServerData(serverData
  4679. /*: AttributeMap*/
  4680. , attributes
  4681. /*: AttributeMap*/
  4682. ) {
  4683. for (var _attr in attributes) {
  4684. if (typeof attributes[_attr] !== 'undefined') {
  4685. serverData[_attr] = attributes[_attr];
  4686. } else {
  4687. delete serverData[_attr];
  4688. }
  4689. }
  4690. }
  4691. function setPendingOp(pendingOps
  4692. /*: Array<OpsMap>*/
  4693. , attr
  4694. /*: string*/
  4695. , op
  4696. /*: ?Op*/
  4697. ) {
  4698. var last = pendingOps.length - 1;
  4699. if (op) {
  4700. pendingOps[last][attr] = op;
  4701. } else {
  4702. delete pendingOps[last][attr];
  4703. }
  4704. }
  4705. function pushPendingState(pendingOps
  4706. /*: Array<OpsMap>*/
  4707. ) {
  4708. pendingOps.push({});
  4709. }
  4710. function popPendingState(pendingOps
  4711. /*: Array<OpsMap>*/
  4712. )
  4713. /*: OpsMap*/
  4714. {
  4715. var first = pendingOps.shift();
  4716. if (!pendingOps.length) {
  4717. pendingOps[0] = {};
  4718. }
  4719. return first;
  4720. }
  4721. function mergeFirstPendingState(pendingOps
  4722. /*: Array<OpsMap>*/
  4723. ) {
  4724. var first = popPendingState(pendingOps);
  4725. var next = pendingOps[0];
  4726. for (var _attr2 in first) {
  4727. if (next[_attr2] && first[_attr2]) {
  4728. var merged = next[_attr2].mergeWith(first[_attr2]);
  4729. if (merged) {
  4730. next[_attr2] = merged;
  4731. }
  4732. } else {
  4733. next[_attr2] = first[_attr2];
  4734. }
  4735. }
  4736. }
  4737. function estimateAttribute(serverData
  4738. /*: AttributeMap*/
  4739. , pendingOps
  4740. /*: Array<OpsMap>*/
  4741. , className
  4742. /*: string*/
  4743. , id
  4744. /*: ?string*/
  4745. , attr
  4746. /*: string*/
  4747. )
  4748. /*: mixed*/
  4749. {
  4750. var value = serverData[attr];
  4751. for (var i = 0; i < pendingOps.length; i++) {
  4752. if (pendingOps[i][attr]) {
  4753. if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
  4754. if (id) {
  4755. value = pendingOps[i][attr].applyTo(value, {
  4756. className: className,
  4757. id: id
  4758. }, attr);
  4759. }
  4760. } else {
  4761. value = pendingOps[i][attr].applyTo(value);
  4762. }
  4763. }
  4764. }
  4765. return value;
  4766. }
  4767. function estimateAttributes(serverData
  4768. /*: AttributeMap*/
  4769. , pendingOps
  4770. /*: Array<OpsMap>*/
  4771. , className
  4772. /*: string*/
  4773. , id
  4774. /*: ?string*/
  4775. )
  4776. /*: AttributeMap*/
  4777. {
  4778. var data = {};
  4779. for (var attr in serverData) {
  4780. data[attr] = serverData[attr];
  4781. }
  4782. for (var i = 0; i < pendingOps.length; i++) {
  4783. for (attr in pendingOps[i]) {
  4784. if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
  4785. if (id) {
  4786. data[attr] = pendingOps[i][attr].applyTo(data[attr], {
  4787. className: className,
  4788. id: id
  4789. }, attr);
  4790. }
  4791. } else {
  4792. if ((0, _includes.default)(attr).call(attr, '.')) {
  4793. // convert a.b.c into { a: { b: { c: value } } }
  4794. var fields = attr.split('.');
  4795. var first = fields[0];
  4796. var last = fields[fields.length - 1];
  4797. data[first] = _objectSpread({}, serverData[first]);
  4798. var object = _objectSpread({}, data);
  4799. for (var _i = 0; _i < fields.length - 1; _i++) {
  4800. var key = fields[_i];
  4801. if (!(key in object)) {
  4802. object[key] = {};
  4803. }
  4804. object = object[key];
  4805. }
  4806. object[last] = pendingOps[i][attr].applyTo(object[last]);
  4807. } else {
  4808. data[attr] = pendingOps[i][attr].applyTo(data[attr]);
  4809. }
  4810. }
  4811. }
  4812. }
  4813. return data;
  4814. }
  4815. function nestedSet(obj, key, value) {
  4816. var path = key.split('.');
  4817. for (var i = 0; i < path.length - 1; i++) {
  4818. if (!(path[i] in obj)) obj[path[i]] = {};
  4819. obj = obj[path[i]];
  4820. }
  4821. if (typeof value === 'undefined') {
  4822. delete obj[path[path.length - 1]];
  4823. } else {
  4824. obj[path[path.length - 1]] = value;
  4825. }
  4826. }
  4827. function commitServerChanges(serverData
  4828. /*: AttributeMap*/
  4829. , objectCache
  4830. /*: ObjectCache*/
  4831. , changes
  4832. /*: AttributeMap*/
  4833. ) {
  4834. for (var _attr3 in changes) {
  4835. var val = changes[_attr3];
  4836. nestedSet(serverData, _attr3, val);
  4837. if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof _ParseObject.default) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
  4838. var json = (0, _encode.default)(val, false, true);
  4839. objectCache[_attr3] = (0, _stringify.default)(json);
  4840. }
  4841. }
  4842. }
  4843. },{"./ParseFile":22,"./ParseObject":26,"./ParseOp":27,"./ParseRelation":30,"./TaskQueue":41,"./encode":47,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/includes":66,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/define-properties":82,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":87,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":88,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],16:[function(_dereq_,module,exports){
  4844. "use strict";
  4845. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  4846. var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
  4847. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  4848. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  4849. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
  4850. var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  4851. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  4852. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  4853. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  4854. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  4855. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  4856. var _isInteger = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
  4857. var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
  4858. var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
  4859. var _filter = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter"));
  4860. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  4861. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  4862. function _createForOfIteratorHelper(o, allowArrayLike) {
  4863. var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
  4864. if (!it) {
  4865. if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  4866. if (it) o = it;
  4867. var i = 0;
  4868. var F = function () {};
  4869. return {
  4870. s: F,
  4871. n: function () {
  4872. if (i >= o.length) return {
  4873. done: true
  4874. };
  4875. return {
  4876. done: false,
  4877. value: o[i++]
  4878. };
  4879. },
  4880. e: function (_e) {
  4881. throw _e;
  4882. },
  4883. f: F
  4884. };
  4885. }
  4886. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  4887. }
  4888. var normalCompletion = true,
  4889. didErr = false,
  4890. err;
  4891. return {
  4892. s: function () {
  4893. it = it.call(o);
  4894. },
  4895. n: function () {
  4896. var step = it.next();
  4897. normalCompletion = step.done;
  4898. return step;
  4899. },
  4900. e: function (_e2) {
  4901. didErr = true;
  4902. err = _e2;
  4903. },
  4904. f: function () {
  4905. try {
  4906. if (!normalCompletion && it.return != null) it.return();
  4907. } finally {
  4908. if (didErr) throw err;
  4909. }
  4910. }
  4911. };
  4912. }
  4913. function _unsupportedIterableToArray(o, minLen) {
  4914. var _context6;
  4915. if (!o) return;
  4916. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  4917. var n = _sliceInstanceProperty2(_context6 = Object.prototype.toString.call(o)).call(_context6, 8, -1);
  4918. if (n === "Object" && o.constructor) n = o.constructor.name;
  4919. if (n === "Map" || n === "Set") return _Array$from(o);
  4920. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  4921. }
  4922. function _arrayLikeToArray(arr, len) {
  4923. if (len == null || len > arr.length) len = arr.length;
  4924. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  4925. arr2[i] = arr[i];
  4926. }
  4927. return arr2;
  4928. }
  4929. var equalObjects = _dereq_('./equals').default;
  4930. var decode = _dereq_('./decode').default;
  4931. var ParseError = _dereq_('./ParseError').default;
  4932. var ParsePolygon = _dereq_('./ParsePolygon').default;
  4933. var ParseGeoPoint = _dereq_('./ParseGeoPoint').default;
  4934. /**
  4935. * contains -- Determines if an object is contained in a list with special handling for Parse pointers.
  4936. *
  4937. * @param haystack
  4938. * @param needle
  4939. * @private
  4940. * @returns {boolean}
  4941. */
  4942. function contains(haystack, needle) {
  4943. if (needle && needle.__type && (needle.__type === 'Pointer' || needle.__type === 'Object')) {
  4944. for (var i in haystack) {
  4945. var ptr = haystack[i];
  4946. if (typeof ptr === 'string' && ptr === needle.objectId) {
  4947. return true;
  4948. }
  4949. if (ptr.className === needle.className && ptr.objectId === needle.objectId) {
  4950. return true;
  4951. }
  4952. }
  4953. return false;
  4954. }
  4955. return (0, _indexOf.default)(haystack).call(haystack, needle) > -1;
  4956. }
  4957. function transformObject(object) {
  4958. if (object._toFullJSON) {
  4959. return object._toFullJSON();
  4960. }
  4961. return object;
  4962. }
  4963. /**
  4964. * matchesQuery -- Determines if an object would be returned by a Parse Query
  4965. * It's a lightweight, where-clause only implementation of a full query engine.
  4966. * Since we find queries that match objects, rather than objects that match
  4967. * queries, we can avoid building a full-blown query tool.
  4968. *
  4969. * @param className
  4970. * @param object
  4971. * @param objects
  4972. * @param query
  4973. * @private
  4974. * @returns {boolean}
  4975. */
  4976. function matchesQuery(className, object, objects, query) {
  4977. if (object.className !== className) {
  4978. return false;
  4979. }
  4980. var obj = object;
  4981. var q = query;
  4982. if (object.toJSON) {
  4983. obj = object.toJSON();
  4984. }
  4985. if (query.toJSON) {
  4986. q = query.toJSON().where;
  4987. }
  4988. obj.className = className;
  4989. for (var field in q) {
  4990. if (!matchesKeyConstraints(className, obj, objects, field, q[field])) {
  4991. return false;
  4992. }
  4993. }
  4994. return true;
  4995. }
  4996. function equalObjectsGeneric(obj, compareTo, eqlFn) {
  4997. if ((0, _isArray.default)(obj)) {
  4998. for (var i = 0; i < obj.length; i++) {
  4999. if (eqlFn(obj[i], compareTo)) {
  5000. return true;
  5001. }
  5002. }
  5003. return false;
  5004. }
  5005. return eqlFn(obj, compareTo);
  5006. }
  5007. /**
  5008. * @typedef RelativeTimeToDateResult
  5009. * @property {string} status The conversion status, `error` if conversion failed or
  5010. * `success` if conversion succeeded.
  5011. * @property {string} info The error message if conversion failed, or the relative
  5012. * time indication (`past`, `present`, `future`) if conversion succeeded.
  5013. * @property {Date|undefined} result The converted date, or `undefined` if conversion
  5014. * failed.
  5015. */
  5016. /**
  5017. * Converts human readable relative date string, for example, 'in 10 days' to a date
  5018. * relative to now.
  5019. *
  5020. * @param {string} text The text to convert.
  5021. * @param {Date} [now=new Date()] The date from which add or subtract. Default is now.
  5022. * @returns {RelativeTimeToDateResult}
  5023. */
  5024. function relativeTimeToDate(text) {
  5025. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
  5026. text = text.toLowerCase();
  5027. var parts = text.split(' '); // Filter out whitespace
  5028. parts = (0, _filter.default)(parts).call(parts, function (part) {
  5029. return part !== '';
  5030. });
  5031. var future = parts[0] === 'in';
  5032. var past = parts[parts.length - 1] === 'ago';
  5033. if (!future && !past && text !== 'now') {
  5034. return {
  5035. status: 'error',
  5036. info: "Time should either start with 'in' or end with 'ago'"
  5037. };
  5038. }
  5039. if (future && past) {
  5040. return {
  5041. status: 'error',
  5042. info: "Time cannot have both 'in' and 'ago'"
  5043. };
  5044. } // strip the 'ago' or 'in'
  5045. if (future) {
  5046. parts = (0, _slice.default)(parts).call(parts, 1);
  5047. } else {
  5048. // past
  5049. parts = (0, _slice.default)(parts).call(parts, 0, parts.length - 1);
  5050. }
  5051. if (parts.length % 2 !== 0 && text !== 'now') {
  5052. return {
  5053. status: 'error',
  5054. info: 'Invalid time string. Dangling unit or number.'
  5055. };
  5056. }
  5057. var pairs = [];
  5058. while (parts.length) {
  5059. pairs.push([parts.shift(), parts.shift()]);
  5060. }
  5061. var seconds = 0;
  5062. for (var _i = 0, _pairs = pairs; _i < _pairs.length; _i++) {
  5063. var _pairs$_i = (0, _slicedToArray2.default)(_pairs[_i], 2),
  5064. num = _pairs$_i[0],
  5065. interval = _pairs$_i[1];
  5066. var val = Number(num);
  5067. if (!(0, _isInteger.default)(val)) {
  5068. return {
  5069. status: 'error',
  5070. info: "'".concat(num, "' is not an integer.")
  5071. };
  5072. }
  5073. switch (interval) {
  5074. case 'yr':
  5075. case 'yrs':
  5076. case 'year':
  5077. case 'years':
  5078. seconds += val * 31536000; // 365 * 24 * 60 * 60
  5079. break;
  5080. case 'wk':
  5081. case 'wks':
  5082. case 'week':
  5083. case 'weeks':
  5084. seconds += val * 604800; // 7 * 24 * 60 * 60
  5085. break;
  5086. case 'd':
  5087. case 'day':
  5088. case 'days':
  5089. seconds += val * 86400; // 24 * 60 * 60
  5090. break;
  5091. case 'hr':
  5092. case 'hrs':
  5093. case 'hour':
  5094. case 'hours':
  5095. seconds += val * 3600; // 60 * 60
  5096. break;
  5097. case 'min':
  5098. case 'mins':
  5099. case 'minute':
  5100. case 'minutes':
  5101. seconds += val * 60;
  5102. break;
  5103. case 'sec':
  5104. case 'secs':
  5105. case 'second':
  5106. case 'seconds':
  5107. seconds += val;
  5108. break;
  5109. default:
  5110. return {
  5111. status: 'error',
  5112. info: "Invalid interval: '".concat(interval, "'")
  5113. };
  5114. }
  5115. }
  5116. var milliseconds = seconds * 1000;
  5117. if (future) {
  5118. return {
  5119. status: 'success',
  5120. info: 'future',
  5121. result: new Date(now.valueOf() + milliseconds)
  5122. };
  5123. } else if (past) {
  5124. return {
  5125. status: 'success',
  5126. info: 'past',
  5127. result: new Date(now.valueOf() - milliseconds)
  5128. };
  5129. } else {
  5130. return {
  5131. status: 'success',
  5132. info: 'present',
  5133. result: new Date(now.valueOf())
  5134. };
  5135. }
  5136. }
  5137. /**
  5138. * Determines whether an object matches a single key's constraints
  5139. *
  5140. * @param className
  5141. * @param object
  5142. * @param objects
  5143. * @param key
  5144. * @param constraints
  5145. * @private
  5146. * @returns {boolean}
  5147. */
  5148. function matchesKeyConstraints(className, object, objects, key, constraints) {
  5149. if (constraints === null) {
  5150. return false;
  5151. }
  5152. if ((0, _indexOf.default)(key).call(key, '.') >= 0) {
  5153. // Key references a subobject
  5154. var keyComponents = key.split('.');
  5155. var subObjectKey = keyComponents[0];
  5156. var keyRemainder = (0, _slice.default)(keyComponents).call(keyComponents, 1).join('.');
  5157. return matchesKeyConstraints(className, object[subObjectKey] || {}, objects, keyRemainder, constraints);
  5158. }
  5159. var i;
  5160. if (key === '$or') {
  5161. for (i = 0; i < constraints.length; i++) {
  5162. if (matchesQuery(className, object, objects, constraints[i])) {
  5163. return true;
  5164. }
  5165. }
  5166. return false;
  5167. }
  5168. if (key === '$and') {
  5169. for (i = 0; i < constraints.length; i++) {
  5170. if (!matchesQuery(className, object, objects, constraints[i])) {
  5171. return false;
  5172. }
  5173. }
  5174. return true;
  5175. }
  5176. if (key === '$nor') {
  5177. for (i = 0; i < constraints.length; i++) {
  5178. if (matchesQuery(className, object, objects, constraints[i])) {
  5179. return false;
  5180. }
  5181. }
  5182. return true;
  5183. }
  5184. if (key === '$relatedTo') {
  5185. // Bail! We can't handle relational queries locally
  5186. return false;
  5187. }
  5188. if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(key)) {
  5189. throw new ParseError(ParseError.INVALID_KEY_NAME, "Invalid Key: ".concat(key));
  5190. } // Equality (or Array contains) cases
  5191. if ((0, _typeof2.default)(constraints) !== 'object') {
  5192. if ((0, _isArray.default)(object[key])) {
  5193. var _context;
  5194. return (0, _indexOf.default)(_context = object[key]).call(_context, constraints) > -1;
  5195. }
  5196. return object[key] === constraints;
  5197. }
  5198. var compareTo;
  5199. if (constraints.__type) {
  5200. if (constraints.__type === 'Pointer') {
  5201. return equalObjectsGeneric(object[key], constraints, function (obj, ptr) {
  5202. return typeof obj !== 'undefined' && ptr.className === obj.className && ptr.objectId === obj.objectId;
  5203. });
  5204. }
  5205. return equalObjectsGeneric(decode(object[key]), decode(constraints), equalObjects);
  5206. } // More complex cases
  5207. for (var condition in constraints) {
  5208. compareTo = constraints[condition];
  5209. if (compareTo.__type) {
  5210. compareTo = decode(compareTo);
  5211. } // is it a $relativeTime? convert to date
  5212. if (compareTo['$relativeTime']) {
  5213. var parserResult = relativeTimeToDate(compareTo['$relativeTime']);
  5214. if (parserResult.status !== 'success') {
  5215. var _context2;
  5216. throw new ParseError(ParseError.INVALID_JSON, (0, _concat.default)(_context2 = "bad $relativeTime (".concat(key, ") value. ")).call(_context2, parserResult.info));
  5217. }
  5218. compareTo = parserResult.result;
  5219. } // Compare Date Object or Date String
  5220. if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' && new Date(compareTo) !== 'Invalid Date' && !isNaN(new Date(compareTo))) {
  5221. object[key] = new Date(object[key].iso ? object[key].iso : object[key]);
  5222. }
  5223. switch (condition) {
  5224. case '$lt':
  5225. if (object[key] >= compareTo) {
  5226. return false;
  5227. }
  5228. break;
  5229. case '$lte':
  5230. if (object[key] > compareTo) {
  5231. return false;
  5232. }
  5233. break;
  5234. case '$gt':
  5235. if (object[key] <= compareTo) {
  5236. return false;
  5237. }
  5238. break;
  5239. case '$gte':
  5240. if (object[key] < compareTo) {
  5241. return false;
  5242. }
  5243. break;
  5244. case '$ne':
  5245. if (equalObjects(object[key], compareTo)) {
  5246. return false;
  5247. }
  5248. break;
  5249. case '$in':
  5250. if (!contains(compareTo, object[key])) {
  5251. return false;
  5252. }
  5253. break;
  5254. case '$nin':
  5255. if (contains(compareTo, object[key])) {
  5256. return false;
  5257. }
  5258. break;
  5259. case '$all':
  5260. for (i = 0; i < compareTo.length; i++) {
  5261. var _context3;
  5262. if ((0, _indexOf.default)(_context3 = object[key]).call(_context3, compareTo[i]) < 0) {
  5263. return false;
  5264. }
  5265. }
  5266. break;
  5267. case '$exists':
  5268. {
  5269. var propertyExists = typeof object[key] !== 'undefined';
  5270. var existenceIsRequired = constraints['$exists'];
  5271. if (typeof constraints['$exists'] !== 'boolean') {
  5272. // The SDK will never submit a non-boolean for $exists, but if someone
  5273. // tries to submit a non-boolean for $exits outside the SDKs, just ignore it.
  5274. break;
  5275. }
  5276. if (!propertyExists && existenceIsRequired || propertyExists && !existenceIsRequired) {
  5277. return false;
  5278. }
  5279. break;
  5280. }
  5281. case '$regex':
  5282. {
  5283. if ((0, _typeof2.default)(compareTo) === 'object') {
  5284. return compareTo.test(object[key]);
  5285. } // JS doesn't support perl-style escaping
  5286. var expString = '';
  5287. var escapeEnd = -2;
  5288. var escapeStart = (0, _indexOf.default)(compareTo).call(compareTo, '\\Q');
  5289. while (escapeStart > -1) {
  5290. // Add the unescaped portion
  5291. expString += compareTo.substring(escapeEnd + 2, escapeStart);
  5292. escapeEnd = (0, _indexOf.default)(compareTo).call(compareTo, '\\E', escapeStart);
  5293. if (escapeEnd > -1) {
  5294. expString += compareTo.substring(escapeStart + 2, escapeEnd).replace(/\\\\\\\\E/g, '\\E').replace(/\W/g, '\\$&');
  5295. }
  5296. escapeStart = (0, _indexOf.default)(compareTo).call(compareTo, '\\Q', escapeEnd);
  5297. }
  5298. expString += compareTo.substring(Math.max(escapeStart, escapeEnd + 2));
  5299. var modifiers = constraints.$options || '';
  5300. modifiers = modifiers.replace('x', '').replace('s', ''); // Parse Server / Mongo support x and s modifiers but JS RegExp doesn't
  5301. var exp = new RegExp(expString, modifiers);
  5302. if (!exp.test(object[key])) {
  5303. return false;
  5304. }
  5305. break;
  5306. }
  5307. case '$nearSphere':
  5308. {
  5309. if (!compareTo || !object[key]) {
  5310. return false;
  5311. }
  5312. var distance = compareTo.radiansTo(object[key]);
  5313. var max = constraints.$maxDistance || Infinity;
  5314. return distance <= max;
  5315. }
  5316. case '$within':
  5317. {
  5318. if (!compareTo || !object[key]) {
  5319. return false;
  5320. }
  5321. var southWest = compareTo.$box[0];
  5322. var northEast = compareTo.$box[1];
  5323. if (southWest.latitude > northEast.latitude || southWest.longitude > northEast.longitude) {
  5324. // Invalid box, crosses the date line
  5325. return false;
  5326. }
  5327. return object[key].latitude > southWest.latitude && object[key].latitude < northEast.latitude && object[key].longitude > southWest.longitude && object[key].longitude < northEast.longitude;
  5328. }
  5329. case '$options':
  5330. // Not a query type, but a way to add options to $regex. Ignore and
  5331. // avoid the default
  5332. break;
  5333. case '$maxDistance':
  5334. // Not a query type, but a way to add a cap to $nearSphere. Ignore and
  5335. // avoid the default
  5336. break;
  5337. case '$select':
  5338. {
  5339. var subQueryObjects = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
  5340. return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
  5341. });
  5342. for (var _i2 = 0; _i2 < subQueryObjects.length; _i2 += 1) {
  5343. var subObject = transformObject(subQueryObjects[_i2]);
  5344. return equalObjects(object[key], subObject[compareTo.key]);
  5345. }
  5346. return false;
  5347. }
  5348. case '$dontSelect':
  5349. {
  5350. var _subQueryObjects = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
  5351. return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
  5352. });
  5353. for (var _i3 = 0; _i3 < _subQueryObjects.length; _i3 += 1) {
  5354. var _subObject = transformObject(_subQueryObjects[_i3]);
  5355. return !equalObjects(object[key], _subObject[compareTo.key]);
  5356. }
  5357. return false;
  5358. }
  5359. case '$inQuery':
  5360. {
  5361. var _subQueryObjects2 = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
  5362. return matchesQuery(compareTo.className, obj, arr, compareTo.where);
  5363. });
  5364. for (var _i4 = 0; _i4 < _subQueryObjects2.length; _i4 += 1) {
  5365. var _subObject2 = transformObject(_subQueryObjects2[_i4]);
  5366. if (object[key].className === _subObject2.className && object[key].objectId === _subObject2.objectId) {
  5367. return true;
  5368. }
  5369. }
  5370. return false;
  5371. }
  5372. case '$notInQuery':
  5373. {
  5374. var _subQueryObjects3 = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
  5375. return matchesQuery(compareTo.className, obj, arr, compareTo.where);
  5376. });
  5377. for (var _i5 = 0; _i5 < _subQueryObjects3.length; _i5 += 1) {
  5378. var _subObject3 = transformObject(_subQueryObjects3[_i5]);
  5379. if (object[key].className === _subObject3.className && object[key].objectId === _subObject3.objectId) {
  5380. return false;
  5381. }
  5382. }
  5383. return true;
  5384. }
  5385. case '$containedBy':
  5386. {
  5387. var _iterator = _createForOfIteratorHelper(object[key]),
  5388. _step;
  5389. try {
  5390. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5391. var value = _step.value;
  5392. if (!contains(compareTo, value)) {
  5393. return false;
  5394. }
  5395. }
  5396. } catch (err) {
  5397. _iterator.e(err);
  5398. } finally {
  5399. _iterator.f();
  5400. }
  5401. return true;
  5402. }
  5403. case '$geoWithin':
  5404. {
  5405. if (compareTo.$polygon) {
  5406. var _context4;
  5407. var points = (0, _map.default)(_context4 = compareTo.$polygon).call(_context4, function (geoPoint) {
  5408. return [geoPoint.latitude, geoPoint.longitude];
  5409. });
  5410. var polygon = new ParsePolygon(points);
  5411. return polygon.containsPoint(object[key]);
  5412. }
  5413. if (compareTo.$centerSphere) {
  5414. var _compareTo$$centerSph = (0, _slicedToArray2.default)(compareTo.$centerSphere, 2),
  5415. WGS84Point = _compareTo$$centerSph[0],
  5416. maxDistance = _compareTo$$centerSph[1];
  5417. var centerPoint = new ParseGeoPoint({
  5418. latitude: WGS84Point[1],
  5419. longitude: WGS84Point[0]
  5420. });
  5421. var point = new ParseGeoPoint(object[key]);
  5422. var _distance = point.radiansTo(centerPoint);
  5423. return _distance <= maxDistance;
  5424. }
  5425. break;
  5426. }
  5427. case '$geoIntersects':
  5428. {
  5429. var _polygon = new ParsePolygon(object[key].coordinates);
  5430. var _point = new ParseGeoPoint(compareTo.$point);
  5431. return _polygon.containsPoint(_point);
  5432. }
  5433. default:
  5434. return false;
  5435. }
  5436. }
  5437. return true;
  5438. }
  5439. function validateQuery(query
  5440. /*: any*/
  5441. ) {
  5442. var _context5;
  5443. var q = query;
  5444. if (query.toJSON) {
  5445. q = query.toJSON().where;
  5446. }
  5447. var specialQuerykeys = ['$and', '$or', '$nor', '_rperm', '_wperm', '_perishable_token', '_email_verify_token', '_email_verify_token_expires_at', '_account_lockout_expires_at', '_failed_login_count'];
  5448. (0, _forEach.default)(_context5 = (0, _keys.default)(q)).call(_context5, function (key) {
  5449. if (q && q[key] && q[key].$regex) {
  5450. if (typeof q[key].$options === 'string') {
  5451. if (!q[key].$options.match(/^[imxs]+$/)) {
  5452. throw new ParseError(ParseError.INVALID_QUERY, "Bad $options value for query: ".concat(q[key].$options));
  5453. }
  5454. }
  5455. }
  5456. if ((0, _indexOf.default)(specialQuerykeys).call(specialQuerykeys, key) < 0 && !key.match(/^[a-zA-Z][a-zA-Z0-9_\.]*$/)) {
  5457. throw new ParseError(ParseError.INVALID_KEY_NAME, "Invalid key name: ".concat(key));
  5458. }
  5459. });
  5460. }
  5461. var OfflineQuery = {
  5462. matchesQuery: matchesQuery,
  5463. validateQuery: validateQuery
  5464. };
  5465. module.exports = OfflineQuery;
  5466. },{"./ParseError":21,"./ParseGeoPoint":23,"./ParsePolygon":28,"./decode":46,"./equals":48,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/number/is-integer":79,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/slicedToArray":138,"@babel/runtime-corejs3/helpers/typeof":141}],17:[function(_dereq_,module,exports){
  5467. "use strict";
  5468. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  5469. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  5470. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  5471. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  5472. var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
  5473. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  5474. var _decode = _interopRequireDefault(_dereq_("./decode"));
  5475. var _encode = _interopRequireDefault(_dereq_("./encode"));
  5476. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  5477. var _CryptoController = _interopRequireDefault(_dereq_("./CryptoController"));
  5478. var _EventuallyQueue = _interopRequireDefault(_dereq_("./EventuallyQueue"));
  5479. var _InstallationController = _interopRequireDefault(_dereq_("./InstallationController"));
  5480. var ParseOp = _interopRequireWildcard(_dereq_("./ParseOp"));
  5481. var _RESTController = _interopRequireDefault(_dereq_("./RESTController"));
  5482. function _getRequireWildcardCache(nodeInterop) {
  5483. if (typeof _WeakMap !== "function") return null;
  5484. var cacheBabelInterop = new _WeakMap();
  5485. var cacheNodeInterop = new _WeakMap();
  5486. return (_getRequireWildcardCache = function (nodeInterop) {
  5487. return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
  5488. })(nodeInterop);
  5489. }
  5490. function _interopRequireWildcard(obj, nodeInterop) {
  5491. if (!nodeInterop && obj && obj.__esModule) {
  5492. return obj;
  5493. }
  5494. if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
  5495. return {
  5496. default: obj
  5497. };
  5498. }
  5499. var cache = _getRequireWildcardCache(nodeInterop);
  5500. if (cache && cache.has(obj)) {
  5501. return cache.get(obj);
  5502. }
  5503. var newObj = {};
  5504. for (var key in obj) {
  5505. if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
  5506. var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
  5507. if (desc && (desc.get || desc.set)) {
  5508. _Object$defineProperty(newObj, key, desc);
  5509. } else {
  5510. newObj[key] = obj[key];
  5511. }
  5512. }
  5513. }
  5514. newObj.default = obj;
  5515. if (cache) {
  5516. cache.set(obj, newObj);
  5517. }
  5518. return newObj;
  5519. }
  5520. /**
  5521. * Copyright (c) 2015-present, Parse, LLC.
  5522. * All rights reserved.
  5523. *
  5524. * This source code is licensed under the BSD-style license found in the
  5525. * LICENSE file in the root directory of this source tree. An additional grant
  5526. * of patent rights can be found in the PATENTS file in the same directory.
  5527. */
  5528. /**
  5529. * Contains all Parse API classes and functions.
  5530. *
  5531. * @static
  5532. * @global
  5533. * @class
  5534. * @hideconstructor
  5535. */
  5536. var Parse = {
  5537. /**
  5538. * Call this method first to set up your authentication tokens for Parse.
  5539. *
  5540. * @param {string} applicationId Your Parse Application ID.
  5541. * @param {string} [javaScriptKey] Your Parse JavaScript Key (Not needed for parse-server)
  5542. * @param {string} [masterKey] Your Parse Master Key. (Node.js only!)
  5543. * @static
  5544. */
  5545. initialize: function (applicationId
  5546. /*: string*/
  5547. , javaScriptKey
  5548. /*: string*/
  5549. ) {
  5550. Parse._initialize(applicationId, javaScriptKey);
  5551. },
  5552. _initialize: function (applicationId
  5553. /*: string*/
  5554. , javaScriptKey
  5555. /*: string*/
  5556. , masterKey
  5557. /*: string*/
  5558. ) {
  5559. _CoreManager.default.set('APPLICATION_ID', applicationId);
  5560. _CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
  5561. _CoreManager.default.set('MASTER_KEY', masterKey);
  5562. _CoreManager.default.set('USE_MASTER_KEY', false);
  5563. },
  5564. /**
  5565. * Call this method to set your AsyncStorage engine
  5566. * Starting Parse@1.11, the ParseSDK do not provide a React AsyncStorage as the ReactNative module
  5567. * is not provided at a stable path and changes over versions.
  5568. *
  5569. * @param {AsyncStorage} storage a react native async storage.
  5570. * @static
  5571. */
  5572. setAsyncStorage: function (storage
  5573. /*: any*/
  5574. ) {
  5575. _CoreManager.default.setAsyncStorage(storage);
  5576. },
  5577. /**
  5578. * Call this method to set your LocalDatastoreStorage engine
  5579. * If using React-Native use {@link Parse.setAsyncStorage Parse.setAsyncStorage()}
  5580. *
  5581. * @param {LocalDatastoreController} controller a data storage.
  5582. * @static
  5583. */
  5584. setLocalDatastoreController: function (controller
  5585. /*: any*/
  5586. ) {
  5587. _CoreManager.default.setLocalDatastoreController(controller);
  5588. },
  5589. /**
  5590. * Returns information regarding the current server's health
  5591. *
  5592. * @returns {Promise}
  5593. * @static
  5594. */
  5595. getServerHealth: function () {
  5596. return _CoreManager.default.getRESTController().request('GET', 'health');
  5597. },
  5598. /**
  5599. * @member {string} Parse.applicationId
  5600. * @static
  5601. */
  5602. set applicationId(value) {
  5603. _CoreManager.default.set('APPLICATION_ID', value);
  5604. },
  5605. get applicationId() {
  5606. return _CoreManager.default.get('APPLICATION_ID');
  5607. },
  5608. /**
  5609. * @member {string} Parse.javaScriptKey
  5610. * @static
  5611. */
  5612. set javaScriptKey(value) {
  5613. _CoreManager.default.set('JAVASCRIPT_KEY', value);
  5614. },
  5615. get javaScriptKey() {
  5616. return _CoreManager.default.get('JAVASCRIPT_KEY');
  5617. },
  5618. /**
  5619. * @member {string} Parse.masterKey
  5620. * @static
  5621. */
  5622. set masterKey(value) {
  5623. _CoreManager.default.set('MASTER_KEY', value);
  5624. },
  5625. get masterKey() {
  5626. return _CoreManager.default.get('MASTER_KEY');
  5627. },
  5628. /**
  5629. * @member {string} Parse.serverURL
  5630. * @static
  5631. */
  5632. set serverURL(value) {
  5633. _CoreManager.default.set('SERVER_URL', value);
  5634. },
  5635. get serverURL() {
  5636. return _CoreManager.default.get('SERVER_URL');
  5637. },
  5638. /**
  5639. * @member {string} Parse.serverAuthToken
  5640. * @static
  5641. */
  5642. set serverAuthToken(value) {
  5643. _CoreManager.default.set('SERVER_AUTH_TOKEN', value);
  5644. },
  5645. get serverAuthToken() {
  5646. return _CoreManager.default.get('SERVER_AUTH_TOKEN');
  5647. },
  5648. /**
  5649. * @member {string} Parse.serverAuthType
  5650. * @static
  5651. */
  5652. set serverAuthType(value) {
  5653. _CoreManager.default.set('SERVER_AUTH_TYPE', value);
  5654. },
  5655. get serverAuthType() {
  5656. return _CoreManager.default.get('SERVER_AUTH_TYPE');
  5657. },
  5658. /**
  5659. * @member {string} Parse.liveQueryServerURL
  5660. * @static
  5661. */
  5662. set liveQueryServerURL(value) {
  5663. _CoreManager.default.set('LIVEQUERY_SERVER_URL', value);
  5664. },
  5665. get liveQueryServerURL() {
  5666. return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
  5667. },
  5668. /**
  5669. * @member {string} Parse.encryptedUser
  5670. * @static
  5671. */
  5672. set encryptedUser(value) {
  5673. _CoreManager.default.set('ENCRYPTED_USER', value);
  5674. },
  5675. get encryptedUser() {
  5676. return _CoreManager.default.get('ENCRYPTED_USER');
  5677. },
  5678. /**
  5679. * @member {string} Parse.secret
  5680. * @static
  5681. */
  5682. set secret(value) {
  5683. _CoreManager.default.set('ENCRYPTED_KEY', value);
  5684. },
  5685. get secret() {
  5686. return _CoreManager.default.get('ENCRYPTED_KEY');
  5687. },
  5688. /**
  5689. * @member {boolean} Parse.idempotency
  5690. * @static
  5691. */
  5692. set idempotency(value) {
  5693. _CoreManager.default.set('IDEMPOTENCY', value);
  5694. },
  5695. get idempotency() {
  5696. return _CoreManager.default.get('IDEMPOTENCY');
  5697. },
  5698. /**
  5699. * @member {boolean} Parse.allowCustomObjectId
  5700. * @static
  5701. */
  5702. set allowCustomObjectId(value) {
  5703. _CoreManager.default.set('ALLOW_CUSTOM_OBJECT_ID', value);
  5704. },
  5705. get allowCustomObjectId() {
  5706. return _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
  5707. }
  5708. };
  5709. Parse.ACL = _dereq_('./ParseACL').default;
  5710. Parse.Analytics = _dereq_('./Analytics');
  5711. Parse.AnonymousUtils = _dereq_('./AnonymousUtils').default;
  5712. Parse.Cloud = _dereq_('./Cloud');
  5713. Parse.CLP = _dereq_('./ParseCLP').default;
  5714. Parse.CoreManager = _dereq_('./CoreManager');
  5715. Parse.Config = _dereq_('./ParseConfig').default;
  5716. Parse.Error = _dereq_('./ParseError').default;
  5717. Parse.EventuallyQueue = _EventuallyQueue.default;
  5718. Parse.FacebookUtils = _dereq_('./FacebookUtils').default;
  5719. Parse.File = _dereq_('./ParseFile').default;
  5720. Parse.GeoPoint = _dereq_('./ParseGeoPoint').default;
  5721. Parse.Polygon = _dereq_('./ParsePolygon').default;
  5722. Parse.Installation = _dereq_('./ParseInstallation').default;
  5723. Parse.LocalDatastore = _dereq_('./LocalDatastore');
  5724. Parse.Object = _dereq_('./ParseObject').default;
  5725. Parse.Op = {
  5726. Set: ParseOp.SetOp,
  5727. Unset: ParseOp.UnsetOp,
  5728. Increment: ParseOp.IncrementOp,
  5729. Add: ParseOp.AddOp,
  5730. Remove: ParseOp.RemoveOp,
  5731. AddUnique: ParseOp.AddUniqueOp,
  5732. Relation: ParseOp.RelationOp
  5733. };
  5734. Parse.Push = _dereq_('./Push');
  5735. Parse.Query = _dereq_('./ParseQuery').default;
  5736. Parse.Relation = _dereq_('./ParseRelation').default;
  5737. Parse.Role = _dereq_('./ParseRole').default;
  5738. Parse.Schema = _dereq_('./ParseSchema').default;
  5739. Parse.Session = _dereq_('./ParseSession').default;
  5740. Parse.Storage = _dereq_('./Storage');
  5741. Parse.User = _dereq_('./ParseUser').default;
  5742. Parse.LiveQuery = _dereq_('./ParseLiveQuery').default;
  5743. Parse.LiveQueryClient = _dereq_('./LiveQueryClient').default;
  5744. Parse._request = function () {
  5745. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  5746. args[_key] = arguments[_key];
  5747. }
  5748. return _CoreManager.default.getRESTController().request.apply(null, args);
  5749. };
  5750. Parse._ajax = function () {
  5751. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  5752. args[_key2] = arguments[_key2];
  5753. }
  5754. return _CoreManager.default.getRESTController().ajax.apply(null, args);
  5755. }; // We attempt to match the signatures of the legacy versions of these methods
  5756. Parse._decode = function (_, value) {
  5757. return (0, _decode.default)(value);
  5758. };
  5759. Parse._encode = function (value, _, disallowObjects) {
  5760. return (0, _encode.default)(value, disallowObjects);
  5761. };
  5762. Parse._getInstallationId = function () {
  5763. return _CoreManager.default.getInstallationController().currentInstallationId();
  5764. };
  5765. /**
  5766. * Enable pinning in your application.
  5767. * This must be called after `Parse.initialize` in your application.
  5768. *
  5769. * @param [polling] Allow pinging the server /health endpoint. Default true
  5770. * @param [ms] Milliseconds to ping the server. Default 2000ms
  5771. * @static
  5772. */
  5773. Parse.enableLocalDatastore = function () {
  5774. var polling = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  5775. var ms
  5776. /*: number*/
  5777. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
  5778. if (!Parse.applicationId) {
  5779. console.log("'enableLocalDataStore' must be called after 'initialize'");
  5780. return;
  5781. }
  5782. if (!Parse.LocalDatastore.isEnabled) {
  5783. Parse.LocalDatastore.isEnabled = true;
  5784. if (polling) {
  5785. _EventuallyQueue.default.poll(ms);
  5786. }
  5787. }
  5788. };
  5789. /**
  5790. * Flag that indicates whether Local Datastore is enabled.
  5791. *
  5792. * @static
  5793. * @returns {boolean}
  5794. */
  5795. Parse.isLocalDatastoreEnabled = function () {
  5796. return Parse.LocalDatastore.isEnabled;
  5797. };
  5798. /**
  5799. * Gets all contents from Local Datastore
  5800. *
  5801. * <pre>
  5802. * await Parse.dumpLocalDatastore();
  5803. * </pre>
  5804. *
  5805. * @static
  5806. * @returns {object}
  5807. */
  5808. Parse.dumpLocalDatastore = function () {
  5809. if (!Parse.LocalDatastore.isEnabled) {
  5810. console.log('Parse.enableLocalDatastore() must be called first'); // eslint-disable-line no-console
  5811. return _promise.default.resolve({});
  5812. } else {
  5813. return Parse.LocalDatastore._getAllContents();
  5814. }
  5815. };
  5816. /**
  5817. * Enable the current user encryption.
  5818. * This must be called before login any user.
  5819. *
  5820. * @static
  5821. */
  5822. Parse.enableEncryptedUser = function () {
  5823. Parse.encryptedUser = true;
  5824. };
  5825. /**
  5826. * Flag that indicates whether Encrypted User is enabled.
  5827. *
  5828. * @static
  5829. * @returns {boolean}
  5830. */
  5831. Parse.isEncryptedUserEnabled = function () {
  5832. return Parse.encryptedUser;
  5833. };
  5834. _CoreManager.default.setCryptoController(_CryptoController.default);
  5835. _CoreManager.default.setInstallationController(_InstallationController.default);
  5836. _CoreManager.default.setRESTController(_RESTController.default);
  5837. // For legacy requires, of the form `var Parse = require('parse').Parse`
  5838. Parse.Parse = Parse;
  5839. module.exports = Parse;
  5840. },{"./Analytics":1,"./AnonymousUtils":2,"./Cloud":3,"./CoreManager":4,"./CryptoController":5,"./EventuallyQueue":7,"./FacebookUtils":8,"./InstallationController":9,"./LiveQueryClient":10,"./LocalDatastore":12,"./ParseACL":18,"./ParseCLP":19,"./ParseConfig":20,"./ParseError":21,"./ParseFile":22,"./ParseGeoPoint":23,"./ParseInstallation":24,"./ParseLiveQuery":25,"./ParseObject":26,"./ParseOp":27,"./ParsePolygon":28,"./ParseQuery":29,"./ParseRelation":30,"./ParseRole":31,"./ParseSchema":32,"./ParseSession":33,"./ParseUser":34,"./Push":35,"./RESTController":36,"./Storage":39,"./decode":46,"./encode":47,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/weak-map":99,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],18:[function(_dereq_,module,exports){
  5841. "use strict";
  5842. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  5843. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  5844. _Object$defineProperty(exports, "__esModule", {
  5845. value: true
  5846. });
  5847. exports.default = void 0;
  5848. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  5849. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  5850. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  5851. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  5852. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  5853. var _ParseRole = _interopRequireDefault(_dereq_("./ParseRole"));
  5854. var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
  5855. /**
  5856. * Copyright (c) 2015-present, Parse, LLC.
  5857. * All rights reserved.
  5858. *
  5859. * This source code is licensed under the BSD-style license found in the
  5860. * LICENSE file in the root directory of this source tree. An additional grant
  5861. * of patent rights can be found in the PATENTS file in the same directory.
  5862. *
  5863. * @flow
  5864. */
  5865. var PUBLIC_KEY = '*';
  5866. /**
  5867. * Creates a new ACL.
  5868. * If no argument is given, the ACL has no permissions for anyone.
  5869. * If the argument is a Parse.User, the ACL will have read and write
  5870. * permission for only that user.
  5871. * If the argument is any other JSON object, that object will be interpretted
  5872. * as a serialized ACL created with toJSON().
  5873. *
  5874. * <p>An ACL, or Access Control List can be added to any
  5875. * <code>Parse.Object</code> to restrict access to only a subset of users
  5876. * of your application.</p>
  5877. *
  5878. * @alias Parse.ACL
  5879. */
  5880. var ParseACL = /*#__PURE__*/function () {
  5881. /**
  5882. * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
  5883. */
  5884. function ParseACL(arg1
  5885. /*: ParseUser | ByIdMap*/
  5886. ) {
  5887. (0, _classCallCheck2.default)(this, ParseACL);
  5888. (0, _defineProperty2.default)(this, "permissionsById", void 0);
  5889. this.permissionsById = {};
  5890. if (arg1 && (0, _typeof2.default)(arg1) === 'object') {
  5891. if (arg1 instanceof _ParseUser.default) {
  5892. this.setReadAccess(arg1, true);
  5893. this.setWriteAccess(arg1, true);
  5894. } else {
  5895. for (var _userId in arg1) {
  5896. var accessList = arg1[_userId];
  5897. this.permissionsById[_userId] = {};
  5898. for (var _permission in accessList) {
  5899. var allowed = accessList[_permission];
  5900. if (_permission !== 'read' && _permission !== 'write') {
  5901. throw new TypeError('Tried to create an ACL with an invalid permission type.');
  5902. }
  5903. if (typeof allowed !== 'boolean') {
  5904. throw new TypeError('Tried to create an ACL with an invalid permission value.');
  5905. }
  5906. this.permissionsById[_userId][_permission] = allowed;
  5907. }
  5908. }
  5909. }
  5910. } else if (typeof arg1 === 'function') {
  5911. throw new TypeError('ParseACL constructed with a function. Did you forget ()?');
  5912. }
  5913. }
  5914. /**
  5915. * Returns a JSON-encoded version of the ACL.
  5916. *
  5917. * @returns {object}
  5918. */
  5919. (0, _createClass2.default)(ParseACL, [{
  5920. key: "toJSON",
  5921. value: function ()
  5922. /*: ByIdMap*/
  5923. {
  5924. var permissions = {};
  5925. for (var p in this.permissionsById) {
  5926. permissions[p] = this.permissionsById[p];
  5927. }
  5928. return permissions;
  5929. }
  5930. /**
  5931. * Returns whether this ACL is equal to another object
  5932. *
  5933. * @param {ParseACL} other The other object's ACL to compare to
  5934. * @returns {boolean}
  5935. */
  5936. }, {
  5937. key: "equals",
  5938. value: function (other
  5939. /*: ParseACL*/
  5940. )
  5941. /*: boolean*/
  5942. {
  5943. if (!(other instanceof ParseACL)) {
  5944. return false;
  5945. }
  5946. var users = (0, _keys.default)(this.permissionsById);
  5947. var otherUsers = (0, _keys.default)(other.permissionsById);
  5948. if (users.length !== otherUsers.length) {
  5949. return false;
  5950. }
  5951. for (var u in this.permissionsById) {
  5952. if (!other.permissionsById[u]) {
  5953. return false;
  5954. }
  5955. if (this.permissionsById[u].read !== other.permissionsById[u].read) {
  5956. return false;
  5957. }
  5958. if (this.permissionsById[u].write !== other.permissionsById[u].write) {
  5959. return false;
  5960. }
  5961. }
  5962. return true;
  5963. }
  5964. }, {
  5965. key: "_setAccess",
  5966. value: function (accessType
  5967. /*: string*/
  5968. , userId
  5969. /*: ParseUser | ParseRole | string*/
  5970. , allowed
  5971. /*: boolean*/
  5972. ) {
  5973. if (userId instanceof _ParseUser.default) {
  5974. userId = userId.id;
  5975. } else if (userId instanceof _ParseRole.default) {
  5976. var name = userId.getName();
  5977. if (!name) {
  5978. throw new TypeError('Role must have a name');
  5979. }
  5980. userId = 'role:' + name;
  5981. }
  5982. if (typeof userId !== 'string') {
  5983. throw new TypeError('userId must be a string.');
  5984. }
  5985. if (typeof allowed !== 'boolean') {
  5986. throw new TypeError('allowed must be either true or false.');
  5987. }
  5988. var permissions = this.permissionsById[userId];
  5989. if (!permissions) {
  5990. if (!allowed) {
  5991. // The user already doesn't have this permission, so no action is needed
  5992. return;
  5993. } else {
  5994. permissions = {};
  5995. this.permissionsById[userId] = permissions;
  5996. }
  5997. }
  5998. if (allowed) {
  5999. this.permissionsById[userId][accessType] = true;
  6000. } else {
  6001. delete permissions[accessType];
  6002. if ((0, _keys.default)(permissions).length === 0) {
  6003. delete this.permissionsById[userId];
  6004. }
  6005. }
  6006. }
  6007. }, {
  6008. key: "_getAccess",
  6009. value: function (accessType
  6010. /*: string*/
  6011. , userId
  6012. /*: ParseUser | ParseRole | string*/
  6013. )
  6014. /*: boolean*/
  6015. {
  6016. if (userId instanceof _ParseUser.default) {
  6017. userId = userId.id;
  6018. if (!userId) {
  6019. throw new Error('Cannot get access for a ParseUser without an ID');
  6020. }
  6021. } else if (userId instanceof _ParseRole.default) {
  6022. var name = userId.getName();
  6023. if (!name) {
  6024. throw new TypeError('Role must have a name');
  6025. }
  6026. userId = 'role:' + name;
  6027. }
  6028. var permissions = this.permissionsById[userId];
  6029. if (!permissions) {
  6030. return false;
  6031. }
  6032. return !!permissions[accessType];
  6033. }
  6034. /**
  6035. * Sets whether the given user is allowed to read this object.
  6036. *
  6037. * @param userId An instance of Parse.User or its objectId.
  6038. * @param {boolean} allowed Whether that user should have read access.
  6039. */
  6040. }, {
  6041. key: "setReadAccess",
  6042. value: function (userId
  6043. /*: ParseUser | ParseRole | string*/
  6044. , allowed
  6045. /*: boolean*/
  6046. ) {
  6047. this._setAccess('read', userId, allowed);
  6048. }
  6049. /**
  6050. * Get whether the given user id is *explicitly* allowed to read this object.
  6051. * Even if this returns false, the user may still be able to access it if
  6052. * getPublicReadAccess returns true or a role that the user belongs to has
  6053. * write access.
  6054. *
  6055. * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
  6056. * @returns {boolean}
  6057. */
  6058. }, {
  6059. key: "getReadAccess",
  6060. value: function (userId
  6061. /*: ParseUser | ParseRole | string*/
  6062. )
  6063. /*: boolean*/
  6064. {
  6065. return this._getAccess('read', userId);
  6066. }
  6067. /**
  6068. * Sets whether the given user id is allowed to write this object.
  6069. *
  6070. * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
  6071. * @param {boolean} allowed Whether that user should have write access.
  6072. */
  6073. }, {
  6074. key: "setWriteAccess",
  6075. value: function (userId
  6076. /*: ParseUser | ParseRole | string*/
  6077. , allowed
  6078. /*: boolean*/
  6079. ) {
  6080. this._setAccess('write', userId, allowed);
  6081. }
  6082. /**
  6083. * Gets whether the given user id is *explicitly* allowed to write this object.
  6084. * Even if this returns false, the user may still be able to write it if
  6085. * getPublicWriteAccess returns true or a role that the user belongs to has
  6086. * write access.
  6087. *
  6088. * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
  6089. * @returns {boolean}
  6090. */
  6091. }, {
  6092. key: "getWriteAccess",
  6093. value: function (userId
  6094. /*: ParseUser | ParseRole | string*/
  6095. )
  6096. /*: boolean*/
  6097. {
  6098. return this._getAccess('write', userId);
  6099. }
  6100. /**
  6101. * Sets whether the public is allowed to read this object.
  6102. *
  6103. * @param {boolean} allowed
  6104. */
  6105. }, {
  6106. key: "setPublicReadAccess",
  6107. value: function (allowed
  6108. /*: boolean*/
  6109. ) {
  6110. this.setReadAccess(PUBLIC_KEY, allowed);
  6111. }
  6112. /**
  6113. * Gets whether the public is allowed to read this object.
  6114. *
  6115. * @returns {boolean}
  6116. */
  6117. }, {
  6118. key: "getPublicReadAccess",
  6119. value: function ()
  6120. /*: boolean*/
  6121. {
  6122. return this.getReadAccess(PUBLIC_KEY);
  6123. }
  6124. /**
  6125. * Sets whether the public is allowed to write this object.
  6126. *
  6127. * @param {boolean} allowed
  6128. */
  6129. }, {
  6130. key: "setPublicWriteAccess",
  6131. value: function (allowed
  6132. /*: boolean*/
  6133. ) {
  6134. this.setWriteAccess(PUBLIC_KEY, allowed);
  6135. }
  6136. /**
  6137. * Gets whether the public is allowed to write this object.
  6138. *
  6139. * @returns {boolean}
  6140. */
  6141. }, {
  6142. key: "getPublicWriteAccess",
  6143. value: function ()
  6144. /*: boolean*/
  6145. {
  6146. return this.getWriteAccess(PUBLIC_KEY);
  6147. }
  6148. /**
  6149. * Gets whether users belonging to the given role are allowed
  6150. * to read this object. Even if this returns false, the role may
  6151. * still be able to write it if a parent role has read access.
  6152. *
  6153. * @param role The name of the role, or a Parse.Role object.
  6154. * @returns {boolean} true if the role has read access. false otherwise.
  6155. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  6156. */
  6157. }, {
  6158. key: "getRoleReadAccess",
  6159. value: function (role
  6160. /*: ParseRole | string*/
  6161. )
  6162. /*: boolean*/
  6163. {
  6164. if (role instanceof _ParseRole.default) {
  6165. // Normalize to the String name
  6166. role = role.getName();
  6167. }
  6168. if (typeof role !== 'string') {
  6169. throw new TypeError('role must be a ParseRole or a String');
  6170. }
  6171. return this.getReadAccess('role:' + role);
  6172. }
  6173. /**
  6174. * Gets whether users belonging to the given role are allowed
  6175. * to write this object. Even if this returns false, the role may
  6176. * still be able to write it if a parent role has write access.
  6177. *
  6178. * @param role The name of the role, or a Parse.Role object.
  6179. * @returns {boolean} true if the role has write access. false otherwise.
  6180. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  6181. */
  6182. }, {
  6183. key: "getRoleWriteAccess",
  6184. value: function (role
  6185. /*: ParseRole | string*/
  6186. )
  6187. /*: boolean*/
  6188. {
  6189. if (role instanceof _ParseRole.default) {
  6190. // Normalize to the String name
  6191. role = role.getName();
  6192. }
  6193. if (typeof role !== 'string') {
  6194. throw new TypeError('role must be a ParseRole or a String');
  6195. }
  6196. return this.getWriteAccess('role:' + role);
  6197. }
  6198. /**
  6199. * Sets whether users belonging to the given role are allowed
  6200. * to read this object.
  6201. *
  6202. * @param role The name of the role, or a Parse.Role object.
  6203. * @param {boolean} allowed Whether the given role can read this object.
  6204. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  6205. */
  6206. }, {
  6207. key: "setRoleReadAccess",
  6208. value: function (role
  6209. /*: ParseRole | string*/
  6210. , allowed
  6211. /*: boolean*/
  6212. ) {
  6213. if (role instanceof _ParseRole.default) {
  6214. // Normalize to the String name
  6215. role = role.getName();
  6216. }
  6217. if (typeof role !== 'string') {
  6218. throw new TypeError('role must be a ParseRole or a String');
  6219. }
  6220. this.setReadAccess('role:' + role, allowed);
  6221. }
  6222. /**
  6223. * Sets whether users belonging to the given role are allowed
  6224. * to write this object.
  6225. *
  6226. * @param role The name of the role, or a Parse.Role object.
  6227. * @param {boolean} allowed Whether the given role can write this object.
  6228. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  6229. */
  6230. }, {
  6231. key: "setRoleWriteAccess",
  6232. value: function (role
  6233. /*: ParseRole | string*/
  6234. , allowed
  6235. /*: boolean*/
  6236. ) {
  6237. if (role instanceof _ParseRole.default) {
  6238. // Normalize to the String name
  6239. role = role.getName();
  6240. }
  6241. if (typeof role !== 'string') {
  6242. throw new TypeError('role must be a ParseRole or a String');
  6243. }
  6244. this.setWriteAccess('role:' + role, allowed);
  6245. }
  6246. }]);
  6247. return ParseACL;
  6248. }();
  6249. var _default = ParseACL;
  6250. exports.default = _default;
  6251. },{"./ParseRole":31,"./ParseUser":34,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],19:[function(_dereq_,module,exports){
  6252. "use strict";
  6253. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  6254. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  6255. var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
  6256. var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
  6257. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  6258. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  6259. var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
  6260. var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
  6261. var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
  6262. var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
  6263. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  6264. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  6265. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
  6266. var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  6267. _Object$defineProperty(exports, "__esModule", {
  6268. value: true
  6269. });
  6270. exports.default = void 0;
  6271. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  6272. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  6273. var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
  6274. var _assign = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/assign"));
  6275. var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
  6276. var _entries = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/entries"));
  6277. var _every = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/every"));
  6278. var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  6279. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  6280. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  6281. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  6282. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  6283. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/map"));
  6284. var _ParseRole = _interopRequireDefault(_dereq_("./ParseRole"));
  6285. var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
  6286. function ownKeys(object, enumerableOnly) {
  6287. var keys = _Object$keys2(object);
  6288. if (_Object$getOwnPropertySymbols) {
  6289. var symbols = _Object$getOwnPropertySymbols(object);
  6290. enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
  6291. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  6292. })), keys.push.apply(keys, symbols);
  6293. }
  6294. return keys;
  6295. }
  6296. function _objectSpread(target) {
  6297. for (var i = 1; i < arguments.length; i++) {
  6298. var _context3, _context4;
  6299. var source = null != arguments[i] ? arguments[i] : {};
  6300. i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) {
  6301. (0, _defineProperty2.default)(target, key, source[key]);
  6302. }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) {
  6303. _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
  6304. });
  6305. }
  6306. return target;
  6307. }
  6308. function _createForOfIteratorHelper(o, allowArrayLike) {
  6309. var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
  6310. if (!it) {
  6311. if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  6312. if (it) o = it;
  6313. var i = 0;
  6314. var F = function () {};
  6315. return {
  6316. s: F,
  6317. n: function () {
  6318. if (i >= o.length) return {
  6319. done: true
  6320. };
  6321. return {
  6322. done: false,
  6323. value: o[i++]
  6324. };
  6325. },
  6326. e: function (_e) {
  6327. throw _e;
  6328. },
  6329. f: F
  6330. };
  6331. }
  6332. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  6333. }
  6334. var normalCompletion = true,
  6335. didErr = false,
  6336. err;
  6337. return {
  6338. s: function () {
  6339. it = it.call(o);
  6340. },
  6341. n: function () {
  6342. var step = it.next();
  6343. normalCompletion = step.done;
  6344. return step;
  6345. },
  6346. e: function (_e2) {
  6347. didErr = true;
  6348. err = _e2;
  6349. },
  6350. f: function () {
  6351. try {
  6352. if (!normalCompletion && it.return != null) it.return();
  6353. } finally {
  6354. if (didErr) throw err;
  6355. }
  6356. }
  6357. };
  6358. }
  6359. function _unsupportedIterableToArray(o, minLen) {
  6360. var _context2;
  6361. if (!o) return;
  6362. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  6363. var n = _sliceInstanceProperty2(_context2 = Object.prototype.toString.call(o)).call(_context2, 8, -1);
  6364. if (n === "Object" && o.constructor) n = o.constructor.name;
  6365. if (n === "Map" || n === "Set") return _Array$from(o);
  6366. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  6367. }
  6368. function _arrayLikeToArray(arr, len) {
  6369. if (len == null || len > arr.length) len = arr.length;
  6370. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  6371. arr2[i] = arr[i];
  6372. }
  6373. return arr2;
  6374. }
  6375. var PUBLIC_KEY = '*';
  6376. var VALID_PERMISSIONS
  6377. /*: Map<string, UsersMap>*/
  6378. = new _map.default();
  6379. VALID_PERMISSIONS.set('get', {});
  6380. VALID_PERMISSIONS.set('find', {});
  6381. VALID_PERMISSIONS.set('count', {});
  6382. VALID_PERMISSIONS.set('create', {});
  6383. VALID_PERMISSIONS.set('update', {});
  6384. VALID_PERMISSIONS.set('delete', {});
  6385. VALID_PERMISSIONS.set('addField', {});
  6386. var VALID_PERMISSIONS_EXTENDED
  6387. /*: Map<string, UsersMap>*/
  6388. = new _map.default();
  6389. VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
  6390. /**
  6391. * Creates a new CLP.
  6392. * If no argument is given, the CLP has no permissions for anyone.
  6393. * If the argument is a Parse.User or Parse.Role, the CLP will have read and write
  6394. * permission for only that user or role.
  6395. * If the argument is any other JSON object, that object will be interpretted
  6396. * as a serialized CLP created with toJSON().
  6397. *
  6398. * <p>A CLP, or Class Level Permissions can be added to any
  6399. * <code>Parse.Schema</code> to restrict access to only a subset of users
  6400. * of your application.</p>
  6401. *
  6402. * <p>
  6403. * For get/count/find/create/update/delete/addField using the following functions:
  6404. *
  6405. * Entity is type Parse.User or Parse.Role or string
  6406. * Role is type Parse.Role or Name of Parse.Role
  6407. *
  6408. * getGetRequiresAuthentication()
  6409. * setGetRequiresAuthentication(allowed: boolean)
  6410. * getGetPointerFields()
  6411. * setGetPointerFields(pointerFields: string[])
  6412. * getGetAccess(entity: Entity)
  6413. * setGetAccess(entity: Entity, allowed: boolean)
  6414. * getPublicGetAccess()
  6415. * setPublicGetAccess(allowed: boolean)
  6416. * getRoleGetAccess(role: Role)
  6417. * setRoleGetAccess(role: Role, allowed: boolean)
  6418. * getFindRequiresAuthentication()
  6419. * setFindRequiresAuthentication(allowed: boolean)
  6420. * getFindPointerFields()
  6421. * setFindPointerFields(pointerFields: string[])
  6422. * getFindAccess(entity: Entity)
  6423. * setFindAccess(entity: Entity, allowed: boolean)
  6424. * getPublicFindAccess()
  6425. * setPublicFindAccess(allowed: boolean)
  6426. * getRoleFindAccess(role: Role)
  6427. * setRoleFindAccess(role: Role, allowed: boolean)
  6428. * getCountRequiresAuthentication()
  6429. * setCountRequiresAuthentication(allowed: boolean)
  6430. * getCountPointerFields()
  6431. * setCountPointerFields(pointerFields: string[])
  6432. * getCountAccess(entity: Entity)
  6433. * setCountAccess(entity: Entity, allowed: boolean)
  6434. * getPublicCountAccess()
  6435. * setPublicCountAccess(allowed: boolean)
  6436. * getRoleCountAccess(role: Role)
  6437. * setRoleCountAccess(role: Role, allowed: boolean)
  6438. * getCreateRequiresAuthentication()
  6439. * setCreateRequiresAuthentication(allowed: boolean)
  6440. * getCreatePointerFields()
  6441. * setCreatePointerFields(pointerFields: string[])
  6442. * getCreateAccess(entity: Entity)
  6443. * setCreateAccess(entity: Entity, allowed: boolean)
  6444. * getPublicCreateAccess()
  6445. * setPublicCreateAccess(allowed: Boolean)
  6446. * getRoleCreateAccess(role: Role)
  6447. * setRoleCreateAccess(role: Role, allowed: boolean)
  6448. * getUpdateRequiresAuthentication()
  6449. * setUpdateRequiresAuthentication(allowed: boolean)
  6450. * getUpdatePointerFields()
  6451. * setUpdatePointerFields(pointerFields: string[])
  6452. * getUpdateAccess(entity: Entity)
  6453. * setUpdateAccess(entity: Entity, allowed: boolean)
  6454. * getPublicUpdateAccess()
  6455. * setPublicUpdateAccess(allowed: boolean)
  6456. * getRoleUpdateAccess(role: Role)
  6457. * setRoleUpdateAccess(role: Role, allowed: boolean)
  6458. * getDeleteRequiresAuthentication()
  6459. * setDeleteRequiresAuthentication(allowed: boolean)
  6460. * getDeletePointerFields()
  6461. * setDeletePointerFields(pointerFields: string[])
  6462. * getDeleteAccess(entity: Entity)
  6463. * setDeleteAccess(entity: Entity, allowed: boolean)
  6464. * getPublicDeleteAccess()
  6465. * setPublicDeleteAccess(allowed: boolean)
  6466. * getRoleDeleteAccess(role: Role)
  6467. * setRoleDeleteAccess(role: Role, allowed: boolean)
  6468. * getAddFieldRequiresAuthentication()
  6469. * setAddFieldRequiresAuthentication(allowed: boolean)
  6470. * getAddFieldPointerFields()
  6471. * setAddFieldPointerFields(pointerFields: string[])
  6472. * getAddFieldAccess(entity: Entity)
  6473. * setAddFieldAccess(entity: Entity, allowed: boolean)
  6474. * getPublicAddFieldAccess()
  6475. * setPublicAddFieldAccess(allowed: boolean)
  6476. * getRoleAddFieldAccess(role: Role)
  6477. * setRoleAddFieldAccess(role: Role, allowed: boolean)
  6478. * </p>
  6479. *
  6480. * @alias Parse.CLP
  6481. */
  6482. var ParseCLP = /*#__PURE__*/function () {
  6483. /**
  6484. * @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
  6485. */
  6486. function ParseCLP(userId
  6487. /*: ParseUser | ParseRole | PermissionsMap*/
  6488. ) {
  6489. var _this = this;
  6490. (0, _classCallCheck2.default)(this, ParseCLP);
  6491. (0, _defineProperty2.default)(this, "permissionsMap", void 0);
  6492. this.permissionsMap = {}; // Initialize permissions Map with default permissions
  6493. var _iterator = _createForOfIteratorHelper((0, _entries.default)(VALID_PERMISSIONS).call(VALID_PERMISSIONS)),
  6494. _step;
  6495. try {
  6496. var _loop = function _loop() {
  6497. var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
  6498. operation = _step$value[0],
  6499. group = _step$value[1];
  6500. _this.permissionsMap[operation] = (0, _assign.default)({}, group);
  6501. var action = operation.charAt(0).toUpperCase() + (0, _slice.default)(operation).call(operation, 1);
  6502. _this["get".concat(action, "RequiresAuthentication")] = function () {
  6503. return this._getAccess(operation, 'requiresAuthentication');
  6504. };
  6505. _this["set".concat(action, "RequiresAuthentication")] = function (allowed) {
  6506. this._setAccess(operation, 'requiresAuthentication', allowed);
  6507. };
  6508. _this["get".concat(action, "PointerFields")] = function () {
  6509. return this._getAccess(operation, 'pointerFields', false);
  6510. };
  6511. _this["set".concat(action, "PointerFields")] = function (pointerFields) {
  6512. this._setArrayAccess(operation, 'pointerFields', pointerFields);
  6513. };
  6514. _this["get".concat(action, "Access")] = function (entity) {
  6515. return this._getAccess(operation, entity);
  6516. };
  6517. _this["set".concat(action, "Access")] = function (entity, allowed) {
  6518. this._setAccess(operation, entity, allowed);
  6519. };
  6520. _this["getPublic".concat(action, "Access")] = function () {
  6521. return this["get".concat(action, "Access")](PUBLIC_KEY);
  6522. };
  6523. _this["setPublic".concat(action, "Access")] = function (allowed) {
  6524. this["set".concat(action, "Access")](PUBLIC_KEY, allowed);
  6525. };
  6526. _this["getRole".concat(action, "Access")] = function (role) {
  6527. return this["get".concat(action, "Access")](this._getRoleName(role));
  6528. };
  6529. _this["setRole".concat(action, "Access")] = function (role, allowed) {
  6530. this["set".concat(action, "Access")](this._getRoleName(role), allowed);
  6531. };
  6532. };
  6533. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  6534. _loop();
  6535. } // Initialize permissions Map with default extended permissions
  6536. } catch (err) {
  6537. _iterator.e(err);
  6538. } finally {
  6539. _iterator.f();
  6540. }
  6541. var _iterator2 = _createForOfIteratorHelper((0, _entries.default)(VALID_PERMISSIONS_EXTENDED).call(VALID_PERMISSIONS_EXTENDED)),
  6542. _step2;
  6543. try {
  6544. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  6545. var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
  6546. operation = _step2$value[0],
  6547. group = _step2$value[1];
  6548. this.permissionsMap[operation] = (0, _assign.default)({}, group);
  6549. }
  6550. } catch (err) {
  6551. _iterator2.e(err);
  6552. } finally {
  6553. _iterator2.f();
  6554. }
  6555. if (userId && (0, _typeof2.default)(userId) === 'object') {
  6556. if (userId instanceof _ParseUser.default) {
  6557. this.setReadAccess(userId, true);
  6558. this.setWriteAccess(userId, true);
  6559. } else if (userId instanceof _ParseRole.default) {
  6560. this.setRoleReadAccess(userId, true);
  6561. this.setRoleWriteAccess(userId, true);
  6562. } else {
  6563. for (var _permission in userId) {
  6564. var _context;
  6565. var users = userId[_permission];
  6566. var isValidPermission = !!VALID_PERMISSIONS.get(_permission);
  6567. var isValidPermissionExtended = !!VALID_PERMISSIONS_EXTENDED.get(_permission);
  6568. var isValidGroupPermission = (0, _includes.default)(_context = ['readUserFields', 'writeUserFields']).call(_context, _permission);
  6569. if (typeof _permission !== 'string' || !(isValidPermission || isValidPermissionExtended || isValidGroupPermission)) {
  6570. throw new TypeError('Tried to create an CLP with an invalid permission type.');
  6571. }
  6572. if (isValidGroupPermission) {
  6573. if ((0, _every.default)(users).call(users, function (pointer) {
  6574. return typeof pointer === 'string';
  6575. })) {
  6576. this.permissionsMap[_permission] = users;
  6577. continue;
  6578. } else {
  6579. throw new TypeError('Tried to create an CLP with an invalid permission value.');
  6580. }
  6581. }
  6582. for (var user in users) {
  6583. var allowed = users[user];
  6584. if (typeof allowed !== 'boolean' && !isValidPermissionExtended && user !== 'pointerFields') {
  6585. throw new TypeError('Tried to create an CLP with an invalid permission value.');
  6586. }
  6587. this.permissionsMap[_permission][user] = allowed;
  6588. }
  6589. }
  6590. }
  6591. } else if (typeof userId === 'function') {
  6592. throw new TypeError('ParseCLP constructed with a function. Did you forget ()?');
  6593. }
  6594. }
  6595. /**
  6596. * Returns a JSON-encoded version of the CLP.
  6597. *
  6598. * @returns {object}
  6599. */
  6600. (0, _createClass2.default)(ParseCLP, [{
  6601. key: "toJSON",
  6602. value: function toJSON()
  6603. /*: PermissionsMap*/
  6604. {
  6605. return _objectSpread({}, this.permissionsMap);
  6606. }
  6607. /**
  6608. * Returns whether this CLP is equal to another object
  6609. *
  6610. * @param other The other object to compare to
  6611. * @returns {boolean}
  6612. */
  6613. }, {
  6614. key: "equals",
  6615. value: function equals(other
  6616. /*: ParseCLP*/
  6617. )
  6618. /*: boolean*/
  6619. {
  6620. if (!(other instanceof ParseCLP)) {
  6621. return false;
  6622. }
  6623. var permissions = (0, _keys.default)(this.permissionsMap);
  6624. var otherPermissions = (0, _keys.default)(other.permissionsMap);
  6625. if (permissions.length !== otherPermissions.length) {
  6626. return false;
  6627. }
  6628. for (var _permission2 in this.permissionsMap) {
  6629. if (!other.permissionsMap[_permission2]) {
  6630. return false;
  6631. }
  6632. var users = (0, _keys.default)(this.permissionsMap[_permission2]);
  6633. var otherUsers = (0, _keys.default)(other.permissionsMap[_permission2]);
  6634. if (users.length !== otherUsers.length) {
  6635. return false;
  6636. }
  6637. for (var user in this.permissionsMap[_permission2]) {
  6638. if (!other.permissionsMap[_permission2][user]) {
  6639. return false;
  6640. }
  6641. if (this.permissionsMap[_permission2][user] !== other.permissionsMap[_permission2][user]) {
  6642. return false;
  6643. }
  6644. }
  6645. }
  6646. return true;
  6647. }
  6648. }, {
  6649. key: "_getRoleName",
  6650. value: function _getRoleName(role
  6651. /*: ParseRole | string*/
  6652. )
  6653. /*: string*/
  6654. {
  6655. var name = role;
  6656. if (role instanceof _ParseRole.default) {
  6657. // Normalize to the String name
  6658. name = role.getName();
  6659. }
  6660. if (typeof name !== 'string') {
  6661. throw new TypeError('role must be a Parse.Role or a String');
  6662. }
  6663. return "role:".concat(name);
  6664. }
  6665. }, {
  6666. key: "_parseEntity",
  6667. value: function _parseEntity(entity
  6668. /*: Entity*/
  6669. ) {
  6670. var userId = entity;
  6671. if (userId instanceof _ParseUser.default) {
  6672. userId = userId.id;
  6673. if (!userId) {
  6674. throw new Error('Cannot get access for a Parse.User without an id.');
  6675. }
  6676. } else if (userId instanceof _ParseRole.default) {
  6677. userId = this._getRoleName(userId);
  6678. }
  6679. if (typeof userId !== 'string') {
  6680. throw new TypeError('userId must be a string.');
  6681. }
  6682. return userId;
  6683. }
  6684. }, {
  6685. key: "_setAccess",
  6686. value: function _setAccess(permission
  6687. /*: string*/
  6688. , userId
  6689. /*: Entity*/
  6690. , allowed
  6691. /*: boolean*/
  6692. ) {
  6693. userId = this._parseEntity(userId);
  6694. if (typeof allowed !== 'boolean') {
  6695. throw new TypeError('allowed must be either true or false.');
  6696. }
  6697. var permissions = this.permissionsMap[permission][userId];
  6698. if (!permissions) {
  6699. if (!allowed) {
  6700. // The user already doesn't have this permission, so no action is needed
  6701. return;
  6702. } else {
  6703. this.permissionsMap[permission][userId] = {};
  6704. }
  6705. }
  6706. if (allowed) {
  6707. this.permissionsMap[permission][userId] = true;
  6708. } else {
  6709. delete this.permissionsMap[permission][userId];
  6710. }
  6711. }
  6712. }, {
  6713. key: "_getAccess",
  6714. value: function _getAccess(permission
  6715. /*: string*/
  6716. , userId
  6717. /*: Entity*/
  6718. )
  6719. /*: boolean | string[]*/
  6720. {
  6721. var returnBoolean = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  6722. userId = this._parseEntity(userId);
  6723. var permissions = this.permissionsMap[permission][userId];
  6724. if (returnBoolean) {
  6725. if (!permissions) {
  6726. return false;
  6727. }
  6728. return !!this.permissionsMap[permission][userId];
  6729. }
  6730. return permissions;
  6731. }
  6732. }, {
  6733. key: "_setArrayAccess",
  6734. value: function _setArrayAccess(permission
  6735. /*: string*/
  6736. , userId
  6737. /*: Entity*/
  6738. , fields
  6739. /*: string*/
  6740. ) {
  6741. userId = this._parseEntity(userId);
  6742. var permissions = this.permissionsMap[permission][userId];
  6743. if (!permissions) {
  6744. this.permissionsMap[permission][userId] = [];
  6745. }
  6746. if (!fields || (0, _isArray.default)(fields) && fields.length === 0) {
  6747. delete this.permissionsMap[permission][userId];
  6748. } else if ((0, _isArray.default)(fields) && (0, _every.default)(fields).call(fields, function (field) {
  6749. return typeof field === 'string';
  6750. })) {
  6751. this.permissionsMap[permission][userId] = fields;
  6752. } else {
  6753. throw new TypeError('fields must be an array of strings or undefined.');
  6754. }
  6755. }
  6756. }, {
  6757. key: "_setGroupPointerPermission",
  6758. value: function _setGroupPointerPermission(operation
  6759. /*: string*/
  6760. , pointerFields
  6761. /*: string[]*/
  6762. ) {
  6763. var fields = this.permissionsMap[operation];
  6764. if (!fields) {
  6765. this.permissionsMap[operation] = [];
  6766. }
  6767. if (!pointerFields || (0, _isArray.default)(pointerFields) && pointerFields.length === 0) {
  6768. delete this.permissionsMap[operation];
  6769. } else if ((0, _isArray.default)(pointerFields) && (0, _every.default)(pointerFields).call(pointerFields, function (field) {
  6770. return typeof field === 'string';
  6771. })) {
  6772. this.permissionsMap[operation] = pointerFields;
  6773. } else {
  6774. throw new TypeError("".concat(operation, ".pointerFields must be an array of strings or undefined."));
  6775. }
  6776. }
  6777. }, {
  6778. key: "_getGroupPointerPermissions",
  6779. value: function _getGroupPointerPermissions(operation
  6780. /*: string*/
  6781. )
  6782. /*: string[]*/
  6783. {
  6784. return this.permissionsMap[operation];
  6785. }
  6786. /**
  6787. * Sets user pointer fields to allow permission for get/count/find operations.
  6788. *
  6789. * @param {string[]} pointerFields User pointer fields
  6790. */
  6791. }, {
  6792. key: "setReadUserFields",
  6793. value: function setReadUserFields(pointerFields
  6794. /*: string[]*/
  6795. ) {
  6796. this._setGroupPointerPermission('readUserFields', pointerFields);
  6797. }
  6798. /**
  6799. * @returns {string[]} User pointer fields
  6800. */
  6801. }, {
  6802. key: "getReadUserFields",
  6803. value: function getReadUserFields()
  6804. /*: string[]*/
  6805. {
  6806. return this._getGroupPointerPermissions('readUserFields');
  6807. }
  6808. /**
  6809. * Sets user pointer fields to allow permission for create/delete/update/addField operations
  6810. *
  6811. * @param {string[]} pointerFields User pointer fields
  6812. */
  6813. }, {
  6814. key: "setWriteUserFields",
  6815. value: function setWriteUserFields(pointerFields
  6816. /*: string[]*/
  6817. ) {
  6818. this._setGroupPointerPermission('writeUserFields', pointerFields);
  6819. }
  6820. /**
  6821. * @returns {string[]} User pointer fields
  6822. */
  6823. }, {
  6824. key: "getWriteUserFields",
  6825. value: function getWriteUserFields()
  6826. /*: string[]*/
  6827. {
  6828. return this._getGroupPointerPermissions('writeUserFields');
  6829. }
  6830. /**
  6831. * Sets whether the given user is allowed to retrieve fields from this class.
  6832. *
  6833. * @param userId An instance of Parse.User or its objectId.
  6834. * @param {string[]} fields fields to be protected
  6835. */
  6836. }, {
  6837. key: "setProtectedFields",
  6838. value: function setProtectedFields(userId
  6839. /*: Entity*/
  6840. , fields
  6841. /*: string[]*/
  6842. ) {
  6843. this._setArrayAccess('protectedFields', userId, fields);
  6844. }
  6845. /**
  6846. * Returns array of fields are accessable to this user.
  6847. *
  6848. * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
  6849. * @returns {string[]}
  6850. */
  6851. }, {
  6852. key: "getProtectedFields",
  6853. value: function getProtectedFields(userId
  6854. /*: Entity*/
  6855. )
  6856. /*: string[]*/
  6857. {
  6858. return this._getAccess('protectedFields', userId, false);
  6859. }
  6860. /**
  6861. * Sets whether the given user is allowed to read from this class.
  6862. *
  6863. * @param userId An instance of Parse.User or its objectId.
  6864. * @param {boolean} allowed whether that user should have read access.
  6865. */
  6866. }, {
  6867. key: "setReadAccess",
  6868. value: function setReadAccess(userId
  6869. /*: Entity*/
  6870. , allowed
  6871. /*: boolean*/
  6872. ) {
  6873. this._setAccess('find', userId, allowed);
  6874. this._setAccess('get', userId, allowed);
  6875. this._setAccess('count', userId, allowed);
  6876. }
  6877. /**
  6878. * Get whether the given user id is *explicitly* allowed to read from this class.
  6879. * Even if this returns false, the user may still be able to access it if
  6880. * getPublicReadAccess returns true or a role that the user belongs to has
  6881. * write access.
  6882. *
  6883. * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
  6884. * @returns {boolean}
  6885. */
  6886. }, {
  6887. key: "getReadAccess",
  6888. value: function getReadAccess(userId
  6889. /*: Entity*/
  6890. )
  6891. /*: boolean*/
  6892. {
  6893. return this._getAccess('find', userId) && this._getAccess('get', userId) && this._getAccess('count', userId);
  6894. }
  6895. /**
  6896. * Sets whether the given user id is allowed to write to this class.
  6897. *
  6898. * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
  6899. * @param {boolean} allowed Whether that user should have write access.
  6900. */
  6901. }, {
  6902. key: "setWriteAccess",
  6903. value: function setWriteAccess(userId
  6904. /*: Entity*/
  6905. , allowed
  6906. /*: boolean*/
  6907. ) {
  6908. this._setAccess('create', userId, allowed);
  6909. this._setAccess('update', userId, allowed);
  6910. this._setAccess('delete', userId, allowed);
  6911. this._setAccess('addField', userId, allowed);
  6912. }
  6913. /**
  6914. * Gets whether the given user id is *explicitly* allowed to write to this class.
  6915. * Even if this returns false, the user may still be able to write it if
  6916. * getPublicWriteAccess returns true or a role that the user belongs to has
  6917. * write access.
  6918. *
  6919. * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
  6920. * @returns {boolean}
  6921. */
  6922. }, {
  6923. key: "getWriteAccess",
  6924. value: function getWriteAccess(userId
  6925. /*: Entity*/
  6926. )
  6927. /*: boolean*/
  6928. {
  6929. return this._getAccess('create', userId) && this._getAccess('update', userId) && this._getAccess('delete', userId) && this._getAccess('addField', userId);
  6930. }
  6931. /**
  6932. * Sets whether the public is allowed to read from this class.
  6933. *
  6934. * @param {boolean} allowed
  6935. */
  6936. }, {
  6937. key: "setPublicReadAccess",
  6938. value: function setPublicReadAccess(allowed
  6939. /*: boolean*/
  6940. ) {
  6941. this.setReadAccess(PUBLIC_KEY, allowed);
  6942. }
  6943. /**
  6944. * Gets whether the public is allowed to read from this class.
  6945. *
  6946. * @returns {boolean}
  6947. */
  6948. }, {
  6949. key: "getPublicReadAccess",
  6950. value: function getPublicReadAccess()
  6951. /*: boolean*/
  6952. {
  6953. return this.getReadAccess(PUBLIC_KEY);
  6954. }
  6955. /**
  6956. * Sets whether the public is allowed to write to this class.
  6957. *
  6958. * @param {boolean} allowed
  6959. */
  6960. }, {
  6961. key: "setPublicWriteAccess",
  6962. value: function setPublicWriteAccess(allowed
  6963. /*: boolean*/
  6964. ) {
  6965. this.setWriteAccess(PUBLIC_KEY, allowed);
  6966. }
  6967. /**
  6968. * Gets whether the public is allowed to write to this class.
  6969. *
  6970. * @returns {boolean}
  6971. */
  6972. }, {
  6973. key: "getPublicWriteAccess",
  6974. value: function getPublicWriteAccess()
  6975. /*: boolean*/
  6976. {
  6977. return this.getWriteAccess(PUBLIC_KEY);
  6978. }
  6979. /**
  6980. * Sets whether the public is allowed to protect fields in this class.
  6981. *
  6982. * @param {string[]} fields
  6983. */
  6984. }, {
  6985. key: "setPublicProtectedFields",
  6986. value: function setPublicProtectedFields(fields
  6987. /*: string[]*/
  6988. ) {
  6989. this.setProtectedFields(PUBLIC_KEY, fields);
  6990. }
  6991. /**
  6992. * Gets whether the public is allowed to read fields from this class.
  6993. *
  6994. * @returns {string[]}
  6995. */
  6996. }, {
  6997. key: "getPublicProtectedFields",
  6998. value: function getPublicProtectedFields()
  6999. /*: string[]*/
  7000. {
  7001. return this.getProtectedFields(PUBLIC_KEY);
  7002. }
  7003. /**
  7004. * Gets whether users belonging to the given role are allowed
  7005. * to read from this class. Even if this returns false, the role may
  7006. * still be able to write it if a parent role has read access.
  7007. *
  7008. * @param role The name of the role, or a Parse.Role object.
  7009. * @returns {boolean} true if the role has read access. false otherwise.
  7010. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  7011. */
  7012. }, {
  7013. key: "getRoleReadAccess",
  7014. value: function getRoleReadAccess(role
  7015. /*: ParseRole | string*/
  7016. )
  7017. /*: boolean*/
  7018. {
  7019. return this.getReadAccess(this._getRoleName(role));
  7020. }
  7021. /**
  7022. * Gets whether users belonging to the given role are allowed
  7023. * to write to this user. Even if this returns false, the role may
  7024. * still be able to write it if a parent role has write access.
  7025. *
  7026. * @param role The name of the role, or a Parse.Role object.
  7027. * @returns {boolean} true if the role has write access. false otherwise.
  7028. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  7029. */
  7030. }, {
  7031. key: "getRoleWriteAccess",
  7032. value: function getRoleWriteAccess(role
  7033. /*: ParseRole | string*/
  7034. )
  7035. /*: boolean*/
  7036. {
  7037. return this.getWriteAccess(this._getRoleName(role));
  7038. }
  7039. /**
  7040. * Sets whether users belonging to the given role are allowed
  7041. * to read from this class.
  7042. *
  7043. * @param role The name of the role, or a Parse.Role object.
  7044. * @param {boolean} allowed Whether the given role can read this object.
  7045. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  7046. */
  7047. }, {
  7048. key: "setRoleReadAccess",
  7049. value: function setRoleReadAccess(role
  7050. /*: ParseRole | string*/
  7051. , allowed
  7052. /*: boolean*/
  7053. ) {
  7054. this.setReadAccess(this._getRoleName(role), allowed);
  7055. }
  7056. /**
  7057. * Sets whether users belonging to the given role are allowed
  7058. * to write to this class.
  7059. *
  7060. * @param role The name of the role, or a Parse.Role object.
  7061. * @param {boolean} allowed Whether the given role can write this object.
  7062. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  7063. */
  7064. }, {
  7065. key: "setRoleWriteAccess",
  7066. value: function setRoleWriteAccess(role
  7067. /*: ParseRole | string*/
  7068. , allowed
  7069. /*: boolean*/
  7070. ) {
  7071. this.setWriteAccess(this._getRoleName(role), allowed);
  7072. }
  7073. /**
  7074. * Gets whether users belonging to the given role are allowed
  7075. * to count to this user. Even if this returns false, the role may
  7076. * still be able to count it if a parent role has count access.
  7077. *
  7078. * @param role The name of the role, or a Parse.Role object.
  7079. * @returns {string[]}
  7080. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  7081. */
  7082. }, {
  7083. key: "getRoleProtectedFields",
  7084. value: function getRoleProtectedFields(role
  7085. /*: ParseRole | string*/
  7086. )
  7087. /*: string[]*/
  7088. {
  7089. return this.getProtectedFields(this._getRoleName(role));
  7090. }
  7091. /**
  7092. * Sets whether users belonging to the given role are allowed
  7093. * to set access field in this class.
  7094. *
  7095. * @param role The name of the role, or a Parse.Role object.
  7096. * @param {string[]} fields Fields to be protected by Role.
  7097. * @throws {TypeError} If role is neither a Parse.Role nor a String.
  7098. */
  7099. }, {
  7100. key: "setRoleProtectedFields",
  7101. value: function setRoleProtectedFields(role
  7102. /*: ParseRole | string*/
  7103. , fields
  7104. /*: string[]*/
  7105. ) {
  7106. this.setProtectedFields(this._getRoleName(role), fields);
  7107. }
  7108. }]);
  7109. return ParseCLP;
  7110. }();
  7111. var _default = ParseCLP;
  7112. exports.default = _default;
  7113. },{"./ParseRole":31,"./ParseUser":34,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/entries":60,"@babel/runtime-corejs3/core-js-stable/instance/every":61,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/includes":66,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/map":78,"@babel/runtime-corejs3/core-js-stable/object/assign":80,"@babel/runtime-corejs3/core-js-stable/object/define-properties":82,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":87,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":88,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/slicedToArray":138,"@babel/runtime-corejs3/helpers/typeof":141}],20:[function(_dereq_,module,exports){
  7114. "use strict";
  7115. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  7116. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  7117. _Object$defineProperty(exports, "__esModule", {
  7118. value: true
  7119. });
  7120. exports.default = void 0;
  7121. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  7122. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  7123. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  7124. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  7125. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  7126. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  7127. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  7128. var _decode = _interopRequireDefault(_dereq_("./decode"));
  7129. var _encode = _interopRequireDefault(_dereq_("./encode"));
  7130. var _escape2 = _interopRequireDefault(_dereq_("./escape"));
  7131. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  7132. var _Storage = _interopRequireDefault(_dereq_("./Storage"));
  7133. /**
  7134. * Copyright (c) 2015-present, Parse, LLC.
  7135. * All rights reserved.
  7136. *
  7137. * This source code is licensed under the BSD-style license found in the
  7138. * LICENSE file in the root directory of this source tree. An additional grant
  7139. * of patent rights can be found in the PATENTS file in the same directory.
  7140. *
  7141. * @flow
  7142. */
  7143. /**
  7144. * Parse.Config is a local representation of configuration data that
  7145. * can be set from the Parse dashboard.
  7146. *
  7147. * @alias Parse.Config
  7148. */
  7149. var ParseConfig = /*#__PURE__*/function () {
  7150. function ParseConfig() {
  7151. (0, _classCallCheck2.default)(this, ParseConfig);
  7152. (0, _defineProperty2.default)(this, "attributes", void 0);
  7153. (0, _defineProperty2.default)(this, "_escapedAttributes", void 0);
  7154. this.attributes = {};
  7155. this._escapedAttributes = {};
  7156. }
  7157. /**
  7158. * Gets the value of an attribute.
  7159. *
  7160. * @param {string} attr The name of an attribute.
  7161. * @returns {*}
  7162. */
  7163. (0, _createClass2.default)(ParseConfig, [{
  7164. key: "get",
  7165. value: function (attr
  7166. /*: string*/
  7167. )
  7168. /*: any*/
  7169. {
  7170. return this.attributes[attr];
  7171. }
  7172. /**
  7173. * Gets the HTML-escaped value of an attribute.
  7174. *
  7175. * @param {string} attr The name of an attribute.
  7176. * @returns {string}
  7177. */
  7178. }, {
  7179. key: "escape",
  7180. value: function (attr
  7181. /*: string*/
  7182. )
  7183. /*: string*/
  7184. {
  7185. var html = this._escapedAttributes[attr];
  7186. if (html) {
  7187. return html;
  7188. }
  7189. var val = this.attributes[attr];
  7190. var escaped = '';
  7191. if (val != null) {
  7192. escaped = (0, _escape2.default)(val.toString());
  7193. }
  7194. this._escapedAttributes[attr] = escaped;
  7195. return escaped;
  7196. }
  7197. /**
  7198. * Retrieves the most recently-fetched configuration object, either from
  7199. * memory or from local storage if necessary.
  7200. *
  7201. * @static
  7202. * @returns {Parse.Config} The most recently-fetched Parse.Config if it
  7203. * exists, else an empty Parse.Config.
  7204. */
  7205. }], [{
  7206. key: "current",
  7207. value: function () {
  7208. var controller = _CoreManager.default.getConfigController();
  7209. return controller.current();
  7210. }
  7211. /**
  7212. * Gets a new configuration object from the server.
  7213. *
  7214. * @static
  7215. * @param {object} options
  7216. * Valid options are:<ul>
  7217. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  7218. * be used for this request.
  7219. * </ul>
  7220. * @returns {Promise} A promise that is resolved with a newly-created
  7221. * configuration object when the get completes.
  7222. */
  7223. }, {
  7224. key: "get",
  7225. value: function () {
  7226. var options
  7227. /*: RequestOptions*/
  7228. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7229. var controller = _CoreManager.default.getConfigController();
  7230. return controller.get(options);
  7231. }
  7232. /**
  7233. * Save value keys to the server.
  7234. *
  7235. * @static
  7236. * @param {object} attrs The config parameters and values.
  7237. * @param {object} masterKeyOnlyFlags The flags that define whether config parameters listed
  7238. * in `attrs` should be retrievable only by using the master key.
  7239. * For example: `param1: true` makes `param1` only retrievable by using the master key.
  7240. * If a parameter is not provided or set to `false`, it can be retrieved without
  7241. * using the master key.
  7242. * @returns {Promise} A promise that is resolved with a newly-created
  7243. * configuration object or with the current with the update.
  7244. */
  7245. }, {
  7246. key: "save",
  7247. value: function (attrs
  7248. /*: { [key: string]: any }*/
  7249. , masterKeyOnlyFlags
  7250. /*: { [key: string]: any }*/
  7251. ) {
  7252. var controller = _CoreManager.default.getConfigController(); //To avoid a mismatch with the local and the cloud config we get a new version
  7253. return controller.save(attrs, masterKeyOnlyFlags).then(function () {
  7254. return controller.get({
  7255. useMasterKey: true
  7256. });
  7257. }, function (error) {
  7258. return _promise.default.reject(error);
  7259. });
  7260. }
  7261. /**
  7262. * Used for testing
  7263. *
  7264. * @private
  7265. */
  7266. }, {
  7267. key: "_clearCache",
  7268. value: function () {
  7269. currentConfig = null;
  7270. }
  7271. }]);
  7272. return ParseConfig;
  7273. }();
  7274. var currentConfig = null;
  7275. var CURRENT_CONFIG_KEY = 'currentConfig';
  7276. function decodePayload(data) {
  7277. try {
  7278. var json = JSON.parse(data);
  7279. if (json && (0, _typeof2.default)(json) === 'object') {
  7280. return (0, _decode.default)(json);
  7281. }
  7282. } catch (e) {
  7283. return null;
  7284. }
  7285. }
  7286. var DefaultController = {
  7287. current: function () {
  7288. if (currentConfig) {
  7289. return currentConfig;
  7290. }
  7291. var config = new ParseConfig();
  7292. var storagePath = _Storage.default.generatePath(CURRENT_CONFIG_KEY);
  7293. if (!_Storage.default.async()) {
  7294. var configData = _Storage.default.getItem(storagePath);
  7295. if (configData) {
  7296. var attributes = decodePayload(configData);
  7297. if (attributes) {
  7298. config.attributes = attributes;
  7299. currentConfig = config;
  7300. }
  7301. }
  7302. return config;
  7303. } // Return a promise for async storage controllers
  7304. return _Storage.default.getItemAsync(storagePath).then(function (configData) {
  7305. if (configData) {
  7306. var _attributes = decodePayload(configData);
  7307. if (_attributes) {
  7308. config.attributes = _attributes;
  7309. currentConfig = config;
  7310. }
  7311. }
  7312. return config;
  7313. });
  7314. },
  7315. get: function () {
  7316. var options
  7317. /*: RequestOptions*/
  7318. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7319. var RESTController = _CoreManager.default.getRESTController();
  7320. return RESTController.request('GET', 'config', {}, options).then(function (response) {
  7321. if (!response || !response.params) {
  7322. var error = new _ParseError.default(_ParseError.default.INVALID_JSON, 'Config JSON response invalid.');
  7323. return _promise.default.reject(error);
  7324. }
  7325. var config = new ParseConfig();
  7326. config.attributes = {};
  7327. for (var attr in response.params) {
  7328. config.attributes[attr] = (0, _decode.default)(response.params[attr]);
  7329. }
  7330. currentConfig = config;
  7331. return _Storage.default.setItemAsync(_Storage.default.generatePath(CURRENT_CONFIG_KEY), (0, _stringify.default)(response.params)).then(function () {
  7332. return config;
  7333. });
  7334. });
  7335. },
  7336. save: function (attrs
  7337. /*: { [key: string]: any }*/
  7338. , masterKeyOnlyFlags
  7339. /*: { [key: string]: any }*/
  7340. ) {
  7341. var RESTController = _CoreManager.default.getRESTController();
  7342. var encodedAttrs = {};
  7343. for (var _key in attrs) {
  7344. encodedAttrs[_key] = (0, _encode.default)(attrs[_key]);
  7345. }
  7346. return RESTController.request('PUT', 'config', {
  7347. params: encodedAttrs,
  7348. masterKeyOnly: masterKeyOnlyFlags
  7349. }, {
  7350. useMasterKey: true
  7351. }).then(function (response) {
  7352. if (response && response.result) {
  7353. return _promise.default.resolve();
  7354. } else {
  7355. var error = new _ParseError.default(_ParseError.default.INTERNAL_SERVER_ERROR, 'Error occured updating Config.');
  7356. return _promise.default.reject(error);
  7357. }
  7358. });
  7359. }
  7360. };
  7361. _CoreManager.default.setConfigController(DefaultController);
  7362. var _default = ParseConfig;
  7363. exports.default = _default;
  7364. },{"./CoreManager":4,"./ParseError":21,"./Storage":39,"./decode":46,"./encode":47,"./escape":49,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],21:[function(_dereq_,module,exports){
  7365. "use strict";
  7366. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  7367. var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  7368. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  7369. _Object$defineProperty2(exports, "__esModule", {
  7370. value: true
  7371. });
  7372. exports.default = void 0;
  7373. var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
  7374. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  7375. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  7376. var _assertThisInitialized2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/assertThisInitialized"));
  7377. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  7378. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  7379. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  7380. var _wrapNativeSuper2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
  7381. function _createSuper(Derived) {
  7382. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  7383. return function () {
  7384. var Super = (0, _getPrototypeOf2.default)(Derived),
  7385. result;
  7386. if (hasNativeReflectConstruct) {
  7387. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  7388. result = _Reflect$construct(Super, arguments, NewTarget);
  7389. } else {
  7390. result = Super.apply(this, arguments);
  7391. }
  7392. return (0, _possibleConstructorReturn2.default)(this, result);
  7393. };
  7394. }
  7395. function _isNativeReflectConstruct() {
  7396. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  7397. if (_Reflect$construct.sham) return false;
  7398. if (typeof Proxy === "function") return true;
  7399. try {
  7400. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  7401. return true;
  7402. } catch (e) {
  7403. return false;
  7404. }
  7405. }
  7406. /**
  7407. * Copyright (c) 2015-present, Parse, LLC.
  7408. * All rights reserved.
  7409. *
  7410. * This source code is licensed under the BSD-style license found in the
  7411. * LICENSE file in the root directory of this source tree. An additional grant
  7412. * of patent rights can be found in the PATENTS file in the same directory.
  7413. */
  7414. /**
  7415. * Constructs a new Parse.Error object with the given code and message.
  7416. *
  7417. * @alias Parse.Error
  7418. */
  7419. var ParseError = /*#__PURE__*/function (_Error) {
  7420. (0, _inherits2.default)(ParseError, _Error);
  7421. var _super = _createSuper(ParseError);
  7422. /**
  7423. * @param {number} code An error code constant from <code>Parse.Error</code>.
  7424. * @param {string} message A detailed description of the error.
  7425. */
  7426. function ParseError(code, message) {
  7427. var _this;
  7428. (0, _classCallCheck2.default)(this, ParseError);
  7429. _this = _super.call(this, message);
  7430. _this.code = code;
  7431. (0, _defineProperty.default)((0, _assertThisInitialized2.default)(_this), 'message', {
  7432. enumerable: true,
  7433. value: message
  7434. });
  7435. return _this;
  7436. }
  7437. (0, _createClass2.default)(ParseError, [{
  7438. key: "toString",
  7439. value: function () {
  7440. return 'ParseError: ' + this.code + ' ' + this.message;
  7441. }
  7442. }]);
  7443. return ParseError;
  7444. }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
  7445. /**
  7446. * Error code indicating some error other than those enumerated here.
  7447. *
  7448. * @property {number} OTHER_CAUSE
  7449. * @static
  7450. */
  7451. ParseError.OTHER_CAUSE = -1;
  7452. /**
  7453. * Error code indicating that something has gone wrong with the server.
  7454. *
  7455. * @property {number} INTERNAL_SERVER_ERROR
  7456. * @static
  7457. */
  7458. ParseError.INTERNAL_SERVER_ERROR = 1;
  7459. /**
  7460. * Error code indicating the connection to the Parse servers failed.
  7461. *
  7462. * @property {number} CONNECTION_FAILED
  7463. * @static
  7464. */
  7465. ParseError.CONNECTION_FAILED = 100;
  7466. /**
  7467. * Error code indicating the specified object doesn't exist.
  7468. *
  7469. * @property {number} OBJECT_NOT_FOUND
  7470. * @static
  7471. */
  7472. ParseError.OBJECT_NOT_FOUND = 101;
  7473. /**
  7474. * Error code indicating you tried to query with a datatype that doesn't
  7475. * support it, like exact matching an array or object.
  7476. *
  7477. * @property {number} INVALID_QUERY
  7478. * @static
  7479. */
  7480. ParseError.INVALID_QUERY = 102;
  7481. /**
  7482. * Error code indicating a missing or invalid classname. Classnames are
  7483. * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
  7484. * only valid characters.
  7485. *
  7486. * @property {number} INVALID_CLASS_NAME
  7487. * @static
  7488. */
  7489. ParseError.INVALID_CLASS_NAME = 103;
  7490. /**
  7491. * Error code indicating an unspecified object id.
  7492. *
  7493. * @property {number} MISSING_OBJECT_ID
  7494. * @static
  7495. */
  7496. ParseError.MISSING_OBJECT_ID = 104;
  7497. /**
  7498. * Error code indicating an invalid key name. Keys are case-sensitive. They
  7499. * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
  7500. *
  7501. * @property {number} INVALID_KEY_NAME
  7502. * @static
  7503. */
  7504. ParseError.INVALID_KEY_NAME = 105;
  7505. /**
  7506. * Error code indicating a malformed pointer. You should not see this unless
  7507. * you have been mucking about changing internal Parse code.
  7508. *
  7509. * @property {number} INVALID_POINTER
  7510. * @static
  7511. */
  7512. ParseError.INVALID_POINTER = 106;
  7513. /**
  7514. * Error code indicating that badly formed JSON was received upstream. This
  7515. * either indicates you have done something unusual with modifying how
  7516. * things encode to JSON, or the network is failing badly.
  7517. *
  7518. * @property {number} INVALID_JSON
  7519. * @static
  7520. */
  7521. ParseError.INVALID_JSON = 107;
  7522. /**
  7523. * Error code indicating that the feature you tried to access is only
  7524. * available internally for testing purposes.
  7525. *
  7526. * @property {number} COMMAND_UNAVAILABLE
  7527. * @static
  7528. */
  7529. ParseError.COMMAND_UNAVAILABLE = 108;
  7530. /**
  7531. * You must call Parse.initialize before using the Parse library.
  7532. *
  7533. * @property {number} NOT_INITIALIZED
  7534. * @static
  7535. */
  7536. ParseError.NOT_INITIALIZED = 109;
  7537. /**
  7538. * Error code indicating that a field was set to an inconsistent type.
  7539. *
  7540. * @property {number} INCORRECT_TYPE
  7541. * @static
  7542. */
  7543. ParseError.INCORRECT_TYPE = 111;
  7544. /**
  7545. * Error code indicating an invalid channel name. A channel name is either
  7546. * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
  7547. * characters and starts with a letter.
  7548. *
  7549. * @property {number} INVALID_CHANNEL_NAME
  7550. * @static
  7551. */
  7552. ParseError.INVALID_CHANNEL_NAME = 112;
  7553. /**
  7554. * Error code indicating that push is misconfigured.
  7555. *
  7556. * @property {number} PUSH_MISCONFIGURED
  7557. * @static
  7558. */
  7559. ParseError.PUSH_MISCONFIGURED = 115;
  7560. /**
  7561. * Error code indicating that the object is too large.
  7562. *
  7563. * @property {number} OBJECT_TOO_LARGE
  7564. * @static
  7565. */
  7566. ParseError.OBJECT_TOO_LARGE = 116;
  7567. /**
  7568. * Error code indicating that the operation isn't allowed for clients.
  7569. *
  7570. * @property {number} OPERATION_FORBIDDEN
  7571. * @static
  7572. */
  7573. ParseError.OPERATION_FORBIDDEN = 119;
  7574. /**
  7575. * Error code indicating the result was not found in the cache.
  7576. *
  7577. * @property {number} CACHE_MISS
  7578. * @static
  7579. */
  7580. ParseError.CACHE_MISS = 120;
  7581. /**
  7582. * Error code indicating that an invalid key was used in a nested
  7583. * JSONObject.
  7584. *
  7585. * @property {number} INVALID_NESTED_KEY
  7586. * @static
  7587. */
  7588. ParseError.INVALID_NESTED_KEY = 121;
  7589. /**
  7590. * Error code indicating that an invalid filename was used for ParseFile.
  7591. * A valid file name contains only a-zA-Z0-9_. characters and is between 1
  7592. * and 128 characters.
  7593. *
  7594. * @property {number} INVALID_FILE_NAME
  7595. * @static
  7596. */
  7597. ParseError.INVALID_FILE_NAME = 122;
  7598. /**
  7599. * Error code indicating an invalid ACL was provided.
  7600. *
  7601. * @property {number} INVALID_ACL
  7602. * @static
  7603. */
  7604. ParseError.INVALID_ACL = 123;
  7605. /**
  7606. * Error code indicating that the request timed out on the server. Typically
  7607. * this indicates that the request is too expensive to run.
  7608. *
  7609. * @property {number} TIMEOUT
  7610. * @static
  7611. */
  7612. ParseError.TIMEOUT = 124;
  7613. /**
  7614. * Error code indicating that the email address was invalid.
  7615. *
  7616. * @property {number} INVALID_EMAIL_ADDRESS
  7617. * @static
  7618. */
  7619. ParseError.INVALID_EMAIL_ADDRESS = 125;
  7620. /**
  7621. * Error code indicating a missing content type.
  7622. *
  7623. * @property {number} MISSING_CONTENT_TYPE
  7624. * @static
  7625. */
  7626. ParseError.MISSING_CONTENT_TYPE = 126;
  7627. /**
  7628. * Error code indicating a missing content length.
  7629. *
  7630. * @property {number} MISSING_CONTENT_LENGTH
  7631. * @static
  7632. */
  7633. ParseError.MISSING_CONTENT_LENGTH = 127;
  7634. /**
  7635. * Error code indicating an invalid content length.
  7636. *
  7637. * @property {number} INVALID_CONTENT_LENGTH
  7638. * @static
  7639. */
  7640. ParseError.INVALID_CONTENT_LENGTH = 128;
  7641. /**
  7642. * Error code indicating a file that was too large.
  7643. *
  7644. * @property {number} FILE_TOO_LARGE
  7645. * @static
  7646. */
  7647. ParseError.FILE_TOO_LARGE = 129;
  7648. /**
  7649. * Error code indicating an error saving a file.
  7650. *
  7651. * @property {number} FILE_SAVE_ERROR
  7652. * @static
  7653. */
  7654. ParseError.FILE_SAVE_ERROR = 130;
  7655. /**
  7656. * Error code indicating that a unique field was given a value that is
  7657. * already taken.
  7658. *
  7659. * @property {number} DUPLICATE_VALUE
  7660. * @static
  7661. */
  7662. ParseError.DUPLICATE_VALUE = 137;
  7663. /**
  7664. * Error code indicating that a role's name is invalid.
  7665. *
  7666. * @property {number} INVALID_ROLE_NAME
  7667. * @static
  7668. */
  7669. ParseError.INVALID_ROLE_NAME = 139;
  7670. /**
  7671. * Error code indicating that an application quota was exceeded. Upgrade to
  7672. * resolve.
  7673. *
  7674. * @property {number} EXCEEDED_QUOTA
  7675. * @static
  7676. */
  7677. ParseError.EXCEEDED_QUOTA = 140;
  7678. /**
  7679. * Error code indicating that a Cloud Code script failed.
  7680. *
  7681. * @property {number} SCRIPT_FAILED
  7682. * @static
  7683. */
  7684. ParseError.SCRIPT_FAILED = 141;
  7685. /**
  7686. * Error code indicating that a Cloud Code validation failed.
  7687. *
  7688. * @property {number} VALIDATION_ERROR
  7689. * @static
  7690. */
  7691. ParseError.VALIDATION_ERROR = 142;
  7692. /**
  7693. * Error code indicating that invalid image data was provided.
  7694. *
  7695. * @property {number} INVALID_IMAGE_DATA
  7696. * @static
  7697. */
  7698. ParseError.INVALID_IMAGE_DATA = 143;
  7699. /**
  7700. * Error code indicating an unsaved file.
  7701. *
  7702. * @property {number} UNSAVED_FILE_ERROR
  7703. * @static
  7704. */
  7705. ParseError.UNSAVED_FILE_ERROR = 151;
  7706. /**
  7707. * Error code indicating an invalid push time.
  7708. *
  7709. * @property {number} INVALID_PUSH_TIME_ERROR
  7710. * @static
  7711. */
  7712. ParseError.INVALID_PUSH_TIME_ERROR = 152;
  7713. /**
  7714. * Error code indicating an error deleting a file.
  7715. *
  7716. * @property {number} FILE_DELETE_ERROR
  7717. * @static
  7718. */
  7719. ParseError.FILE_DELETE_ERROR = 153;
  7720. /**
  7721. * Error code indicating an error deleting an unnamed file.
  7722. *
  7723. * @property {number} FILE_DELETE_UNNAMED_ERROR
  7724. * @static
  7725. */
  7726. ParseError.FILE_DELETE_UNNAMED_ERROR = 161;
  7727. /**
  7728. * Error code indicating that the application has exceeded its request
  7729. * limit.
  7730. *
  7731. * @property {number} REQUEST_LIMIT_EXCEEDED
  7732. * @static
  7733. */
  7734. ParseError.REQUEST_LIMIT_EXCEEDED = 155;
  7735. /**
  7736. * Error code indicating that the request was a duplicate and has been discarded due to
  7737. * idempotency rules.
  7738. *
  7739. * @property {number} DUPLICATE_REQUEST
  7740. * @static
  7741. */
  7742. ParseError.DUPLICATE_REQUEST = 159;
  7743. /**
  7744. * Error code indicating an invalid event name.
  7745. *
  7746. * @property {number} INVALID_EVENT_NAME
  7747. * @static
  7748. */
  7749. ParseError.INVALID_EVENT_NAME = 160;
  7750. /**
  7751. * Error code indicating that a field had an invalid value.
  7752. *
  7753. * @property {number} INVALID_VALUE
  7754. * @static
  7755. */
  7756. ParseError.INVALID_VALUE = 162;
  7757. /**
  7758. * Error code indicating that the username is missing or empty.
  7759. *
  7760. * @property {number} USERNAME_MISSING
  7761. * @static
  7762. */
  7763. ParseError.USERNAME_MISSING = 200;
  7764. /**
  7765. * Error code indicating that the password is missing or empty.
  7766. *
  7767. * @property {number} PASSWORD_MISSING
  7768. * @static
  7769. */
  7770. ParseError.PASSWORD_MISSING = 201;
  7771. /**
  7772. * Error code indicating that the username has already been taken.
  7773. *
  7774. * @property {number} USERNAME_TAKEN
  7775. * @static
  7776. */
  7777. ParseError.USERNAME_TAKEN = 202;
  7778. /**
  7779. * Error code indicating that the email has already been taken.
  7780. *
  7781. * @property {number} EMAIL_TAKEN
  7782. * @static
  7783. */
  7784. ParseError.EMAIL_TAKEN = 203;
  7785. /**
  7786. * Error code indicating that the email is missing, but must be specified.
  7787. *
  7788. * @property {number} EMAIL_MISSING
  7789. * @static
  7790. */
  7791. ParseError.EMAIL_MISSING = 204;
  7792. /**
  7793. * Error code indicating that a user with the specified email was not found.
  7794. *
  7795. * @property {number} EMAIL_NOT_FOUND
  7796. * @static
  7797. */
  7798. ParseError.EMAIL_NOT_FOUND = 205;
  7799. /**
  7800. * Error code indicating that a user object without a valid session could
  7801. * not be altered.
  7802. *
  7803. * @property {number} SESSION_MISSING
  7804. * @static
  7805. */
  7806. ParseError.SESSION_MISSING = 206;
  7807. /**
  7808. * Error code indicating that a user can only be created through signup.
  7809. *
  7810. * @property {number} MUST_CREATE_USER_THROUGH_SIGNUP
  7811. * @static
  7812. */
  7813. ParseError.MUST_CREATE_USER_THROUGH_SIGNUP = 207;
  7814. /**
  7815. * Error code indicating that an an account being linked is already linked
  7816. * to another user.
  7817. *
  7818. * @property {number} ACCOUNT_ALREADY_LINKED
  7819. * @static
  7820. */
  7821. ParseError.ACCOUNT_ALREADY_LINKED = 208;
  7822. /**
  7823. * Error code indicating that the current session token is invalid.
  7824. *
  7825. * @property {number} INVALID_SESSION_TOKEN
  7826. * @static
  7827. */
  7828. ParseError.INVALID_SESSION_TOKEN = 209;
  7829. /**
  7830. * Error code indicating an error enabling or verifying MFA
  7831. *
  7832. * @property {number} MFA_ERROR
  7833. * @static
  7834. */
  7835. ParseError.MFA_ERROR = 210;
  7836. /**
  7837. * Error code indicating that a valid MFA token must be provided
  7838. *
  7839. * @property {number} MFA_TOKEN_REQUIRED
  7840. * @static
  7841. */
  7842. ParseError.MFA_TOKEN_REQUIRED = 211;
  7843. /**
  7844. * Error code indicating that a user cannot be linked to an account because
  7845. * that account's id could not be found.
  7846. *
  7847. * @property {number} LINKED_ID_MISSING
  7848. * @static
  7849. */
  7850. ParseError.LINKED_ID_MISSING = 250;
  7851. /**
  7852. * Error code indicating that a user with a linked (e.g. Facebook) account
  7853. * has an invalid session.
  7854. *
  7855. * @property {number} INVALID_LINKED_SESSION
  7856. * @static
  7857. */
  7858. ParseError.INVALID_LINKED_SESSION = 251;
  7859. /**
  7860. * Error code indicating that a service being linked (e.g. Facebook or
  7861. * Twitter) is unsupported.
  7862. *
  7863. * @property {number} UNSUPPORTED_SERVICE
  7864. * @static
  7865. */
  7866. ParseError.UNSUPPORTED_SERVICE = 252;
  7867. /**
  7868. * Error code indicating an invalid operation occured on schema
  7869. *
  7870. * @property {number} INVALID_SCHEMA_OPERATION
  7871. * @static
  7872. */
  7873. ParseError.INVALID_SCHEMA_OPERATION = 255;
  7874. /**
  7875. * Error code indicating that there were multiple errors. Aggregate errors
  7876. * have an "errors" property, which is an array of error objects with more
  7877. * detail about each error that occurred.
  7878. *
  7879. * @property {number} AGGREGATE_ERROR
  7880. * @static
  7881. */
  7882. ParseError.AGGREGATE_ERROR = 600;
  7883. /**
  7884. * Error code indicating the client was unable to read an input file.
  7885. *
  7886. * @property {number} FILE_READ_ERROR
  7887. * @static
  7888. */
  7889. ParseError.FILE_READ_ERROR = 601;
  7890. /**
  7891. * Error code indicating a real error code is unavailable because
  7892. * we had to use an XDomainRequest object to allow CORS requests in
  7893. * Internet Explorer, which strips the body from HTTP responses that have
  7894. * a non-2XX status code.
  7895. *
  7896. * @property {number} X_DOMAIN_REQUEST
  7897. * @static
  7898. */
  7899. ParseError.X_DOMAIN_REQUEST = 602;
  7900. var _default = ParseError;
  7901. exports.default = _default;
  7902. },{"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/assertThisInitialized":120,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/wrapNativeSuper":143}],22:[function(_dereq_,module,exports){
  7903. "use strict";
  7904. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  7905. var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
  7906. var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
  7907. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  7908. var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
  7909. var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
  7910. var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
  7911. var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  7912. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  7913. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  7914. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  7915. var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  7916. var _forEachInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  7917. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  7918. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  7919. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  7920. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  7921. _Object$defineProperty(exports, "__esModule", {
  7922. value: true
  7923. });
  7924. exports.default = void 0;
  7925. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  7926. var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
  7927. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  7928. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  7929. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  7930. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  7931. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  7932. var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
  7933. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  7934. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  7935. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  7936. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  7937. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  7938. function ownKeys(object, enumerableOnly) {
  7939. var keys = _Object$keys2(object);
  7940. if (_Object$getOwnPropertySymbols) {
  7941. var symbols = _Object$getOwnPropertySymbols(object);
  7942. enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
  7943. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  7944. })), keys.push.apply(keys, symbols);
  7945. }
  7946. return keys;
  7947. }
  7948. function _objectSpread(target) {
  7949. for (var i = 1; i < arguments.length; i++) {
  7950. var _context10, _context11;
  7951. var source = null != arguments[i] ? arguments[i] : {};
  7952. i % 2 ? _forEachInstanceProperty2(_context10 = ownKeys(Object(source), !0)).call(_context10, function (key) {
  7953. (0, _defineProperty2.default)(target, key, source[key]);
  7954. }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context11 = ownKeys(Object(source))).call(_context11, function (key) {
  7955. _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
  7956. });
  7957. }
  7958. return target;
  7959. }
  7960. function _regeneratorRuntime() {
  7961. "use strict";
  7962. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  7963. _regeneratorRuntime = function () {
  7964. return exports;
  7965. };
  7966. var exports = {},
  7967. Op = Object.prototype,
  7968. hasOwn = Op.hasOwnProperty,
  7969. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  7970. iteratorSymbol = $Symbol.iterator || "@@iterator",
  7971. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  7972. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7973. function define(obj, key, value) {
  7974. return _Object$defineProperty(obj, key, {
  7975. value: value,
  7976. enumerable: !0,
  7977. configurable: !0,
  7978. writable: !0
  7979. }), obj[key];
  7980. }
  7981. try {
  7982. define({}, "");
  7983. } catch (err) {
  7984. define = function (obj, key, value) {
  7985. return obj[key] = value;
  7986. };
  7987. }
  7988. function wrap(innerFn, outerFn, self, tryLocsList) {
  7989. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  7990. generator = _Object$create(protoGenerator.prototype),
  7991. context = new Context(tryLocsList || []);
  7992. return generator._invoke = function (innerFn, self, context) {
  7993. var state = "suspendedStart";
  7994. return function (method, arg) {
  7995. if ("executing" === state) throw new Error("Generator is already running");
  7996. if ("completed" === state) {
  7997. if ("throw" === method) throw arg;
  7998. return doneResult();
  7999. }
  8000. for (context.method = method, context.arg = arg;;) {
  8001. var delegate = context.delegate;
  8002. if (delegate) {
  8003. var delegateResult = maybeInvokeDelegate(delegate, context);
  8004. if (delegateResult) {
  8005. if (delegateResult === ContinueSentinel) continue;
  8006. return delegateResult;
  8007. }
  8008. }
  8009. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  8010. if ("suspendedStart" === state) throw state = "completed", context.arg;
  8011. context.dispatchException(context.arg);
  8012. } else "return" === context.method && context.abrupt("return", context.arg);
  8013. state = "executing";
  8014. var record = tryCatch(innerFn, self, context);
  8015. if ("normal" === record.type) {
  8016. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  8017. return {
  8018. value: record.arg,
  8019. done: context.done
  8020. };
  8021. }
  8022. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  8023. }
  8024. };
  8025. }(innerFn, self, context), generator;
  8026. }
  8027. function tryCatch(fn, obj, arg) {
  8028. try {
  8029. return {
  8030. type: "normal",
  8031. arg: fn.call(obj, arg)
  8032. };
  8033. } catch (err) {
  8034. return {
  8035. type: "throw",
  8036. arg: err
  8037. };
  8038. }
  8039. }
  8040. exports.wrap = wrap;
  8041. var ContinueSentinel = {};
  8042. function Generator() {}
  8043. function GeneratorFunction() {}
  8044. function GeneratorFunctionPrototype() {}
  8045. var IteratorPrototype = {};
  8046. define(IteratorPrototype, iteratorSymbol, function () {
  8047. return this;
  8048. });
  8049. var getProto = _Object$getPrototypeOf,
  8050. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  8051. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  8052. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  8053. function defineIteratorMethods(prototype) {
  8054. var _context8;
  8055. _forEachInstanceProperty2(_context8 = ["next", "throw", "return"]).call(_context8, function (method) {
  8056. define(prototype, method, function (arg) {
  8057. return this._invoke(method, arg);
  8058. });
  8059. });
  8060. }
  8061. function AsyncIterator(generator, PromiseImpl) {
  8062. function invoke(method, arg, resolve, reject) {
  8063. var record = tryCatch(generator[method], generator, arg);
  8064. if ("throw" !== record.type) {
  8065. var result = record.arg,
  8066. value = result.value;
  8067. return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  8068. invoke("next", value, resolve, reject);
  8069. }, function (err) {
  8070. invoke("throw", err, resolve, reject);
  8071. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  8072. result.value = unwrapped, resolve(result);
  8073. }, function (error) {
  8074. return invoke("throw", error, resolve, reject);
  8075. });
  8076. }
  8077. reject(record.arg);
  8078. }
  8079. var previousPromise;
  8080. this._invoke = function (method, arg) {
  8081. function callInvokeWithMethodAndArg() {
  8082. return new PromiseImpl(function (resolve, reject) {
  8083. invoke(method, arg, resolve, reject);
  8084. });
  8085. }
  8086. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  8087. };
  8088. }
  8089. function maybeInvokeDelegate(delegate, context) {
  8090. var method = delegate.iterator[context.method];
  8091. if (undefined === method) {
  8092. if (context.delegate = null, "throw" === context.method) {
  8093. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  8094. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  8095. }
  8096. return ContinueSentinel;
  8097. }
  8098. var record = tryCatch(method, delegate.iterator, context.arg);
  8099. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  8100. var info = record.arg;
  8101. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  8102. }
  8103. function pushTryEntry(locs) {
  8104. var entry = {
  8105. tryLoc: locs[0]
  8106. };
  8107. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  8108. }
  8109. function resetTryEntry(entry) {
  8110. var record = entry.completion || {};
  8111. record.type = "normal", delete record.arg, entry.completion = record;
  8112. }
  8113. function Context(tryLocsList) {
  8114. this.tryEntries = [{
  8115. tryLoc: "root"
  8116. }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  8117. }
  8118. function values(iterable) {
  8119. if (iterable) {
  8120. var iteratorMethod = iterable[iteratorSymbol];
  8121. if (iteratorMethod) return iteratorMethod.call(iterable);
  8122. if ("function" == typeof iterable.next) return iterable;
  8123. if (!isNaN(iterable.length)) {
  8124. var i = -1,
  8125. next = function next() {
  8126. for (; ++i < iterable.length;) {
  8127. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  8128. }
  8129. return next.value = undefined, next.done = !0, next;
  8130. };
  8131. return next.next = next;
  8132. }
  8133. }
  8134. return {
  8135. next: doneResult
  8136. };
  8137. }
  8138. function doneResult() {
  8139. return {
  8140. value: undefined,
  8141. done: !0
  8142. };
  8143. }
  8144. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  8145. var ctor = "function" == typeof genFun && genFun.constructor;
  8146. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  8147. }, exports.mark = function (genFun) {
  8148. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  8149. }, exports.awrap = function (arg) {
  8150. return {
  8151. __await: arg
  8152. };
  8153. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  8154. return this;
  8155. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  8156. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  8157. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  8158. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  8159. return result.done ? result.value : iter.next();
  8160. });
  8161. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  8162. return this;
  8163. }), define(Gp, "toString", function () {
  8164. return "[object Generator]";
  8165. }), exports.keys = function (object) {
  8166. var keys = [];
  8167. for (var key in object) {
  8168. keys.push(key);
  8169. }
  8170. return _reverseInstanceProperty(keys).call(keys), function next() {
  8171. for (; keys.length;) {
  8172. var key = keys.pop();
  8173. if (key in object) return next.value = key, next.done = !1, next;
  8174. }
  8175. return next.done = !0, next;
  8176. };
  8177. }, exports.values = values, Context.prototype = {
  8178. constructor: Context,
  8179. reset: function (skipTempReset) {
  8180. var _context9;
  8181. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context9 = this.tryEntries).call(_context9, resetTryEntry), !skipTempReset) for (var name in this) {
  8182. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty2(name).call(name, 1)) && (this[name] = undefined);
  8183. }
  8184. },
  8185. stop: function () {
  8186. this.done = !0;
  8187. var rootRecord = this.tryEntries[0].completion;
  8188. if ("throw" === rootRecord.type) throw rootRecord.arg;
  8189. return this.rval;
  8190. },
  8191. dispatchException: function (exception) {
  8192. if (this.done) throw exception;
  8193. var context = this;
  8194. function handle(loc, caught) {
  8195. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  8196. }
  8197. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8198. var entry = this.tryEntries[i],
  8199. record = entry.completion;
  8200. if ("root" === entry.tryLoc) return handle("end");
  8201. if (entry.tryLoc <= this.prev) {
  8202. var hasCatch = hasOwn.call(entry, "catchLoc"),
  8203. hasFinally = hasOwn.call(entry, "finallyLoc");
  8204. if (hasCatch && hasFinally) {
  8205. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  8206. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  8207. } else if (hasCatch) {
  8208. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  8209. } else {
  8210. if (!hasFinally) throw new Error("try statement without catch or finally");
  8211. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  8212. }
  8213. }
  8214. }
  8215. },
  8216. abrupt: function (type, arg) {
  8217. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8218. var entry = this.tryEntries[i];
  8219. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  8220. var finallyEntry = entry;
  8221. break;
  8222. }
  8223. }
  8224. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  8225. var record = finallyEntry ? finallyEntry.completion : {};
  8226. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  8227. },
  8228. complete: function (record, afterLoc) {
  8229. if ("throw" === record.type) throw record.arg;
  8230. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  8231. },
  8232. finish: function (finallyLoc) {
  8233. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8234. var entry = this.tryEntries[i];
  8235. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  8236. }
  8237. },
  8238. catch: function (tryLoc) {
  8239. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8240. var entry = this.tryEntries[i];
  8241. if (entry.tryLoc === tryLoc) {
  8242. var record = entry.completion;
  8243. if ("throw" === record.type) {
  8244. var thrown = record.arg;
  8245. resetTryEntry(entry);
  8246. }
  8247. return thrown;
  8248. }
  8249. }
  8250. throw new Error("illegal catch attempt");
  8251. },
  8252. delegateYield: function (iterable, resultName, nextLoc) {
  8253. return this.delegate = {
  8254. iterator: values(iterable),
  8255. resultName: resultName,
  8256. nextLoc: nextLoc
  8257. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  8258. }
  8259. }, exports;
  8260. }
  8261. var ParseError = _dereq_('./ParseError').default;
  8262. var XHR = null;
  8263. if (typeof XMLHttpRequest !== 'undefined') {
  8264. XHR = XMLHttpRequest;
  8265. }
  8266. XHR = _dereq_('./Xhr.weapp');
  8267. /*:: type Base64 = { base64: string };*/
  8268. /*:: type Uri = { uri: string };*/
  8269. /*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
  8270. /*:: export type FileSource =
  8271. | {
  8272. format: 'file',
  8273. file: Blob,
  8274. type: string,
  8275. }
  8276. | {
  8277. format: 'base64',
  8278. base64: string,
  8279. type: string,
  8280. }
  8281. | {
  8282. format: 'uri',
  8283. uri: string,
  8284. type: string,
  8285. };*/
  8286. function b64Digit(number
  8287. /*: number*/
  8288. )
  8289. /*: string*/
  8290. {
  8291. if (number < 26) {
  8292. return String.fromCharCode(65 + number);
  8293. }
  8294. if (number < 52) {
  8295. return String.fromCharCode(97 + (number - 26));
  8296. }
  8297. if (number < 62) {
  8298. return String.fromCharCode(48 + (number - 52));
  8299. }
  8300. if (number === 62) {
  8301. return '+';
  8302. }
  8303. if (number === 63) {
  8304. return '/';
  8305. }
  8306. throw new TypeError('Tried to encode large digit ' + number + ' in base64.');
  8307. }
  8308. /**
  8309. * A Parse.File is a local representation of a file that is saved to the Parse
  8310. * cloud.
  8311. *
  8312. * @alias Parse.File
  8313. */
  8314. var ParseFile = /*#__PURE__*/function () {
  8315. /**
  8316. * @param name {String} The file's name. This will be prefixed by a unique
  8317. * value once the file has finished saving. The file name must begin with
  8318. * an alphanumeric character, and consist of alphanumeric characters,
  8319. * periods, spaces, underscores, or dashes.
  8320. * @param data {Array} The data for the file, as either:
  8321. * 1. an Array of byte value Numbers, or
  8322. * 2. an Object like { base64: "..." } with a base64-encoded String.
  8323. * 3. an Object like { uri: "..." } with a uri String.
  8324. * 4. a File object selected with a file upload control. (3) only works
  8325. * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.
  8326. * For example:
  8327. * <pre>
  8328. * var fileUploadControl = $("#profilePhotoFileUpload")[0];
  8329. * if (fileUploadControl.files.length > 0) {
  8330. * var file = fileUploadControl.files[0];
  8331. * var name = "photo.jpg";
  8332. * var parseFile = new Parse.File(name, file);
  8333. * parseFile.save().then(function() {
  8334. * // The file has been saved to Parse.
  8335. * }, function(error) {
  8336. * // The file either could not be read, or could not be saved to Parse.
  8337. * });
  8338. * }</pre>
  8339. * @param type {String} Optional Content-Type header to use for the file. If
  8340. * this is omitted, the content type will be inferred from the name's
  8341. * extension.
  8342. * @param metadata {Object} Optional key value pairs to be stored with file object
  8343. * @param tags {Object} Optional key value pairs to be stored with file object
  8344. */
  8345. function ParseFile(name
  8346. /*: string*/
  8347. , data
  8348. /*:: ?: FileData*/
  8349. , type
  8350. /*:: ?: string*/
  8351. , metadata
  8352. /*:: ?: Object*/
  8353. , tags
  8354. /*:: ?: Object*/
  8355. ) {
  8356. (0, _classCallCheck2.default)(this, ParseFile);
  8357. (0, _defineProperty2.default)(this, "_name", void 0);
  8358. (0, _defineProperty2.default)(this, "_url", void 0);
  8359. (0, _defineProperty2.default)(this, "_source", void 0);
  8360. (0, _defineProperty2.default)(this, "_previousSave", void 0);
  8361. (0, _defineProperty2.default)(this, "_data", void 0);
  8362. (0, _defineProperty2.default)(this, "_requestTask", void 0);
  8363. (0, _defineProperty2.default)(this, "_metadata", void 0);
  8364. (0, _defineProperty2.default)(this, "_tags", void 0);
  8365. var specifiedType = type || '';
  8366. this._name = name;
  8367. this._metadata = metadata || {};
  8368. this._tags = tags || {};
  8369. if (data !== undefined) {
  8370. if ((0, _isArray.default)(data)) {
  8371. this._data = ParseFile.encodeBase64(data);
  8372. this._source = {
  8373. format: 'base64',
  8374. base64: this._data,
  8375. type: specifiedType
  8376. };
  8377. } else if (typeof Blob !== 'undefined' && data instanceof Blob) {
  8378. this._source = {
  8379. format: 'file',
  8380. file: data,
  8381. type: specifiedType
  8382. };
  8383. } else if (data && typeof data.uri === 'string' && data.uri !== undefined) {
  8384. this._source = {
  8385. format: 'uri',
  8386. uri: data.uri,
  8387. type: specifiedType
  8388. };
  8389. } else if (data && typeof data.base64 === 'string') {
  8390. var _context, _context2, _context3;
  8391. var base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];
  8392. var dataType = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || 'text/plain';
  8393. this._data = base64;
  8394. this._source = {
  8395. format: 'base64',
  8396. base64: base64,
  8397. type: dataType
  8398. };
  8399. } else {
  8400. throw new TypeError('Cannot create a Parse.File with that data.');
  8401. }
  8402. }
  8403. }
  8404. /**
  8405. * Return the data for the file, downloading it if not already present.
  8406. * Data is present if initialized with Byte Array, Base64 or Saved with Uri.
  8407. * Data is cleared if saved with File object selected with a file upload control
  8408. *
  8409. * @returns {Promise} Promise that is resolve with base64 data
  8410. */
  8411. (0, _createClass2.default)(ParseFile, [{
  8412. key: "getData",
  8413. value: function () {
  8414. var _getData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  8415. var _this = this;
  8416. var options, controller, result;
  8417. return _regeneratorRuntime().wrap(function (_context4) {
  8418. while (1) {
  8419. switch (_context4.prev = _context4.next) {
  8420. case 0:
  8421. if (!this._data) {
  8422. _context4.next = 2;
  8423. break;
  8424. }
  8425. return _context4.abrupt("return", this._data);
  8426. case 2:
  8427. if (this._url) {
  8428. _context4.next = 4;
  8429. break;
  8430. }
  8431. throw new Error('Cannot retrieve data for unsaved ParseFile.');
  8432. case 4:
  8433. options = {
  8434. requestTask: function (task) {
  8435. return _this._requestTask = task;
  8436. }
  8437. };
  8438. controller = _CoreManager.default.getFileController();
  8439. _context4.next = 8;
  8440. return controller.download(this._url, options);
  8441. case 8:
  8442. result = _context4.sent;
  8443. this._data = result.base64;
  8444. return _context4.abrupt("return", this._data);
  8445. case 11:
  8446. case "end":
  8447. return _context4.stop();
  8448. }
  8449. }
  8450. }, _callee, this);
  8451. }));
  8452. function getData() {
  8453. return _getData.apply(this, arguments);
  8454. }
  8455. return getData;
  8456. }()
  8457. /**
  8458. * Gets the name of the file. Before save is called, this is the filename
  8459. * given by the user. After save is called, that name gets prefixed with a
  8460. * unique identifier.
  8461. *
  8462. * @returns {string}
  8463. */
  8464. }, {
  8465. key: "name",
  8466. value: function ()
  8467. /*: string*/
  8468. {
  8469. return this._name;
  8470. }
  8471. /**
  8472. * Gets the url of the file. It is only available after you save the file or
  8473. * after you get the file from a Parse.Object.
  8474. *
  8475. * @param {object} options An object to specify url options
  8476. * @returns {string}
  8477. */
  8478. }, {
  8479. key: "url",
  8480. value: function (options
  8481. /*:: ?: { forceSecure?: boolean }*/
  8482. )
  8483. /*: ?string*/
  8484. {
  8485. options = options || {};
  8486. if (!this._url) {
  8487. return;
  8488. }
  8489. if (options.forceSecure) {
  8490. return this._url.replace(/^http:\/\//i, 'https://');
  8491. } else {
  8492. return this._url;
  8493. }
  8494. }
  8495. /**
  8496. * Gets the metadata of the file.
  8497. *
  8498. * @returns {object}
  8499. */
  8500. }, {
  8501. key: "metadata",
  8502. value: function ()
  8503. /*: Object*/
  8504. {
  8505. return this._metadata;
  8506. }
  8507. /**
  8508. * Gets the tags of the file.
  8509. *
  8510. * @returns {object}
  8511. */
  8512. }, {
  8513. key: "tags",
  8514. value: function ()
  8515. /*: Object*/
  8516. {
  8517. return this._tags;
  8518. }
  8519. /**
  8520. * Saves the file to the Parse cloud.
  8521. *
  8522. * @param {object} options
  8523. * * Valid options are:<ul>
  8524. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  8525. * be used for this request.
  8526. * <li>sessionToken: A valid session token, used for making a request on
  8527. * behalf of a specific user.
  8528. * <li>progress: In Browser only, callback for upload progress. For example:
  8529. * <pre>
  8530. * let parseFile = new Parse.File(name, file);
  8531. * parseFile.save({
  8532. * progress: (progressValue, loaded, total, { type }) => {
  8533. * if (type === "upload" && progressValue !== null) {
  8534. * // Update the UI using progressValue
  8535. * }
  8536. * }
  8537. * });
  8538. * </pre>
  8539. * </ul>
  8540. * @returns {Promise} Promise that is resolved when the save finishes.
  8541. */
  8542. }, {
  8543. key: "save",
  8544. value: function (options
  8545. /*:: ?: FullOptions*/
  8546. ) {
  8547. var _this2 = this;
  8548. options = options || {};
  8549. options.requestTask = function (task) {
  8550. return _this2._requestTask = task;
  8551. };
  8552. options.metadata = this._metadata;
  8553. options.tags = this._tags;
  8554. var controller = _CoreManager.default.getFileController();
  8555. if (!this._previousSave) {
  8556. if (this._source.format === 'file') {
  8557. this._previousSave = controller.saveFile(this._name, this._source, options).then(function (res) {
  8558. _this2._name = res.name;
  8559. _this2._url = res.url;
  8560. _this2._data = null;
  8561. _this2._requestTask = null;
  8562. return _this2;
  8563. });
  8564. } else if (this._source.format === 'uri') {
  8565. this._previousSave = controller.download(this._source.uri, options).then(function (result) {
  8566. if (!(result && result.base64)) {
  8567. return {};
  8568. }
  8569. var newSource = {
  8570. format: 'base64',
  8571. base64: result.base64,
  8572. type: result.contentType
  8573. };
  8574. _this2._data = result.base64;
  8575. _this2._requestTask = null;
  8576. return controller.saveBase64(_this2._name, newSource, options);
  8577. }).then(function (res) {
  8578. _this2._name = res.name;
  8579. _this2._url = res.url;
  8580. _this2._requestTask = null;
  8581. return _this2;
  8582. });
  8583. } else {
  8584. this._previousSave = controller.saveBase64(this._name, this._source, options).then(function (res) {
  8585. _this2._name = res.name;
  8586. _this2._url = res.url;
  8587. _this2._requestTask = null;
  8588. return _this2;
  8589. });
  8590. }
  8591. }
  8592. if (this._previousSave) {
  8593. return this._previousSave;
  8594. }
  8595. }
  8596. /**
  8597. * Aborts the request if it has already been sent.
  8598. */
  8599. }, {
  8600. key: "cancel",
  8601. value: function () {
  8602. if (this._requestTask && typeof this._requestTask.abort === 'function') {
  8603. this._requestTask.abort();
  8604. }
  8605. this._requestTask = null;
  8606. }
  8607. /**
  8608. * Deletes the file from the Parse cloud.
  8609. * In Cloud Code and Node only with Master Key.
  8610. *
  8611. * @param {object} options
  8612. * * Valid options are:<ul>
  8613. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  8614. * be used for this request.
  8615. * <pre>
  8616. * @returns {Promise} Promise that is resolved when the delete finishes.
  8617. */
  8618. }, {
  8619. key: "destroy",
  8620. value: function () {
  8621. var _this3 = this;
  8622. var options
  8623. /*:: ?: FullOptions*/
  8624. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8625. if (!this._name) {
  8626. throw new ParseError(ParseError.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');
  8627. }
  8628. var destroyOptions = {
  8629. useMasterKey: true
  8630. };
  8631. if (options.hasOwnProperty('useMasterKey')) {
  8632. destroyOptions.useMasterKey = options.useMasterKey;
  8633. }
  8634. var controller = _CoreManager.default.getFileController();
  8635. return controller.deleteFile(this._name, destroyOptions).then(function () {
  8636. _this3._data = null;
  8637. _this3._requestTask = null;
  8638. return _this3;
  8639. });
  8640. }
  8641. }, {
  8642. key: "toJSON",
  8643. value: function ()
  8644. /*: { name: ?string, url: ?string }*/
  8645. {
  8646. return {
  8647. __type: 'File',
  8648. name: this._name,
  8649. url: this._url
  8650. };
  8651. }
  8652. }, {
  8653. key: "equals",
  8654. value: function (other
  8655. /*: mixed*/
  8656. )
  8657. /*: boolean*/
  8658. {
  8659. if (this === other) {
  8660. return true;
  8661. } // Unsaved Files are never equal, since they will be saved to different URLs
  8662. return other instanceof ParseFile && this.name() === other.name() && this.url() === other.url() && typeof this.url() !== 'undefined';
  8663. }
  8664. /**
  8665. * Sets metadata to be saved with file object. Overwrites existing metadata
  8666. *
  8667. * @param {object} metadata Key value pairs to be stored with file object
  8668. */
  8669. }, {
  8670. key: "setMetadata",
  8671. value: function (metadata
  8672. /*: any*/
  8673. ) {
  8674. var _this4 = this;
  8675. if (metadata && (0, _typeof2.default)(metadata) === 'object') {
  8676. var _context5;
  8677. (0, _forEach.default)(_context5 = (0, _keys.default)(metadata)).call(_context5, function (key) {
  8678. _this4.addMetadata(key, metadata[key]);
  8679. });
  8680. }
  8681. }
  8682. /**
  8683. * Sets metadata to be saved with file object. Adds to existing metadata.
  8684. *
  8685. * @param {string} key key to store the metadata
  8686. * @param {*} value metadata
  8687. */
  8688. }, {
  8689. key: "addMetadata",
  8690. value: function (key
  8691. /*: string*/
  8692. , value
  8693. /*: any*/
  8694. ) {
  8695. if (typeof key === 'string') {
  8696. this._metadata[key] = value;
  8697. }
  8698. }
  8699. /**
  8700. * Sets tags to be saved with file object. Overwrites existing tags
  8701. *
  8702. * @param {object} tags Key value pairs to be stored with file object
  8703. */
  8704. }, {
  8705. key: "setTags",
  8706. value: function (tags
  8707. /*: any*/
  8708. ) {
  8709. var _this5 = this;
  8710. if (tags && (0, _typeof2.default)(tags) === 'object') {
  8711. var _context6;
  8712. (0, _forEach.default)(_context6 = (0, _keys.default)(tags)).call(_context6, function (key) {
  8713. _this5.addTag(key, tags[key]);
  8714. });
  8715. }
  8716. }
  8717. /**
  8718. * Sets tags to be saved with file object. Adds to existing tags.
  8719. *
  8720. * @param {string} key key to store tags
  8721. * @param {*} value tag
  8722. */
  8723. }, {
  8724. key: "addTag",
  8725. value: function (key
  8726. /*: string*/
  8727. , value
  8728. /*: string*/
  8729. ) {
  8730. if (typeof key === 'string') {
  8731. this._tags[key] = value;
  8732. }
  8733. }
  8734. }], [{
  8735. key: "fromJSON",
  8736. value: function (obj)
  8737. /*: ParseFile*/
  8738. {
  8739. if (obj.__type !== 'File') {
  8740. throw new TypeError('JSON object does not represent a ParseFile');
  8741. }
  8742. var file = new ParseFile(obj.name);
  8743. file._url = obj.url;
  8744. return file;
  8745. }
  8746. }, {
  8747. key: "encodeBase64",
  8748. value: function (bytes
  8749. /*: Array<number>*/
  8750. )
  8751. /*: string*/
  8752. {
  8753. var chunks = [];
  8754. chunks.length = Math.ceil(bytes.length / 3);
  8755. for (var i = 0; i < chunks.length; i++) {
  8756. var b1 = bytes[i * 3];
  8757. var b2 = bytes[i * 3 + 1] || 0;
  8758. var b3 = bytes[i * 3 + 2] || 0;
  8759. var has2 = i * 3 + 1 < bytes.length;
  8760. var has3 = i * 3 + 2 < bytes.length;
  8761. 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('');
  8762. }
  8763. return chunks.join('');
  8764. }
  8765. }]);
  8766. return ParseFile;
  8767. }();
  8768. var DefaultController = {
  8769. saveFile: function () {
  8770. var _saveFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name
  8771. /*: string*/
  8772. , source
  8773. /*: FileSource*/
  8774. , options
  8775. /*:: ?: FullOptions*/
  8776. ) {
  8777. var base64Data, _base64Data$split, _base64Data$split2, first, second, data, newSource;
  8778. return _regeneratorRuntime().wrap(function _callee2$(_context7) {
  8779. while (1) {
  8780. switch (_context7.prev = _context7.next) {
  8781. case 0:
  8782. if (!(source.format !== 'file')) {
  8783. _context7.next = 2;
  8784. break;
  8785. }
  8786. throw new Error('saveFile can only be used with File-type sources.');
  8787. case 2:
  8788. _context7.next = 4;
  8789. return new _promise.default(function (res, rej) {
  8790. // eslint-disable-next-line no-undef
  8791. var reader = new FileReader();
  8792. reader.onload = function () {
  8793. return res(reader.result);
  8794. };
  8795. reader.onerror = function (error) {
  8796. return rej(error);
  8797. };
  8798. reader.readAsDataURL(source.file);
  8799. });
  8800. case 4:
  8801. base64Data = _context7.sent; // we only want the data after the comma
  8802. // For example: "data:application/pdf;base64,JVBERi0xLjQKJ..." we would only want "JVBERi0xLjQKJ..."
  8803. _base64Data$split = base64Data.split(','), _base64Data$split2 = (0, _slicedToArray2.default)(_base64Data$split, 2), first = _base64Data$split2[0], second = _base64Data$split2[1]; // in the event there is no 'data:application/pdf;base64,' at the beginning of the base64 string
  8804. // use the entire string instead
  8805. data = second ? second : first;
  8806. newSource = {
  8807. format: 'base64',
  8808. base64: data,
  8809. type: source.type || (source.file ? source.file.type : null)
  8810. };
  8811. _context7.next = 10;
  8812. return DefaultController.saveBase64(name, newSource, options);
  8813. case 10:
  8814. return _context7.abrupt("return", _context7.sent);
  8815. case 11:
  8816. case "end":
  8817. return _context7.stop();
  8818. }
  8819. }
  8820. }, _callee2);
  8821. }));
  8822. function saveFile(_x, _x2, _x3) {
  8823. return _saveFile.apply(this, arguments);
  8824. }
  8825. return saveFile;
  8826. }(),
  8827. saveBase64: function saveBase64(name
  8828. /*: string*/
  8829. , source
  8830. /*: FileSource*/
  8831. , options
  8832. /*:: ?: FullOptions*/
  8833. ) {
  8834. if (source.format !== 'base64') {
  8835. throw new Error('saveBase64 can only be used with Base64-type sources.');
  8836. }
  8837. var data
  8838. /*: { base64: any, _ContentType?: any, fileData: Object }*/
  8839. = {
  8840. base64: source.base64,
  8841. fileData: {
  8842. metadata: _objectSpread({}, options.metadata),
  8843. tags: _objectSpread({}, options.tags)
  8844. }
  8845. };
  8846. delete options.metadata;
  8847. delete options.tags;
  8848. if (source.type) {
  8849. data._ContentType = source.type;
  8850. }
  8851. var path = 'files/' + name;
  8852. return _CoreManager.default.getRESTController().request('POST', path, data, options);
  8853. },
  8854. download: function download(uri, options) {
  8855. if (XHR) {
  8856. return this.downloadAjax(uri, options);
  8857. } else {
  8858. return _promise.default.reject('Cannot make a request: No definition of XMLHttpRequest was found.');
  8859. }
  8860. },
  8861. downloadAjax: function downloadAjax(uri, options) {
  8862. return new _promise.default(function (resolve, reject) {
  8863. var xhr = new XHR();
  8864. xhr.open('GET', uri, true);
  8865. xhr.responseType = 'arraybuffer';
  8866. xhr.onerror = function (e) {
  8867. reject(e);
  8868. };
  8869. xhr.onreadystatechange = function () {
  8870. if (xhr.readyState !== xhr.DONE) {
  8871. return;
  8872. }
  8873. if (!this.response) {
  8874. return resolve({});
  8875. }
  8876. var bytes = new Uint8Array(this.response);
  8877. resolve({
  8878. base64: ParseFile.encodeBase64(bytes),
  8879. contentType: xhr.getResponseHeader('content-type')
  8880. });
  8881. };
  8882. options.requestTask(xhr);
  8883. xhr.send();
  8884. });
  8885. },
  8886. deleteFile: function deleteFile(name
  8887. /*: string*/
  8888. , options
  8889. /*:: ?: FullOptions*/
  8890. ) {
  8891. var headers = {
  8892. 'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')
  8893. };
  8894. if (options.useMasterKey) {
  8895. headers['X-Parse-Master-Key'] = _CoreManager.default.get('MASTER_KEY');
  8896. }
  8897. var url = _CoreManager.default.get('SERVER_URL');
  8898. if (url[url.length - 1] !== '/') {
  8899. url += '/';
  8900. }
  8901. url += 'files/' + name;
  8902. return _CoreManager.default.getRESTController().ajax('DELETE', url, '', headers).catch(function (response) {
  8903. // TODO: return JSON object in server
  8904. if (!response || response === 'SyntaxError: Unexpected end of JSON input') {
  8905. return _promise.default.resolve();
  8906. } else {
  8907. return _CoreManager.default.getRESTController().handleError(response);
  8908. }
  8909. });
  8910. },
  8911. _setXHR: function _setXHR(xhr
  8912. /*: any*/
  8913. ) {
  8914. XHR = xhr;
  8915. },
  8916. _getXHR: function _getXHR() {
  8917. return XHR;
  8918. }
  8919. };
  8920. _CoreManager.default.setFileController(DefaultController);
  8921. var _default = ParseFile;
  8922. exports.default = _default;
  8923. exports.b64Digit = b64Digit;
  8924. },{"./CoreManager":4,"./ParseError":21,"./Xhr.weapp":43,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-properties":82,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":87,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":88,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/slicedToArray":138,"@babel/runtime-corejs3/helpers/typeof":141}],23:[function(_dereq_,module,exports){
  8925. "use strict";
  8926. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  8927. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  8928. _Object$defineProperty(exports, "__esModule", {
  8929. value: true
  8930. });
  8931. exports.default = void 0;
  8932. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  8933. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  8934. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  8935. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  8936. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  8937. /**
  8938. * Copyright (c) 2015-present, Parse, LLC.
  8939. * All rights reserved.
  8940. *
  8941. * This source code is licensed under the BSD-style license found in the
  8942. * LICENSE file in the root directory of this source tree. An additional grant
  8943. * of patent rights can be found in the PATENTS file in the same directory.
  8944. *
  8945. * @flow
  8946. */
  8947. /**
  8948. * Creates a new GeoPoint with any of the following forms:<br>
  8949. * <pre>
  8950. * new GeoPoint(otherGeoPoint)
  8951. * new GeoPoint(30, 30)
  8952. * new GeoPoint([30, 30])
  8953. * new GeoPoint({latitude: 30, longitude: 30})
  8954. * new GeoPoint() // defaults to (0, 0)
  8955. * </pre>
  8956. * <p>Represents a latitude / longitude point that may be associated
  8957. * with a key in a ParseObject or used as a reference point for geo queries.
  8958. * This allows proximity-based queries on the key.</p>
  8959. *
  8960. * <p>Only one key in a class may contain a GeoPoint.</p>
  8961. *
  8962. * <p>Example:<pre>
  8963. * var point = new Parse.GeoPoint(30.0, -20.0);
  8964. * var object = new Parse.Object("PlaceObject");
  8965. * object.set("location", point);
  8966. * object.save();</pre></p>
  8967. *
  8968. * @alias Parse.GeoPoint
  8969. */
  8970. /* global navigator */
  8971. var ParseGeoPoint = /*#__PURE__*/function () {
  8972. /**
  8973. * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
  8974. * @param {number} arg2 The longitude of the GeoPoint
  8975. */
  8976. function ParseGeoPoint(arg1
  8977. /*: Array<number> | { latitude: number, longitude: number } | number*/
  8978. , arg2
  8979. /*:: ?: number*/
  8980. ) {
  8981. (0, _classCallCheck2.default)(this, ParseGeoPoint);
  8982. (0, _defineProperty2.default)(this, "_latitude", void 0);
  8983. (0, _defineProperty2.default)(this, "_longitude", void 0);
  8984. if ((0, _isArray.default)(arg1)) {
  8985. ParseGeoPoint._validate(arg1[0], arg1[1]);
  8986. this._latitude = arg1[0];
  8987. this._longitude = arg1[1];
  8988. } else if ((0, _typeof2.default)(arg1) === 'object') {
  8989. ParseGeoPoint._validate(arg1.latitude, arg1.longitude);
  8990. this._latitude = arg1.latitude;
  8991. this._longitude = arg1.longitude;
  8992. } else if (arg1 !== undefined && arg2 !== undefined) {
  8993. ParseGeoPoint._validate(arg1, arg2);
  8994. this._latitude = arg1;
  8995. this._longitude = arg2;
  8996. } else {
  8997. this._latitude = 0;
  8998. this._longitude = 0;
  8999. }
  9000. }
  9001. /**
  9002. * North-south portion of the coordinate, in range [-90, 90].
  9003. * Throws an exception if set out of range in a modern browser.
  9004. *
  9005. * @property {number} latitude
  9006. * @returns {number}
  9007. */
  9008. (0, _createClass2.default)(ParseGeoPoint, [{
  9009. key: "latitude",
  9010. get: function ()
  9011. /*: number*/
  9012. {
  9013. return this._latitude;
  9014. },
  9015. set: function (val
  9016. /*: number*/
  9017. ) {
  9018. ParseGeoPoint._validate(val, this.longitude);
  9019. this._latitude = val;
  9020. }
  9021. /**
  9022. * East-west portion of the coordinate, in range [-180, 180].
  9023. * Throws if set out of range in a modern browser.
  9024. *
  9025. * @property {number} longitude
  9026. * @returns {number}
  9027. */
  9028. }, {
  9029. key: "longitude",
  9030. get: function ()
  9031. /*: number*/
  9032. {
  9033. return this._longitude;
  9034. },
  9035. set: function (val
  9036. /*: number*/
  9037. ) {
  9038. ParseGeoPoint._validate(this.latitude, val);
  9039. this._longitude = val;
  9040. }
  9041. /**
  9042. * Returns a JSON representation of the GeoPoint, suitable for Parse.
  9043. *
  9044. * @returns {object}
  9045. */
  9046. }, {
  9047. key: "toJSON",
  9048. value: function ()
  9049. /*: { __type: string, latitude: number, longitude: number }*/
  9050. {
  9051. ParseGeoPoint._validate(this._latitude, this._longitude);
  9052. return {
  9053. __type: 'GeoPoint',
  9054. latitude: this._latitude,
  9055. longitude: this._longitude
  9056. };
  9057. }
  9058. }, {
  9059. key: "equals",
  9060. value: function (other
  9061. /*: mixed*/
  9062. )
  9063. /*: boolean*/
  9064. {
  9065. return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
  9066. }
  9067. /**
  9068. * Returns the distance from this GeoPoint to another in radians.
  9069. *
  9070. * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
  9071. * @returns {number}
  9072. */
  9073. }, {
  9074. key: "radiansTo",
  9075. value: function (point
  9076. /*: ParseGeoPoint*/
  9077. )
  9078. /*: number*/
  9079. {
  9080. var d2r = Math.PI / 180.0;
  9081. var lat1rad = this.latitude * d2r;
  9082. var long1rad = this.longitude * d2r;
  9083. var lat2rad = point.latitude * d2r;
  9084. var long2rad = point.longitude * d2r;
  9085. var sinDeltaLatDiv2 = Math.sin((lat1rad - lat2rad) / 2);
  9086. var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2); // Square of half the straight line chord distance between both points.
  9087. var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
  9088. a = Math.min(1.0, a);
  9089. return 2 * Math.asin(Math.sqrt(a));
  9090. }
  9091. /**
  9092. * Returns the distance from this GeoPoint to another in kilometers.
  9093. *
  9094. * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
  9095. * @returns {number}
  9096. */
  9097. }, {
  9098. key: "kilometersTo",
  9099. value: function (point
  9100. /*: ParseGeoPoint*/
  9101. )
  9102. /*: number*/
  9103. {
  9104. return this.radiansTo(point) * 6371.0;
  9105. }
  9106. /**
  9107. * Returns the distance from this GeoPoint to another in miles.
  9108. *
  9109. * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
  9110. * @returns {number}
  9111. */
  9112. }, {
  9113. key: "milesTo",
  9114. value: function (point
  9115. /*: ParseGeoPoint*/
  9116. )
  9117. /*: number*/
  9118. {
  9119. return this.radiansTo(point) * 3958.8;
  9120. }
  9121. /*
  9122. * Throws an exception if the given lat-long is out of bounds.
  9123. */
  9124. }], [{
  9125. key: "_validate",
  9126. value: function (latitude
  9127. /*: number*/
  9128. , longitude
  9129. /*: number*/
  9130. ) {
  9131. if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
  9132. throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
  9133. }
  9134. if (latitude < -90.0) {
  9135. throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
  9136. }
  9137. if (latitude > 90.0) {
  9138. throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
  9139. }
  9140. if (longitude < -180.0) {
  9141. throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
  9142. }
  9143. if (longitude > 180.0) {
  9144. throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
  9145. }
  9146. }
  9147. /**
  9148. * Creates a GeoPoint with the user's current location, if available.
  9149. *
  9150. * @static
  9151. * @returns {Parse.GeoPoint} User's current location
  9152. */
  9153. }, {
  9154. key: "current",
  9155. value: function () {
  9156. return navigator.geolocation.getCurrentPosition(function (location) {
  9157. return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
  9158. });
  9159. }
  9160. }]);
  9161. return ParseGeoPoint;
  9162. }();
  9163. var _default = ParseGeoPoint;
  9164. exports.default = _default;
  9165. },{"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],24:[function(_dereq_,module,exports){
  9166. "use strict";
  9167. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  9168. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  9169. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  9170. _Object$defineProperty(exports, "__esModule", {
  9171. value: true
  9172. });
  9173. exports.default = void 0;
  9174. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  9175. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  9176. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  9177. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  9178. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  9179. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  9180. var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
  9181. function _createSuper(Derived) {
  9182. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  9183. return function () {
  9184. var Super = (0, _getPrototypeOf2.default)(Derived),
  9185. result;
  9186. if (hasNativeReflectConstruct) {
  9187. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  9188. result = _Reflect$construct(Super, arguments, NewTarget);
  9189. } else {
  9190. result = Super.apply(this, arguments);
  9191. }
  9192. return (0, _possibleConstructorReturn2.default)(this, result);
  9193. };
  9194. }
  9195. function _isNativeReflectConstruct() {
  9196. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  9197. if (_Reflect$construct.sham) return false;
  9198. if (typeof Proxy === "function") return true;
  9199. try {
  9200. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  9201. return true;
  9202. } catch (e) {
  9203. return false;
  9204. }
  9205. }
  9206. var Installation = /*#__PURE__*/function (_ParseObject) {
  9207. (0, _inherits2.default)(Installation, _ParseObject);
  9208. var _super = _createSuper(Installation);
  9209. function Installation(attributes
  9210. /*: ?AttributeMap*/
  9211. ) {
  9212. var _this;
  9213. (0, _classCallCheck2.default)(this, Installation);
  9214. _this = _super.call(this, '_Installation');
  9215. if (attributes && (0, _typeof2.default)(attributes) === 'object') {
  9216. if (!_this.set(attributes || {})) {
  9217. throw new Error("Can't create an invalid Installation");
  9218. }
  9219. }
  9220. return _this;
  9221. }
  9222. return (0, _createClass2.default)(Installation);
  9223. }(_ParseObject2.default);
  9224. exports.default = Installation;
  9225. _ParseObject2.default.registerSubclass('_Installation', Installation);
  9226. },{"./ParseObject":26,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/typeof":141}],25:[function(_dereq_,module,exports){
  9227. "use strict";
  9228. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  9229. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  9230. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  9231. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  9232. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  9233. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  9234. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  9235. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  9236. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  9237. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  9238. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  9239. _Object$defineProperty(exports, "__esModule", {
  9240. value: true
  9241. });
  9242. exports.default = void 0;
  9243. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  9244. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  9245. var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
  9246. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  9247. var _EventEmitter = _interopRequireDefault(_dereq_("./EventEmitter"));
  9248. var _LiveQueryClient = _interopRequireDefault(_dereq_("./LiveQueryClient"));
  9249. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  9250. function _regeneratorRuntime() {
  9251. "use strict";
  9252. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  9253. _regeneratorRuntime = function () {
  9254. return exports;
  9255. };
  9256. var exports = {},
  9257. Op = Object.prototype,
  9258. hasOwn = Op.hasOwnProperty,
  9259. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  9260. iteratorSymbol = $Symbol.iterator || "@@iterator",
  9261. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  9262. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  9263. function define(obj, key, value) {
  9264. return _Object$defineProperty(obj, key, {
  9265. value: value,
  9266. enumerable: !0,
  9267. configurable: !0,
  9268. writable: !0
  9269. }), obj[key];
  9270. }
  9271. try {
  9272. define({}, "");
  9273. } catch (err) {
  9274. define = function (obj, key, value) {
  9275. return obj[key] = value;
  9276. };
  9277. }
  9278. function wrap(innerFn, outerFn, self, tryLocsList) {
  9279. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  9280. generator = _Object$create(protoGenerator.prototype),
  9281. context = new Context(tryLocsList || []);
  9282. return generator._invoke = function (innerFn, self, context) {
  9283. var state = "suspendedStart";
  9284. return function (method, arg) {
  9285. if ("executing" === state) throw new Error("Generator is already running");
  9286. if ("completed" === state) {
  9287. if ("throw" === method) throw arg;
  9288. return doneResult();
  9289. }
  9290. for (context.method = method, context.arg = arg;;) {
  9291. var delegate = context.delegate;
  9292. if (delegate) {
  9293. var delegateResult = maybeInvokeDelegate(delegate, context);
  9294. if (delegateResult) {
  9295. if (delegateResult === ContinueSentinel) continue;
  9296. return delegateResult;
  9297. }
  9298. }
  9299. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  9300. if ("suspendedStart" === state) throw state = "completed", context.arg;
  9301. context.dispatchException(context.arg);
  9302. } else "return" === context.method && context.abrupt("return", context.arg);
  9303. state = "executing";
  9304. var record = tryCatch(innerFn, self, context);
  9305. if ("normal" === record.type) {
  9306. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  9307. return {
  9308. value: record.arg,
  9309. done: context.done
  9310. };
  9311. }
  9312. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  9313. }
  9314. };
  9315. }(innerFn, self, context), generator;
  9316. }
  9317. function tryCatch(fn, obj, arg) {
  9318. try {
  9319. return {
  9320. type: "normal",
  9321. arg: fn.call(obj, arg)
  9322. };
  9323. } catch (err) {
  9324. return {
  9325. type: "throw",
  9326. arg: err
  9327. };
  9328. }
  9329. }
  9330. exports.wrap = wrap;
  9331. var ContinueSentinel = {};
  9332. function Generator() {}
  9333. function GeneratorFunction() {}
  9334. function GeneratorFunctionPrototype() {}
  9335. var IteratorPrototype = {};
  9336. define(IteratorPrototype, iteratorSymbol, function () {
  9337. return this;
  9338. });
  9339. var getProto = _Object$getPrototypeOf,
  9340. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  9341. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  9342. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  9343. function defineIteratorMethods(prototype) {
  9344. var _context4;
  9345. _forEachInstanceProperty(_context4 = ["next", "throw", "return"]).call(_context4, function (method) {
  9346. define(prototype, method, function (arg) {
  9347. return this._invoke(method, arg);
  9348. });
  9349. });
  9350. }
  9351. function AsyncIterator(generator, PromiseImpl) {
  9352. function invoke(method, arg, resolve, reject) {
  9353. var record = tryCatch(generator[method], generator, arg);
  9354. if ("throw" !== record.type) {
  9355. var result = record.arg,
  9356. value = result.value;
  9357. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  9358. invoke("next", value, resolve, reject);
  9359. }, function (err) {
  9360. invoke("throw", err, resolve, reject);
  9361. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  9362. result.value = unwrapped, resolve(result);
  9363. }, function (error) {
  9364. return invoke("throw", error, resolve, reject);
  9365. });
  9366. }
  9367. reject(record.arg);
  9368. }
  9369. var previousPromise;
  9370. this._invoke = function (method, arg) {
  9371. function callInvokeWithMethodAndArg() {
  9372. return new PromiseImpl(function (resolve, reject) {
  9373. invoke(method, arg, resolve, reject);
  9374. });
  9375. }
  9376. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  9377. };
  9378. }
  9379. function maybeInvokeDelegate(delegate, context) {
  9380. var method = delegate.iterator[context.method];
  9381. if (undefined === method) {
  9382. if (context.delegate = null, "throw" === context.method) {
  9383. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  9384. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  9385. }
  9386. return ContinueSentinel;
  9387. }
  9388. var record = tryCatch(method, delegate.iterator, context.arg);
  9389. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  9390. var info = record.arg;
  9391. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  9392. }
  9393. function pushTryEntry(locs) {
  9394. var entry = {
  9395. tryLoc: locs[0]
  9396. };
  9397. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  9398. }
  9399. function resetTryEntry(entry) {
  9400. var record = entry.completion || {};
  9401. record.type = "normal", delete record.arg, entry.completion = record;
  9402. }
  9403. function Context(tryLocsList) {
  9404. this.tryEntries = [{
  9405. tryLoc: "root"
  9406. }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  9407. }
  9408. function values(iterable) {
  9409. if (iterable) {
  9410. var iteratorMethod = iterable[iteratorSymbol];
  9411. if (iteratorMethod) return iteratorMethod.call(iterable);
  9412. if ("function" == typeof iterable.next) return iterable;
  9413. if (!isNaN(iterable.length)) {
  9414. var i = -1,
  9415. next = function next() {
  9416. for (; ++i < iterable.length;) {
  9417. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  9418. }
  9419. return next.value = undefined, next.done = !0, next;
  9420. };
  9421. return next.next = next;
  9422. }
  9423. }
  9424. return {
  9425. next: doneResult
  9426. };
  9427. }
  9428. function doneResult() {
  9429. return {
  9430. value: undefined,
  9431. done: !0
  9432. };
  9433. }
  9434. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  9435. var ctor = "function" == typeof genFun && genFun.constructor;
  9436. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  9437. }, exports.mark = function (genFun) {
  9438. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  9439. }, exports.awrap = function (arg) {
  9440. return {
  9441. __await: arg
  9442. };
  9443. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  9444. return this;
  9445. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  9446. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  9447. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  9448. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  9449. return result.done ? result.value : iter.next();
  9450. });
  9451. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  9452. return this;
  9453. }), define(Gp, "toString", function () {
  9454. return "[object Generator]";
  9455. }), exports.keys = function (object) {
  9456. var keys = [];
  9457. for (var key in object) {
  9458. keys.push(key);
  9459. }
  9460. return _reverseInstanceProperty(keys).call(keys), function next() {
  9461. for (; keys.length;) {
  9462. var key = keys.pop();
  9463. if (key in object) return next.value = key, next.done = !1, next;
  9464. }
  9465. return next.done = !0, next;
  9466. };
  9467. }, exports.values = values, Context.prototype = {
  9468. constructor: Context,
  9469. reset: function (skipTempReset) {
  9470. var _context5;
  9471. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context5 = this.tryEntries).call(_context5, resetTryEntry), !skipTempReset) for (var name in this) {
  9472. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
  9473. }
  9474. },
  9475. stop: function () {
  9476. this.done = !0;
  9477. var rootRecord = this.tryEntries[0].completion;
  9478. if ("throw" === rootRecord.type) throw rootRecord.arg;
  9479. return this.rval;
  9480. },
  9481. dispatchException: function (exception) {
  9482. if (this.done) throw exception;
  9483. var context = this;
  9484. function handle(loc, caught) {
  9485. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  9486. }
  9487. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  9488. var entry = this.tryEntries[i],
  9489. record = entry.completion;
  9490. if ("root" === entry.tryLoc) return handle("end");
  9491. if (entry.tryLoc <= this.prev) {
  9492. var hasCatch = hasOwn.call(entry, "catchLoc"),
  9493. hasFinally = hasOwn.call(entry, "finallyLoc");
  9494. if (hasCatch && hasFinally) {
  9495. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  9496. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  9497. } else if (hasCatch) {
  9498. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  9499. } else {
  9500. if (!hasFinally) throw new Error("try statement without catch or finally");
  9501. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  9502. }
  9503. }
  9504. }
  9505. },
  9506. abrupt: function (type, arg) {
  9507. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  9508. var entry = this.tryEntries[i];
  9509. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  9510. var finallyEntry = entry;
  9511. break;
  9512. }
  9513. }
  9514. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  9515. var record = finallyEntry ? finallyEntry.completion : {};
  9516. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  9517. },
  9518. complete: function (record, afterLoc) {
  9519. if ("throw" === record.type) throw record.arg;
  9520. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  9521. },
  9522. finish: function (finallyLoc) {
  9523. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  9524. var entry = this.tryEntries[i];
  9525. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  9526. }
  9527. },
  9528. catch: function (tryLoc) {
  9529. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  9530. var entry = this.tryEntries[i];
  9531. if (entry.tryLoc === tryLoc) {
  9532. var record = entry.completion;
  9533. if ("throw" === record.type) {
  9534. var thrown = record.arg;
  9535. resetTryEntry(entry);
  9536. }
  9537. return thrown;
  9538. }
  9539. }
  9540. throw new Error("illegal catch attempt");
  9541. },
  9542. delegateYield: function (iterable, resultName, nextLoc) {
  9543. return this.delegate = {
  9544. iterator: values(iterable),
  9545. resultName: resultName,
  9546. nextLoc: nextLoc
  9547. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  9548. }
  9549. }, exports;
  9550. }
  9551. function getLiveQueryClient()
  9552. /*: LiveQueryClient*/
  9553. {
  9554. return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
  9555. }
  9556. /**
  9557. * We expose three events to help you monitor the status of the WebSocket connection:
  9558. *
  9559. * <p>Open - When we establish the WebSocket connection to the LiveQuery server, you'll get this event.
  9560. *
  9561. * <pre>
  9562. * Parse.LiveQuery.on('open', () => {
  9563. *
  9564. * });</pre></p>
  9565. *
  9566. * <p>Close - When we lose the WebSocket connection to the LiveQuery server, you'll get this event.
  9567. *
  9568. * <pre>
  9569. * Parse.LiveQuery.on('close', () => {
  9570. *
  9571. * });</pre></p>
  9572. *
  9573. * <p>Error - When some network error or LiveQuery server error happens, you'll get this event.
  9574. *
  9575. * <pre>
  9576. * Parse.LiveQuery.on('error', (error) => {
  9577. *
  9578. * });</pre></p>
  9579. *
  9580. * @class Parse.LiveQuery
  9581. * @static
  9582. */
  9583. var LiveQuery = new _EventEmitter.default();
  9584. /**
  9585. * After open is called, the LiveQuery will try to send a connect request
  9586. * to the LiveQuery server.
  9587. */
  9588. LiveQuery.open = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  9589. var liveQueryClient;
  9590. return _regeneratorRuntime().wrap(function _callee$(_context) {
  9591. while (1) {
  9592. switch (_context.prev = _context.next) {
  9593. case 0:
  9594. _context.next = 2;
  9595. return getLiveQueryClient();
  9596. case 2:
  9597. liveQueryClient = _context.sent;
  9598. liveQueryClient.open();
  9599. case 4:
  9600. case "end":
  9601. return _context.stop();
  9602. }
  9603. }
  9604. }, _callee);
  9605. }));
  9606. /**
  9607. * When you're done using LiveQuery, you can call Parse.LiveQuery.close().
  9608. * This function will close the WebSocket connection to the LiveQuery server,
  9609. * cancel the auto reconnect, and unsubscribe all subscriptions based on it.
  9610. * If you call query.subscribe() after this, we'll create a new WebSocket
  9611. * connection to the LiveQuery server.
  9612. */
  9613. LiveQuery.close = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
  9614. var liveQueryClient;
  9615. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  9616. while (1) {
  9617. switch (_context2.prev = _context2.next) {
  9618. case 0:
  9619. _context2.next = 2;
  9620. return getLiveQueryClient();
  9621. case 2:
  9622. liveQueryClient = _context2.sent;
  9623. liveQueryClient.close();
  9624. case 4:
  9625. case "end":
  9626. return _context2.stop();
  9627. }
  9628. }
  9629. }, _callee2);
  9630. })); // Register a default onError callback to make sure we do not crash on error
  9631. LiveQuery.on('error', function () {});
  9632. var _default = LiveQuery;
  9633. exports.default = _default;
  9634. var defaultLiveQueryClient;
  9635. var DefaultLiveQueryController = {
  9636. setDefaultLiveQueryClient: function setDefaultLiveQueryClient(liveQueryClient
  9637. /*: LiveQueryClient*/
  9638. ) {
  9639. defaultLiveQueryClient = liveQueryClient;
  9640. },
  9641. getDefaultLiveQueryClient: function getDefaultLiveQueryClient()
  9642. /*: Promise<LiveQueryClient>*/
  9643. {
  9644. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  9645. var _yield$Promise$all, _yield$Promise$all2, currentUser, installationId, sessionToken, liveQueryServerURL, serverURL, protocol, host, applicationId, javascriptKey, masterKey;
  9646. return _regeneratorRuntime().wrap(function _callee3$(_context3) {
  9647. while (1) {
  9648. switch (_context3.prev = _context3.next) {
  9649. case 0:
  9650. if (!defaultLiveQueryClient) {
  9651. _context3.next = 2;
  9652. break;
  9653. }
  9654. return _context3.abrupt("return", defaultLiveQueryClient);
  9655. case 2:
  9656. _context3.next = 4;
  9657. return _promise.default.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]);
  9658. case 4:
  9659. _yield$Promise$all = _context3.sent;
  9660. _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
  9661. currentUser = _yield$Promise$all2[0];
  9662. installationId = _yield$Promise$all2[1];
  9663. sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
  9664. liveQueryServerURL = _CoreManager.default.get('LIVEQUERY_SERVER_URL');
  9665. if (!(liveQueryServerURL && (0, _indexOf.default)(liveQueryServerURL).call(liveQueryServerURL, 'ws') !== 0)) {
  9666. _context3.next = 12;
  9667. break;
  9668. }
  9669. throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
  9670. case 12:
  9671. // If we can not find Parse.liveQueryServerURL, we try to extract it from Parse.serverURL
  9672. if (!liveQueryServerURL) {
  9673. serverURL = _CoreManager.default.get('SERVER_URL');
  9674. protocol = (0, _indexOf.default)(serverURL).call(serverURL, 'https') === 0 ? 'wss://' : 'ws://';
  9675. host = serverURL.replace(/^https?:\/\//, '');
  9676. liveQueryServerURL = protocol + host;
  9677. _CoreManager.default.set('LIVEQUERY_SERVER_URL', liveQueryServerURL);
  9678. }
  9679. applicationId = _CoreManager.default.get('APPLICATION_ID');
  9680. javascriptKey = _CoreManager.default.get('JAVASCRIPT_KEY');
  9681. masterKey = _CoreManager.default.get('MASTER_KEY');
  9682. defaultLiveQueryClient = new _LiveQueryClient.default({
  9683. applicationId: applicationId,
  9684. serverURL: liveQueryServerURL,
  9685. javascriptKey: javascriptKey,
  9686. masterKey: masterKey,
  9687. sessionToken: sessionToken,
  9688. installationId: installationId
  9689. });
  9690. defaultLiveQueryClient.on('error', function (error) {
  9691. LiveQuery.emit('error', error);
  9692. });
  9693. defaultLiveQueryClient.on('open', function () {
  9694. LiveQuery.emit('open');
  9695. });
  9696. defaultLiveQueryClient.on('close', function () {
  9697. LiveQuery.emit('close');
  9698. });
  9699. return _context3.abrupt("return", defaultLiveQueryClient);
  9700. case 21:
  9701. case "end":
  9702. return _context3.stop();
  9703. }
  9704. }
  9705. }, _callee3);
  9706. }))();
  9707. },
  9708. _clearCachedDefaultClient: function _clearCachedDefaultClient() {
  9709. defaultLiveQueryClient = null;
  9710. }
  9711. };
  9712. _CoreManager.default.setLiveQueryController(DefaultLiveQueryController);
  9713. },{"./CoreManager":4,"./EventEmitter":6,"./LiveQueryClient":10,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/slicedToArray":138,"@babel/runtime-corejs3/helpers/typeof":141}],26:[function(_dereq_,module,exports){
  9714. "use strict";
  9715. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  9716. var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
  9717. var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
  9718. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  9719. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
  9720. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  9721. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  9722. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  9723. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  9724. var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  9725. var _Object$getPrototypeOf2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  9726. var _Object$create2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  9727. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  9728. var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  9729. var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
  9730. var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
  9731. var _forEachInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  9732. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  9733. var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
  9734. var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
  9735. var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
  9736. _Object$defineProperty2(exports, "__esModule", {
  9737. value: true
  9738. });
  9739. exports.default = void 0;
  9740. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  9741. var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
  9742. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
  9743. var _create = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/create"));
  9744. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  9745. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  9746. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  9747. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  9748. var _getPrototypeOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of"));
  9749. var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  9750. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  9751. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  9752. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  9753. var _freeze = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/freeze"));
  9754. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  9755. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  9756. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  9757. var _defineProperty3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  9758. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  9759. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  9760. var _canBeSerialized = _interopRequireDefault(_dereq_("./canBeSerialized"));
  9761. var _decode = _interopRequireDefault(_dereq_("./decode"));
  9762. var _encode = _interopRequireDefault(_dereq_("./encode"));
  9763. var _escape2 = _interopRequireDefault(_dereq_("./escape"));
  9764. var _EventuallyQueue = _interopRequireDefault(_dereq_("./EventuallyQueue"));
  9765. var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
  9766. var _parseDate = _interopRequireDefault(_dereq_("./parseDate"));
  9767. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  9768. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  9769. var _promiseUtils = _dereq_("./promiseUtils");
  9770. var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
  9771. var _ParseOp = _dereq_("./ParseOp");
  9772. var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
  9773. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  9774. var SingleInstanceStateController = _interopRequireWildcard(_dereq_("./SingleInstanceStateController"));
  9775. var _unique = _interopRequireDefault(_dereq_("./unique"));
  9776. var UniqueInstanceStateController = _interopRequireWildcard(_dereq_("./UniqueInstanceStateController"));
  9777. var _unsavedChildren = _interopRequireDefault(_dereq_("./unsavedChildren"));
  9778. function _getRequireWildcardCache(nodeInterop) {
  9779. if (typeof _WeakMap !== "function") return null;
  9780. var cacheBabelInterop = new _WeakMap();
  9781. var cacheNodeInterop = new _WeakMap();
  9782. return (_getRequireWildcardCache = function (nodeInterop) {
  9783. return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
  9784. })(nodeInterop);
  9785. }
  9786. function _interopRequireWildcard(obj, nodeInterop) {
  9787. if (!nodeInterop && obj && obj.__esModule) {
  9788. return obj;
  9789. }
  9790. if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") {
  9791. return {
  9792. default: obj
  9793. };
  9794. }
  9795. var cache = _getRequireWildcardCache(nodeInterop);
  9796. if (cache && cache.has(obj)) {
  9797. return cache.get(obj);
  9798. }
  9799. var newObj = {};
  9800. for (var key in obj) {
  9801. if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
  9802. var desc = _Object$defineProperty2 && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
  9803. if (desc && (desc.get || desc.set)) {
  9804. _Object$defineProperty2(newObj, key, desc);
  9805. } else {
  9806. newObj[key] = obj[key];
  9807. }
  9808. }
  9809. }
  9810. newObj.default = obj;
  9811. if (cache) {
  9812. cache.set(obj, newObj);
  9813. }
  9814. return newObj;
  9815. }
  9816. function _createForOfIteratorHelper(o, allowArrayLike) {
  9817. var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
  9818. if (!it) {
  9819. if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  9820. if (it) o = it;
  9821. var i = 0;
  9822. var F = function () {};
  9823. return {
  9824. s: F,
  9825. n: function () {
  9826. if (i >= o.length) return {
  9827. done: true
  9828. };
  9829. return {
  9830. done: false,
  9831. value: o[i++]
  9832. };
  9833. },
  9834. e: function (_e) {
  9835. throw _e;
  9836. },
  9837. f: F
  9838. };
  9839. }
  9840. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  9841. }
  9842. var normalCompletion = true,
  9843. didErr = false,
  9844. err;
  9845. return {
  9846. s: function () {
  9847. it = it.call(o);
  9848. },
  9849. n: function () {
  9850. var step = it.next();
  9851. normalCompletion = step.done;
  9852. return step;
  9853. },
  9854. e: function (_e2) {
  9855. didErr = true;
  9856. err = _e2;
  9857. },
  9858. f: function () {
  9859. try {
  9860. if (!normalCompletion && it.return != null) it.return();
  9861. } finally {
  9862. if (didErr) throw err;
  9863. }
  9864. }
  9865. };
  9866. }
  9867. function _unsupportedIterableToArray(o, minLen) {
  9868. var _context20;
  9869. if (!o) return;
  9870. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  9871. var n = _sliceInstanceProperty(_context20 = Object.prototype.toString.call(o)).call(_context20, 8, -1);
  9872. if (n === "Object" && o.constructor) n = o.constructor.name;
  9873. if (n === "Map" || n === "Set") return _Array$from(o);
  9874. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  9875. }
  9876. function _arrayLikeToArray(arr, len) {
  9877. if (len == null || len > arr.length) len = arr.length;
  9878. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  9879. arr2[i] = arr[i];
  9880. }
  9881. return arr2;
  9882. }
  9883. function _regeneratorRuntime() {
  9884. "use strict";
  9885. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  9886. _regeneratorRuntime = function () {
  9887. return exports;
  9888. };
  9889. var exports = {},
  9890. Op = Object.prototype,
  9891. hasOwn = Op.hasOwnProperty,
  9892. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  9893. iteratorSymbol = $Symbol.iterator || "@@iterator",
  9894. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  9895. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  9896. function define(obj, key, value) {
  9897. return _Object$defineProperty2(obj, key, {
  9898. value: value,
  9899. enumerable: !0,
  9900. configurable: !0,
  9901. writable: !0
  9902. }), obj[key];
  9903. }
  9904. try {
  9905. define({}, "");
  9906. } catch (err) {
  9907. define = function (obj, key, value) {
  9908. return obj[key] = value;
  9909. };
  9910. }
  9911. function wrap(innerFn, outerFn, self, tryLocsList) {
  9912. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  9913. generator = _Object$create2(protoGenerator.prototype),
  9914. context = new Context(tryLocsList || []);
  9915. return generator._invoke = function (innerFn, self, context) {
  9916. var state = "suspendedStart";
  9917. return function (method, arg) {
  9918. if ("executing" === state) throw new Error("Generator is already running");
  9919. if ("completed" === state) {
  9920. if ("throw" === method) throw arg;
  9921. return doneResult();
  9922. }
  9923. for (context.method = method, context.arg = arg;;) {
  9924. var delegate = context.delegate;
  9925. if (delegate) {
  9926. var delegateResult = maybeInvokeDelegate(delegate, context);
  9927. if (delegateResult) {
  9928. if (delegateResult === ContinueSentinel) continue;
  9929. return delegateResult;
  9930. }
  9931. }
  9932. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  9933. if ("suspendedStart" === state) throw state = "completed", context.arg;
  9934. context.dispatchException(context.arg);
  9935. } else "return" === context.method && context.abrupt("return", context.arg);
  9936. state = "executing";
  9937. var record = tryCatch(innerFn, self, context);
  9938. if ("normal" === record.type) {
  9939. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  9940. return {
  9941. value: record.arg,
  9942. done: context.done
  9943. };
  9944. }
  9945. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  9946. }
  9947. };
  9948. }(innerFn, self, context), generator;
  9949. }
  9950. function tryCatch(fn, obj, arg) {
  9951. try {
  9952. return {
  9953. type: "normal",
  9954. arg: fn.call(obj, arg)
  9955. };
  9956. } catch (err) {
  9957. return {
  9958. type: "throw",
  9959. arg: err
  9960. };
  9961. }
  9962. }
  9963. exports.wrap = wrap;
  9964. var ContinueSentinel = {};
  9965. function Generator() {}
  9966. function GeneratorFunction() {}
  9967. function GeneratorFunctionPrototype() {}
  9968. var IteratorPrototype = {};
  9969. define(IteratorPrototype, iteratorSymbol, function () {
  9970. return this;
  9971. });
  9972. var getProto = _Object$getPrototypeOf2,
  9973. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  9974. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  9975. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create2(IteratorPrototype);
  9976. function defineIteratorMethods(prototype) {
  9977. var _context18;
  9978. _forEachInstanceProperty2(_context18 = ["next", "throw", "return"]).call(_context18, function (method) {
  9979. define(prototype, method, function (arg) {
  9980. return this._invoke(method, arg);
  9981. });
  9982. });
  9983. }
  9984. function AsyncIterator(generator, PromiseImpl) {
  9985. function invoke(method, arg, resolve, reject) {
  9986. var record = tryCatch(generator[method], generator, arg);
  9987. if ("throw" !== record.type) {
  9988. var result = record.arg,
  9989. value = result.value;
  9990. return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  9991. invoke("next", value, resolve, reject);
  9992. }, function (err) {
  9993. invoke("throw", err, resolve, reject);
  9994. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  9995. result.value = unwrapped, resolve(result);
  9996. }, function (error) {
  9997. return invoke("throw", error, resolve, reject);
  9998. });
  9999. }
  10000. reject(record.arg);
  10001. }
  10002. var previousPromise;
  10003. this._invoke = function (method, arg) {
  10004. function callInvokeWithMethodAndArg() {
  10005. return new PromiseImpl(function (resolve, reject) {
  10006. invoke(method, arg, resolve, reject);
  10007. });
  10008. }
  10009. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  10010. };
  10011. }
  10012. function maybeInvokeDelegate(delegate, context) {
  10013. var method = delegate.iterator[context.method];
  10014. if (undefined === method) {
  10015. if (context.delegate = null, "throw" === context.method) {
  10016. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  10017. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  10018. }
  10019. return ContinueSentinel;
  10020. }
  10021. var record = tryCatch(method, delegate.iterator, context.arg);
  10022. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  10023. var info = record.arg;
  10024. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  10025. }
  10026. function pushTryEntry(locs) {
  10027. var entry = {
  10028. tryLoc: locs[0]
  10029. };
  10030. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  10031. }
  10032. function resetTryEntry(entry) {
  10033. var record = entry.completion || {};
  10034. record.type = "normal", delete record.arg, entry.completion = record;
  10035. }
  10036. function Context(tryLocsList) {
  10037. this.tryEntries = [{
  10038. tryLoc: "root"
  10039. }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  10040. }
  10041. function values(iterable) {
  10042. if (iterable) {
  10043. var iteratorMethod = iterable[iteratorSymbol];
  10044. if (iteratorMethod) return iteratorMethod.call(iterable);
  10045. if ("function" == typeof iterable.next) return iterable;
  10046. if (!isNaN(iterable.length)) {
  10047. var i = -1,
  10048. next = function next() {
  10049. for (; ++i < iterable.length;) {
  10050. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  10051. }
  10052. return next.value = undefined, next.done = !0, next;
  10053. };
  10054. return next.next = next;
  10055. }
  10056. }
  10057. return {
  10058. next: doneResult
  10059. };
  10060. }
  10061. function doneResult() {
  10062. return {
  10063. value: undefined,
  10064. done: !0
  10065. };
  10066. }
  10067. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  10068. var ctor = "function" == typeof genFun && genFun.constructor;
  10069. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  10070. }, exports.mark = function (genFun) {
  10071. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create2(Gp), genFun;
  10072. }, exports.awrap = function (arg) {
  10073. return {
  10074. __await: arg
  10075. };
  10076. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  10077. return this;
  10078. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  10079. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  10080. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  10081. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  10082. return result.done ? result.value : iter.next();
  10083. });
  10084. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  10085. return this;
  10086. }), define(Gp, "toString", function () {
  10087. return "[object Generator]";
  10088. }), exports.keys = function (object) {
  10089. var keys = [];
  10090. for (var key in object) {
  10091. keys.push(key);
  10092. }
  10093. return _reverseInstanceProperty(keys).call(keys), function next() {
  10094. for (; keys.length;) {
  10095. var key = keys.pop();
  10096. if (key in object) return next.value = key, next.done = !1, next;
  10097. }
  10098. return next.done = !0, next;
  10099. };
  10100. }, exports.values = values, Context.prototype = {
  10101. constructor: Context,
  10102. reset: function (skipTempReset) {
  10103. var _context19;
  10104. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context19 = this.tryEntries).call(_context19, resetTryEntry), !skipTempReset) for (var name in this) {
  10105. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
  10106. }
  10107. },
  10108. stop: function () {
  10109. this.done = !0;
  10110. var rootRecord = this.tryEntries[0].completion;
  10111. if ("throw" === rootRecord.type) throw rootRecord.arg;
  10112. return this.rval;
  10113. },
  10114. dispatchException: function (exception) {
  10115. if (this.done) throw exception;
  10116. var context = this;
  10117. function handle(loc, caught) {
  10118. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  10119. }
  10120. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10121. var entry = this.tryEntries[i],
  10122. record = entry.completion;
  10123. if ("root" === entry.tryLoc) return handle("end");
  10124. if (entry.tryLoc <= this.prev) {
  10125. var hasCatch = hasOwn.call(entry, "catchLoc"),
  10126. hasFinally = hasOwn.call(entry, "finallyLoc");
  10127. if (hasCatch && hasFinally) {
  10128. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  10129. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  10130. } else if (hasCatch) {
  10131. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  10132. } else {
  10133. if (!hasFinally) throw new Error("try statement without catch or finally");
  10134. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  10135. }
  10136. }
  10137. }
  10138. },
  10139. abrupt: function (type, arg) {
  10140. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10141. var entry = this.tryEntries[i];
  10142. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  10143. var finallyEntry = entry;
  10144. break;
  10145. }
  10146. }
  10147. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  10148. var record = finallyEntry ? finallyEntry.completion : {};
  10149. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  10150. },
  10151. complete: function (record, afterLoc) {
  10152. if ("throw" === record.type) throw record.arg;
  10153. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  10154. },
  10155. finish: function (finallyLoc) {
  10156. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10157. var entry = this.tryEntries[i];
  10158. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  10159. }
  10160. },
  10161. catch: function (tryLoc) {
  10162. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10163. var entry = this.tryEntries[i];
  10164. if (entry.tryLoc === tryLoc) {
  10165. var record = entry.completion;
  10166. if ("throw" === record.type) {
  10167. var thrown = record.arg;
  10168. resetTryEntry(entry);
  10169. }
  10170. return thrown;
  10171. }
  10172. }
  10173. throw new Error("illegal catch attempt");
  10174. },
  10175. delegateYield: function (iterable, resultName, nextLoc) {
  10176. return this.delegate = {
  10177. iterator: values(iterable),
  10178. resultName: resultName,
  10179. nextLoc: nextLoc
  10180. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  10181. }
  10182. }, exports;
  10183. }
  10184. function ownKeys(object, enumerableOnly) {
  10185. var keys = _Object$keys2(object);
  10186. if (_Object$getOwnPropertySymbols) {
  10187. var symbols = _Object$getOwnPropertySymbols(object);
  10188. enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
  10189. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  10190. })), keys.push.apply(keys, symbols);
  10191. }
  10192. return keys;
  10193. }
  10194. function _objectSpread(target) {
  10195. for (var i = 1; i < arguments.length; i++) {
  10196. var _context16, _context17;
  10197. var source = null != arguments[i] ? arguments[i] : {};
  10198. i % 2 ? _forEachInstanceProperty2(_context16 = ownKeys(Object(source), !0)).call(_context16, function (key) {
  10199. (0, _defineProperty3.default)(target, key, source[key]);
  10200. }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context17 = ownKeys(Object(source))).call(_context17, function (key) {
  10201. _Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
  10202. });
  10203. }
  10204. return target;
  10205. }
  10206. var uuidv4 = _dereq_('./uuid');
  10207. /*:: export type Pointer = {
  10208. __type: string,
  10209. className: string,
  10210. objectId: string,
  10211. };*/
  10212. /*:: type SaveParams = {
  10213. method: string,
  10214. path: string,
  10215. body: AttributeMap,
  10216. };*/
  10217. /*:: export type SaveOptions = FullOptions & {
  10218. cascadeSave?: boolean,
  10219. context?: AttributeMap,
  10220. };*/
  10221. // Mapping of class names to constructors, so we can populate objects from the
  10222. // server with appropriate subclasses of ParseObject
  10223. var classMap = {}; // Global counter for generating unique Ids for non-single-instance objects
  10224. var objectCount = 0; // On web clients, objects are single-instance: any two objects with the same Id
  10225. // will have the same attributes. However, this may be dangerous default
  10226. // behavior in a server scenario
  10227. var singleInstance = !_CoreManager.default.get('IS_NODE');
  10228. if (singleInstance) {
  10229. _CoreManager.default.setObjectStateController(SingleInstanceStateController);
  10230. } else {
  10231. _CoreManager.default.setObjectStateController(UniqueInstanceStateController);
  10232. }
  10233. function getServerUrlPath() {
  10234. var serverUrl = _CoreManager.default.get('SERVER_URL');
  10235. if (serverUrl[serverUrl.length - 1] !== '/') {
  10236. serverUrl += '/';
  10237. }
  10238. var url = serverUrl.replace(/https?:\/\//, '');
  10239. return url.substr((0, _indexOf.default)(url).call(url, '/'));
  10240. }
  10241. /**
  10242. * Creates a new model with defined attributes.
  10243. *
  10244. * <p>You won't normally call this method directly. It is recommended that
  10245. * you use a subclass of <code>Parse.Object</code> instead, created by calling
  10246. * <code>extend</code>.</p>
  10247. *
  10248. * <p>However, if you don't want to use a subclass, or aren't sure which
  10249. * subclass is appropriate, you can use this form:<pre>
  10250. * var object = new Parse.Object("ClassName");
  10251. * </pre>
  10252. * That is basically equivalent to:<pre>
  10253. * var MyClass = Parse.Object.extend("ClassName");
  10254. * var object = new MyClass();
  10255. * </pre></p>
  10256. *
  10257. * @alias Parse.Object
  10258. */
  10259. var ParseObject = /*#__PURE__*/function () {
  10260. /**
  10261. * @param {string} className The class name for the object
  10262. * @param {object} attributes The initial set of data to store in the object.
  10263. * @param {object} options The options for this object instance.
  10264. */
  10265. function ParseObject(className
  10266. /*: ?string | { className: string, [attr: string]: mixed }*/
  10267. , attributes
  10268. /*:: ?: { [attr: string]: mixed }*/
  10269. , options
  10270. /*:: ?: { ignoreValidation: boolean }*/
  10271. ) {
  10272. (0, _classCallCheck2.default)(this, ParseObject);
  10273. (0, _defineProperty3.default)(this, "id", void 0);
  10274. (0, _defineProperty3.default)(this, "_localId", void 0);
  10275. (0, _defineProperty3.default)(this, "_objCount", void 0);
  10276. (0, _defineProperty3.default)(this, "className", void 0); // Enable legacy initializers
  10277. if (typeof this.initialize === 'function') {
  10278. this.initialize.apply(this, arguments);
  10279. }
  10280. var toSet = null;
  10281. this._objCount = objectCount++;
  10282. if (typeof className === 'string') {
  10283. this.className = className;
  10284. if (attributes && (0, _typeof2.default)(attributes) === 'object') {
  10285. toSet = attributes;
  10286. }
  10287. } else if (className && (0, _typeof2.default)(className) === 'object') {
  10288. this.className = className.className;
  10289. toSet = {};
  10290. for (var _attr in className) {
  10291. if (_attr !== 'className') {
  10292. toSet[_attr] = className[_attr];
  10293. }
  10294. }
  10295. if (attributes && (0, _typeof2.default)(attributes) === 'object') {
  10296. options = attributes;
  10297. }
  10298. }
  10299. if (toSet && !this.set(toSet, options)) {
  10300. throw new Error("Can't create an invalid Parse Object");
  10301. }
  10302. }
  10303. /**
  10304. * The ID of this object, unique within its class.
  10305. *
  10306. * @property {string} id
  10307. */
  10308. (0, _createClass2.default)(ParseObject, [{
  10309. key: "attributes",
  10310. get:
  10311. /** Prototype getters / setters **/
  10312. function ()
  10313. /*: AttributeMap*/
  10314. {
  10315. var stateController = _CoreManager.default.getObjectStateController();
  10316. return (0, _freeze.default)(stateController.estimateAttributes(this._getStateIdentifier()));
  10317. }
  10318. /**
  10319. * The first time this object was saved on the server.
  10320. *
  10321. * @property {Date} createdAt
  10322. * @returns {Date}
  10323. */
  10324. }, {
  10325. key: "createdAt",
  10326. get: function ()
  10327. /*: ?Date*/
  10328. {
  10329. return this._getServerData().createdAt;
  10330. }
  10331. /**
  10332. * The last time this object was updated on the server.
  10333. *
  10334. * @property {Date} updatedAt
  10335. * @returns {Date}
  10336. */
  10337. }, {
  10338. key: "updatedAt",
  10339. get: function ()
  10340. /*: ?Date*/
  10341. {
  10342. return this._getServerData().updatedAt;
  10343. }
  10344. /** Private methods **/
  10345. /**
  10346. * Returns a local or server Id used uniquely identify this object
  10347. *
  10348. * @returns {string}
  10349. */
  10350. }, {
  10351. key: "_getId",
  10352. value: function ()
  10353. /*: string*/
  10354. {
  10355. if (typeof this.id === 'string') {
  10356. return this.id;
  10357. }
  10358. if (typeof this._localId === 'string') {
  10359. return this._localId;
  10360. }
  10361. var localId = 'local' + uuidv4();
  10362. this._localId = localId;
  10363. return localId;
  10364. }
  10365. /**
  10366. * Returns a unique identifier used to pull data from the State Controller.
  10367. *
  10368. * @returns {Parse.Object|object}
  10369. */
  10370. }, {
  10371. key: "_getStateIdentifier",
  10372. value: function ()
  10373. /*: ParseObject | { id: string, className: string }*/
  10374. {
  10375. if (singleInstance) {
  10376. var id = this.id;
  10377. if (!id) {
  10378. id = this._getId();
  10379. }
  10380. return {
  10381. id: id,
  10382. className: this.className
  10383. };
  10384. } else {
  10385. return this;
  10386. }
  10387. }
  10388. }, {
  10389. key: "_getServerData",
  10390. value: function ()
  10391. /*: AttributeMap*/
  10392. {
  10393. var stateController = _CoreManager.default.getObjectStateController();
  10394. return stateController.getServerData(this._getStateIdentifier());
  10395. }
  10396. }, {
  10397. key: "_clearServerData",
  10398. value: function () {
  10399. var serverData = this._getServerData();
  10400. var unset = {};
  10401. for (var _attr2 in serverData) {
  10402. unset[_attr2] = undefined;
  10403. }
  10404. var stateController = _CoreManager.default.getObjectStateController();
  10405. stateController.setServerData(this._getStateIdentifier(), unset);
  10406. }
  10407. }, {
  10408. key: "_getPendingOps",
  10409. value: function ()
  10410. /*: Array<OpsMap>*/
  10411. {
  10412. var stateController = _CoreManager.default.getObjectStateController();
  10413. return stateController.getPendingOps(this._getStateIdentifier());
  10414. }
  10415. /**
  10416. * @param {Array<string>} [keysToClear] - if specified, only ops matching
  10417. * these fields will be cleared
  10418. */
  10419. }, {
  10420. key: "_clearPendingOps",
  10421. value: function (keysToClear
  10422. /*:: ?: Array<string>*/
  10423. ) {
  10424. var pending = this._getPendingOps();
  10425. var latest = pending[pending.length - 1];
  10426. var keys = keysToClear || (0, _keys.default)(latest);
  10427. (0, _forEach.default)(keys).call(keys, function (key) {
  10428. delete latest[key];
  10429. });
  10430. }
  10431. }, {
  10432. key: "_getDirtyObjectAttributes",
  10433. value: function ()
  10434. /*: AttributeMap*/
  10435. {
  10436. var attributes = this.attributes;
  10437. var stateController = _CoreManager.default.getObjectStateController();
  10438. var objectCache = stateController.getObjectCache(this._getStateIdentifier());
  10439. var dirty = {};
  10440. for (var _attr3 in attributes) {
  10441. var val = attributes[_attr3];
  10442. if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
  10443. // Due to the way browsers construct maps, the key order will not change
  10444. // unless the object is changed
  10445. try {
  10446. var json = (0, _encode.default)(val, false, true);
  10447. var stringified = (0, _stringify.default)(json);
  10448. if (objectCache[_attr3] !== stringified) {
  10449. dirty[_attr3] = val;
  10450. }
  10451. } catch (e) {
  10452. // Error occurred, possibly by a nested unsaved pointer in a mutable container
  10453. // No matter how it happened, it indicates a change in the attribute
  10454. dirty[_attr3] = val;
  10455. }
  10456. }
  10457. }
  10458. return dirty;
  10459. }
  10460. }, {
  10461. key: "_toFullJSON",
  10462. value: function (seen
  10463. /*:: ?: Array<any>*/
  10464. , offline
  10465. /*:: ?: boolean*/
  10466. )
  10467. /*: AttributeMap*/
  10468. {
  10469. var json
  10470. /*: { [key: string]: mixed }*/
  10471. = this.toJSON(seen, offline);
  10472. json.__type = 'Object';
  10473. json.className = this.className;
  10474. return json;
  10475. }
  10476. }, {
  10477. key: "_getSaveJSON",
  10478. value: function ()
  10479. /*: AttributeMap*/
  10480. {
  10481. var pending = this._getPendingOps();
  10482. var dirtyObjects = this._getDirtyObjectAttributes();
  10483. var json = {};
  10484. for (var attr in dirtyObjects) {
  10485. var isDotNotation = false;
  10486. for (var i = 0; i < pending.length; i += 1) {
  10487. for (var field in pending[i]) {
  10488. // Dot notation operations are handled later
  10489. if ((0, _includes.default)(field).call(field, '.')) {
  10490. var fieldName = field.split('.')[0];
  10491. if (fieldName === attr) {
  10492. isDotNotation = true;
  10493. break;
  10494. }
  10495. }
  10496. }
  10497. }
  10498. if (!isDotNotation) {
  10499. json[attr] = new _ParseOp.SetOp(dirtyObjects[attr]).toJSON();
  10500. }
  10501. }
  10502. for (attr in pending[0]) {
  10503. json[attr] = pending[0][attr].toJSON();
  10504. }
  10505. return json;
  10506. }
  10507. }, {
  10508. key: "_getSaveParams",
  10509. value: function ()
  10510. /*: SaveParams*/
  10511. {
  10512. var method = this.id ? 'PUT' : 'POST';
  10513. var body = this._getSaveJSON();
  10514. var path = 'classes/' + this.className;
  10515. if (_CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID')) {
  10516. if (!this.createdAt) {
  10517. method = 'POST';
  10518. body.objectId = this.id;
  10519. } else {
  10520. method = 'PUT';
  10521. path += '/' + this.id;
  10522. }
  10523. } else if (this.id) {
  10524. path += '/' + this.id;
  10525. } else if (this.className === '_User') {
  10526. path = 'users';
  10527. }
  10528. return {
  10529. method: method,
  10530. body: body,
  10531. path: path
  10532. };
  10533. }
  10534. }, {
  10535. key: "_finishFetch",
  10536. value: function (serverData
  10537. /*: AttributeMap*/
  10538. ) {
  10539. if (!this.id && serverData.objectId) {
  10540. this.id = serverData.objectId;
  10541. }
  10542. var stateController = _CoreManager.default.getObjectStateController();
  10543. stateController.initializeState(this._getStateIdentifier());
  10544. var decoded = {};
  10545. for (var _attr4 in serverData) {
  10546. if (_attr4 === 'ACL') {
  10547. decoded[_attr4] = new _ParseACL.default(serverData[_attr4]);
  10548. } else if (_attr4 !== 'objectId') {
  10549. decoded[_attr4] = (0, _decode.default)(serverData[_attr4]);
  10550. if (decoded[_attr4] instanceof _ParseRelation.default) {
  10551. decoded[_attr4]._ensureParentAndKey(this, _attr4);
  10552. }
  10553. }
  10554. }
  10555. if (decoded.createdAt && typeof decoded.createdAt === 'string') {
  10556. decoded.createdAt = (0, _parseDate.default)(decoded.createdAt);
  10557. }
  10558. if (decoded.updatedAt && typeof decoded.updatedAt === 'string') {
  10559. decoded.updatedAt = (0, _parseDate.default)(decoded.updatedAt);
  10560. }
  10561. if (!decoded.updatedAt && decoded.createdAt) {
  10562. decoded.updatedAt = decoded.createdAt;
  10563. }
  10564. stateController.commitServerChanges(this._getStateIdentifier(), decoded);
  10565. }
  10566. }, {
  10567. key: "_setExisted",
  10568. value: function (existed
  10569. /*: boolean*/
  10570. ) {
  10571. var stateController = _CoreManager.default.getObjectStateController();
  10572. var state = stateController.getState(this._getStateIdentifier());
  10573. if (state) {
  10574. state.existed = existed;
  10575. }
  10576. }
  10577. }, {
  10578. key: "_migrateId",
  10579. value: function (serverId
  10580. /*: string*/
  10581. ) {
  10582. if (this._localId && serverId) {
  10583. if (singleInstance) {
  10584. var stateController = _CoreManager.default.getObjectStateController();
  10585. var oldState = stateController.removeState(this._getStateIdentifier());
  10586. this.id = serverId;
  10587. delete this._localId;
  10588. if (oldState) {
  10589. stateController.initializeState(this._getStateIdentifier(), oldState);
  10590. }
  10591. } else {
  10592. this.id = serverId;
  10593. delete this._localId;
  10594. }
  10595. }
  10596. }
  10597. }, {
  10598. key: "_handleSaveResponse",
  10599. value: function (response
  10600. /*: AttributeMap*/
  10601. , status
  10602. /*: number*/
  10603. ) {
  10604. var changes = {};
  10605. var stateController = _CoreManager.default.getObjectStateController();
  10606. var pending = stateController.popPendingState(this._getStateIdentifier());
  10607. for (var attr in pending) {
  10608. if (pending[attr] instanceof _ParseOp.RelationOp) {
  10609. changes[attr] = pending[attr].applyTo(undefined, this, attr);
  10610. } else if (!(attr in response)) {
  10611. // Only SetOps and UnsetOps should not come back with results
  10612. changes[attr] = pending[attr].applyTo(undefined);
  10613. }
  10614. }
  10615. for (attr in response) {
  10616. if ((attr === 'createdAt' || attr === 'updatedAt') && typeof response[attr] === 'string') {
  10617. changes[attr] = (0, _parseDate.default)(response[attr]);
  10618. } else if (attr === 'ACL') {
  10619. changes[attr] = new _ParseACL.default(response[attr]);
  10620. } else if (attr !== 'objectId') {
  10621. var val = (0, _decode.default)(response[attr]);
  10622. if (val && (0, _getPrototypeOf.default)(val) === Object.prototype) {
  10623. changes[attr] = _objectSpread(_objectSpread({}, this.attributes[attr]), val);
  10624. } else {
  10625. changes[attr] = val;
  10626. }
  10627. if (changes[attr] instanceof _ParseOp.UnsetOp) {
  10628. changes[attr] = undefined;
  10629. }
  10630. }
  10631. }
  10632. if (changes.createdAt && !changes.updatedAt) {
  10633. changes.updatedAt = changes.createdAt;
  10634. }
  10635. this._migrateId(response.objectId);
  10636. if (status !== 201) {
  10637. this._setExisted(true);
  10638. }
  10639. stateController.commitServerChanges(this._getStateIdentifier(), changes);
  10640. }
  10641. }, {
  10642. key: "_handleSaveError",
  10643. value: function () {
  10644. var stateController = _CoreManager.default.getObjectStateController();
  10645. stateController.mergeFirstPendingState(this._getStateIdentifier());
  10646. }
  10647. }, {
  10648. key: "initialize",
  10649. value:
  10650. /** Public methods **/
  10651. function () {// NOOP
  10652. }
  10653. /**
  10654. * Returns a JSON version of the object suitable for saving to Parse.
  10655. *
  10656. * @param seen
  10657. * @param offline
  10658. * @returns {object}
  10659. */
  10660. }, {
  10661. key: "toJSON",
  10662. value: function (seen
  10663. /*: Array<any> | void*/
  10664. , offline
  10665. /*:: ?: boolean*/
  10666. )
  10667. /*: AttributeMap*/
  10668. {
  10669. var seenEntry = this.id ? this.className + ':' + this.id : this;
  10670. seen = seen || [seenEntry];
  10671. var json = {};
  10672. var attrs = this.attributes;
  10673. for (var _attr5 in attrs) {
  10674. if ((_attr5 === 'createdAt' || _attr5 === 'updatedAt') && attrs[_attr5].toJSON) {
  10675. json[_attr5] = attrs[_attr5].toJSON();
  10676. } else {
  10677. json[_attr5] = (0, _encode.default)(attrs[_attr5], false, false, seen, offline);
  10678. }
  10679. }
  10680. var pending = this._getPendingOps();
  10681. for (var _attr6 in pending[0]) {
  10682. json[_attr6] = pending[0][_attr6].toJSON(offline);
  10683. }
  10684. if (this.id) {
  10685. json.objectId = this.id;
  10686. }
  10687. return json;
  10688. }
  10689. /**
  10690. * Determines whether this ParseObject is equal to another ParseObject
  10691. *
  10692. * @param {object} other - An other object ot compare
  10693. * @returns {boolean}
  10694. */
  10695. }, {
  10696. key: "equals",
  10697. value: function (other
  10698. /*: mixed*/
  10699. )
  10700. /*: boolean*/
  10701. {
  10702. if (this === other) {
  10703. return true;
  10704. }
  10705. return other instanceof ParseObject && this.className === other.className && this.id === other.id && typeof this.id !== 'undefined';
  10706. }
  10707. /**
  10708. * Returns true if this object has been modified since its last
  10709. * save/refresh. If an attribute is specified, it returns true only if that
  10710. * particular attribute has been modified since the last save/refresh.
  10711. *
  10712. * @param {string} attr An attribute name (optional).
  10713. * @returns {boolean}
  10714. */
  10715. }, {
  10716. key: "dirty",
  10717. value: function (attr
  10718. /*:: ?: string*/
  10719. )
  10720. /*: boolean*/
  10721. {
  10722. if (!this.id) {
  10723. return true;
  10724. }
  10725. var pendingOps = this._getPendingOps();
  10726. var dirtyObjects = this._getDirtyObjectAttributes();
  10727. if (attr) {
  10728. if (dirtyObjects.hasOwnProperty(attr)) {
  10729. return true;
  10730. }
  10731. for (var i = 0; i < pendingOps.length; i++) {
  10732. if (pendingOps[i].hasOwnProperty(attr)) {
  10733. return true;
  10734. }
  10735. }
  10736. return false;
  10737. }
  10738. if ((0, _keys.default)(pendingOps[0]).length !== 0) {
  10739. return true;
  10740. }
  10741. if ((0, _keys.default)(dirtyObjects).length !== 0) {
  10742. return true;
  10743. }
  10744. return false;
  10745. }
  10746. /**
  10747. * Returns an array of keys that have been modified since last save/refresh
  10748. *
  10749. * @returns {string[]}
  10750. */
  10751. }, {
  10752. key: "dirtyKeys",
  10753. value: function ()
  10754. /*: Array<string>*/
  10755. {
  10756. var pendingOps = this._getPendingOps();
  10757. var keys = {};
  10758. for (var i = 0; i < pendingOps.length; i++) {
  10759. for (var _attr7 in pendingOps[i]) {
  10760. keys[_attr7] = true;
  10761. }
  10762. }
  10763. var dirtyObjects = this._getDirtyObjectAttributes();
  10764. for (var _attr8 in dirtyObjects) {
  10765. keys[_attr8] = true;
  10766. }
  10767. return (0, _keys.default)(keys);
  10768. }
  10769. /**
  10770. * Returns true if the object has been fetched.
  10771. *
  10772. * @returns {boolean}
  10773. */
  10774. }, {
  10775. key: "isDataAvailable",
  10776. value: function ()
  10777. /*: boolean*/
  10778. {
  10779. var serverData = this._getServerData();
  10780. return !!(0, _keys.default)(serverData).length;
  10781. }
  10782. /**
  10783. * Gets a Pointer referencing this Object.
  10784. *
  10785. * @returns {Pointer}
  10786. */
  10787. }, {
  10788. key: "toPointer",
  10789. value: function ()
  10790. /*: Pointer*/
  10791. {
  10792. if (!this.id) {
  10793. throw new Error('Cannot create a pointer to an unsaved ParseObject');
  10794. }
  10795. return {
  10796. __type: 'Pointer',
  10797. className: this.className,
  10798. objectId: this.id
  10799. };
  10800. }
  10801. /**
  10802. * Gets a Pointer referencing this Object.
  10803. *
  10804. * @returns {Pointer}
  10805. */
  10806. }, {
  10807. key: "toOfflinePointer",
  10808. value: function ()
  10809. /*: Pointer*/
  10810. {
  10811. if (!this._localId) {
  10812. throw new Error('Cannot create a offline pointer to a saved ParseObject');
  10813. }
  10814. return {
  10815. __type: 'Object',
  10816. className: this.className,
  10817. _localId: this._localId
  10818. };
  10819. }
  10820. /**
  10821. * Gets the value of an attribute.
  10822. *
  10823. * @param {string} attr The string name of an attribute.
  10824. * @returns {*}
  10825. */
  10826. }, {
  10827. key: "get",
  10828. value: function (attr
  10829. /*: string*/
  10830. )
  10831. /*: mixed*/
  10832. {
  10833. return this.attributes[attr];
  10834. }
  10835. /**
  10836. * Gets a relation on the given class for the attribute.
  10837. *
  10838. * @param {string} attr The attribute to get the relation for.
  10839. * @returns {Parse.Relation}
  10840. */
  10841. }, {
  10842. key: "relation",
  10843. value: function (attr
  10844. /*: string*/
  10845. )
  10846. /*: ParseRelation*/
  10847. {
  10848. var value = this.get(attr);
  10849. if (value) {
  10850. if (!(value instanceof _ParseRelation.default)) {
  10851. throw new Error('Called relation() on non-relation field ' + attr);
  10852. }
  10853. value._ensureParentAndKey(this, attr);
  10854. return value;
  10855. }
  10856. return new _ParseRelation.default(this, attr);
  10857. }
  10858. /**
  10859. * Gets the HTML-escaped value of an attribute.
  10860. *
  10861. * @param {string} attr The string name of an attribute.
  10862. * @returns {string}
  10863. */
  10864. }, {
  10865. key: "escape",
  10866. value: function (attr
  10867. /*: string*/
  10868. )
  10869. /*: string*/
  10870. {
  10871. var val = this.attributes[attr];
  10872. if (val == null) {
  10873. return '';
  10874. }
  10875. if (typeof val !== 'string') {
  10876. if (typeof val.toString !== 'function') {
  10877. return '';
  10878. }
  10879. val = val.toString();
  10880. }
  10881. return (0, _escape2.default)(val);
  10882. }
  10883. /**
  10884. * Returns <code>true</code> if the attribute contains a value that is not
  10885. * null or undefined.
  10886. *
  10887. * @param {string} attr The string name of the attribute.
  10888. * @returns {boolean}
  10889. */
  10890. }, {
  10891. key: "has",
  10892. value: function (attr
  10893. /*: string*/
  10894. )
  10895. /*: boolean*/
  10896. {
  10897. var attributes = this.attributes;
  10898. if (attributes.hasOwnProperty(attr)) {
  10899. return attributes[attr] != null;
  10900. }
  10901. return false;
  10902. }
  10903. /**
  10904. * Sets a hash of model attributes on the object.
  10905. *
  10906. * <p>You can call it with an object containing keys and values, with one
  10907. * key and value, or dot notation. For example:<pre>
  10908. * gameTurn.set({
  10909. * player: player1,
  10910. * diceRoll: 2
  10911. * }, {
  10912. * error: function(gameTurnAgain, error) {
  10913. * // The set failed validation.
  10914. * }
  10915. * });
  10916. *
  10917. * game.set("currentPlayer", player2, {
  10918. * error: function(gameTurnAgain, error) {
  10919. * // The set failed validation.
  10920. * }
  10921. * });
  10922. *
  10923. * game.set("finished", true);</pre></p>
  10924. *
  10925. * game.set("player.score", 10);</pre></p>
  10926. *
  10927. * @param {(string|object)} key The key to set.
  10928. * @param {(string|object)} value The value to give it.
  10929. * @param {object} options A set of options for the set.
  10930. * The only supported option is <code>error</code>.
  10931. * @returns {(ParseObject|boolean)} true if the set succeeded.
  10932. */
  10933. }, {
  10934. key: "set",
  10935. value: function (key
  10936. /*: mixed*/
  10937. , value
  10938. /*: mixed*/
  10939. , options
  10940. /*:: ?: mixed*/
  10941. )
  10942. /*: ParseObject | boolean*/
  10943. {
  10944. var changes = {};
  10945. var newOps = {};
  10946. if (key && (0, _typeof2.default)(key) === 'object') {
  10947. changes = key;
  10948. options = value;
  10949. } else if (typeof key === 'string') {
  10950. changes[key] = value;
  10951. } else {
  10952. return this;
  10953. }
  10954. options = options || {};
  10955. var readonly = [];
  10956. if (typeof this.constructor.readOnlyAttributes === 'function') {
  10957. readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
  10958. }
  10959. for (var k in changes) {
  10960. if (k === 'createdAt' || k === 'updatedAt') {
  10961. // This property is read-only, but for legacy reasons we silently
  10962. // ignore it
  10963. continue;
  10964. }
  10965. if ((0, _indexOf.default)(readonly).call(readonly, k) > -1) {
  10966. throw new Error('Cannot modify readonly attribute: ' + k);
  10967. }
  10968. if (options.unset) {
  10969. newOps[k] = new _ParseOp.UnsetOp();
  10970. } else if (changes[k] instanceof _ParseOp.Op) {
  10971. newOps[k] = changes[k];
  10972. } else if (changes[k] && (0, _typeof2.default)(changes[k]) === 'object' && typeof changes[k].__op === 'string') {
  10973. newOps[k] = (0, _ParseOp.opFromJSON)(changes[k]);
  10974. } else if (k === 'objectId' || k === 'id') {
  10975. if (typeof changes[k] === 'string') {
  10976. this.id = changes[k];
  10977. }
  10978. } else if (k === 'ACL' && (0, _typeof2.default)(changes[k]) === 'object' && !(changes[k] instanceof _ParseACL.default)) {
  10979. newOps[k] = new _ParseOp.SetOp(new _ParseACL.default(changes[k]));
  10980. } else if (changes[k] instanceof _ParseRelation.default) {
  10981. var relation = new _ParseRelation.default(this, k);
  10982. relation.targetClassName = changes[k].targetClassName;
  10983. newOps[k] = new _ParseOp.SetOp(relation);
  10984. } else {
  10985. newOps[k] = new _ParseOp.SetOp(changes[k]);
  10986. }
  10987. }
  10988. var currentAttributes = this.attributes; // Calculate new values
  10989. var newValues = {};
  10990. for (var _attr9 in newOps) {
  10991. if (newOps[_attr9] instanceof _ParseOp.RelationOp) {
  10992. newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9], this, _attr9);
  10993. } else if (!(newOps[_attr9] instanceof _ParseOp.UnsetOp)) {
  10994. newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9]);
  10995. }
  10996. } // Validate changes
  10997. if (!options.ignoreValidation) {
  10998. var validation = this.validate(newValues);
  10999. if (validation) {
  11000. if (typeof options.error === 'function') {
  11001. options.error(this, validation);
  11002. }
  11003. return false;
  11004. }
  11005. } // Consolidate Ops
  11006. var pendingOps = this._getPendingOps();
  11007. var last = pendingOps.length - 1;
  11008. var stateController = _CoreManager.default.getObjectStateController();
  11009. for (var _attr10 in newOps) {
  11010. var nextOp = newOps[_attr10].mergeWith(pendingOps[last][_attr10]);
  11011. stateController.setPendingOp(this._getStateIdentifier(), _attr10, nextOp);
  11012. }
  11013. return this;
  11014. }
  11015. /**
  11016. * Remove an attribute from the model. This is a noop if the attribute doesn't
  11017. * exist.
  11018. *
  11019. * @param {string} attr The string name of an attribute.
  11020. * @param options
  11021. * @returns {(ParseObject | boolean)}
  11022. */
  11023. }, {
  11024. key: "unset",
  11025. value: function (attr
  11026. /*: string*/
  11027. , options
  11028. /*:: ?: { [opt: string]: mixed }*/
  11029. )
  11030. /*: ParseObject | boolean*/
  11031. {
  11032. options = options || {};
  11033. options.unset = true;
  11034. return this.set(attr, null, options);
  11035. }
  11036. /**
  11037. * Atomically increments the value of the given attribute the next time the
  11038. * object is saved. If no amount is specified, 1 is used by default.
  11039. *
  11040. * @param attr {String} The key.
  11041. * @param amount {Number} The amount to increment by (optional).
  11042. * @returns {(ParseObject|boolean)}
  11043. */
  11044. }, {
  11045. key: "increment",
  11046. value: function (attr
  11047. /*: string*/
  11048. , amount
  11049. /*:: ?: number*/
  11050. )
  11051. /*: ParseObject | boolean*/
  11052. {
  11053. if (typeof amount === 'undefined') {
  11054. amount = 1;
  11055. }
  11056. if (typeof amount !== 'number') {
  11057. throw new Error('Cannot increment by a non-numeric amount.');
  11058. }
  11059. return this.set(attr, new _ParseOp.IncrementOp(amount));
  11060. }
  11061. /**
  11062. * Atomically decrements the value of the given attribute the next time the
  11063. * object is saved. If no amount is specified, 1 is used by default.
  11064. *
  11065. * @param attr {String} The key.
  11066. * @param amount {Number} The amount to decrement by (optional).
  11067. * @returns {(ParseObject | boolean)}
  11068. */
  11069. }, {
  11070. key: "decrement",
  11071. value: function (attr
  11072. /*: string*/
  11073. , amount
  11074. /*:: ?: number*/
  11075. )
  11076. /*: ParseObject | boolean*/
  11077. {
  11078. if (typeof amount === 'undefined') {
  11079. amount = 1;
  11080. }
  11081. if (typeof amount !== 'number') {
  11082. throw new Error('Cannot decrement by a non-numeric amount.');
  11083. }
  11084. return this.set(attr, new _ParseOp.IncrementOp(amount * -1));
  11085. }
  11086. /**
  11087. * Atomically add an object to the end of the array associated with a given
  11088. * key.
  11089. *
  11090. * @param attr {String} The key.
  11091. * @param item {} The item to add.
  11092. * @returns {(ParseObject | boolean)}
  11093. */
  11094. }, {
  11095. key: "add",
  11096. value: function (attr
  11097. /*: string*/
  11098. , item
  11099. /*: mixed*/
  11100. )
  11101. /*: ParseObject | boolean*/
  11102. {
  11103. return this.set(attr, new _ParseOp.AddOp([item]));
  11104. }
  11105. /**
  11106. * Atomically add the objects to the end of the array associated with a given
  11107. * key.
  11108. *
  11109. * @param attr {String} The key.
  11110. * @param items {Object[]} The items to add.
  11111. * @returns {(ParseObject | boolean)}
  11112. */
  11113. }, {
  11114. key: "addAll",
  11115. value: function (attr
  11116. /*: string*/
  11117. , items
  11118. /*: Array<mixed>*/
  11119. )
  11120. /*: ParseObject | boolean*/
  11121. {
  11122. return this.set(attr, new _ParseOp.AddOp(items));
  11123. }
  11124. /**
  11125. * Atomically add an object to the array associated with a given key, only
  11126. * if it is not already present in the array. The position of the insert is
  11127. * not guaranteed.
  11128. *
  11129. * @param attr {String} The key.
  11130. * @param item {} The object to add.
  11131. * @returns {(ParseObject | boolean)}
  11132. */
  11133. }, {
  11134. key: "addUnique",
  11135. value: function (attr
  11136. /*: string*/
  11137. , item
  11138. /*: mixed*/
  11139. )
  11140. /*: ParseObject | boolean*/
  11141. {
  11142. return this.set(attr, new _ParseOp.AddUniqueOp([item]));
  11143. }
  11144. /**
  11145. * Atomically add the objects to the array associated with a given key, only
  11146. * if it is not already present in the array. The position of the insert is
  11147. * not guaranteed.
  11148. *
  11149. * @param attr {String} The key.
  11150. * @param items {Object[]} The objects to add.
  11151. * @returns {(ParseObject | boolean)}
  11152. */
  11153. }, {
  11154. key: "addAllUnique",
  11155. value: function (attr
  11156. /*: string*/
  11157. , items
  11158. /*: Array<mixed>*/
  11159. )
  11160. /*: ParseObject | boolean*/
  11161. {
  11162. return this.set(attr, new _ParseOp.AddUniqueOp(items));
  11163. }
  11164. /**
  11165. * Atomically remove all instances of an object from the array associated
  11166. * with a given key.
  11167. *
  11168. * @param attr {String} The key.
  11169. * @param item {} The object to remove.
  11170. * @returns {(ParseObject | boolean)}
  11171. */
  11172. }, {
  11173. key: "remove",
  11174. value: function (attr
  11175. /*: string*/
  11176. , item
  11177. /*: mixed*/
  11178. )
  11179. /*: ParseObject | boolean*/
  11180. {
  11181. return this.set(attr, new _ParseOp.RemoveOp([item]));
  11182. }
  11183. /**
  11184. * Atomically remove all instances of the objects from the array associated
  11185. * with a given key.
  11186. *
  11187. * @param attr {String} The key.
  11188. * @param items {Object[]} The object to remove.
  11189. * @returns {(ParseObject | boolean)}
  11190. */
  11191. }, {
  11192. key: "removeAll",
  11193. value: function (attr
  11194. /*: string*/
  11195. , items
  11196. /*: Array<mixed>*/
  11197. )
  11198. /*: ParseObject | boolean*/
  11199. {
  11200. return this.set(attr, new _ParseOp.RemoveOp(items));
  11201. }
  11202. /**
  11203. * Returns an instance of a subclass of Parse.Op describing what kind of
  11204. * modification has been performed on this field since the last time it was
  11205. * saved. For example, after calling object.increment("x"), calling
  11206. * object.op("x") would return an instance of Parse.Op.Increment.
  11207. *
  11208. * @param attr {String} The key.
  11209. * @returns {Parse.Op} The operation, or undefined if none.
  11210. */
  11211. }, {
  11212. key: "op",
  11213. value: function (attr
  11214. /*: string*/
  11215. )
  11216. /*: ?Op*/
  11217. {
  11218. var pending = this._getPendingOps();
  11219. for (var i = pending.length; i--;) {
  11220. if (pending[i][attr]) {
  11221. return pending[i][attr];
  11222. }
  11223. }
  11224. }
  11225. /**
  11226. * Creates a new model with identical attributes to this one.
  11227. *
  11228. * @returns {Parse.Object}
  11229. */
  11230. }, {
  11231. key: "clone",
  11232. value: function clone()
  11233. /*: any*/
  11234. {
  11235. var clone = new this.constructor(this.className);
  11236. var attributes = this.attributes;
  11237. if (typeof this.constructor.readOnlyAttributes === 'function') {
  11238. var readonly = this.constructor.readOnlyAttributes() || []; // Attributes are frozen, so we have to rebuild an object,
  11239. // rather than delete readonly keys
  11240. var copy = {};
  11241. for (var a in attributes) {
  11242. if ((0, _indexOf.default)(readonly).call(readonly, a) < 0) {
  11243. copy[a] = attributes[a];
  11244. }
  11245. }
  11246. attributes = copy;
  11247. }
  11248. if (clone.set) {
  11249. clone.set(attributes);
  11250. }
  11251. return clone;
  11252. }
  11253. /**
  11254. * Creates a new instance of this object. Not to be confused with clone()
  11255. *
  11256. * @returns {Parse.Object}
  11257. */
  11258. }, {
  11259. key: "newInstance",
  11260. value: function ()
  11261. /*: any*/
  11262. {
  11263. var clone = new this.constructor(this.className);
  11264. clone.id = this.id;
  11265. if (singleInstance) {
  11266. // Just return an object with the right id
  11267. return clone;
  11268. }
  11269. var stateController = _CoreManager.default.getObjectStateController();
  11270. if (stateController) {
  11271. stateController.duplicateState(this._getStateIdentifier(), clone._getStateIdentifier());
  11272. }
  11273. return clone;
  11274. }
  11275. /**
  11276. * Returns true if this object has never been saved to Parse.
  11277. *
  11278. * @returns {boolean}
  11279. */
  11280. }, {
  11281. key: "isNew",
  11282. value: function ()
  11283. /*: boolean*/
  11284. {
  11285. return !this.id;
  11286. }
  11287. /**
  11288. * Returns true if this object was created by the Parse server when the
  11289. * object might have already been there (e.g. in the case of a Facebook
  11290. * login)
  11291. *
  11292. * @returns {boolean}
  11293. */
  11294. }, {
  11295. key: "existed",
  11296. value: function ()
  11297. /*: boolean*/
  11298. {
  11299. if (!this.id) {
  11300. return false;
  11301. }
  11302. var stateController = _CoreManager.default.getObjectStateController();
  11303. var state = stateController.getState(this._getStateIdentifier());
  11304. if (state) {
  11305. return state.existed;
  11306. }
  11307. return false;
  11308. }
  11309. /**
  11310. * Returns true if this object exists on the Server
  11311. *
  11312. * @param {object} options
  11313. * Valid options are:<ul>
  11314. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  11315. * be used for this request.
  11316. * <li>sessionToken: A valid session token, used for making a request on
  11317. * behalf of a specific user.
  11318. * </ul>
  11319. * @returns {Promise<boolean>} A boolean promise that is fulfilled if object exists.
  11320. */
  11321. }, {
  11322. key: "exists",
  11323. value: function () {
  11324. var _exists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options
  11325. /*:: ?: RequestOptions*/
  11326. ) {
  11327. var query;
  11328. return _regeneratorRuntime().wrap(function _callee$(_context) {
  11329. while (1) {
  11330. switch (_context.prev = _context.next) {
  11331. case 0:
  11332. if (this.id) {
  11333. _context.next = 2;
  11334. break;
  11335. }
  11336. return _context.abrupt("return", false);
  11337. case 2:
  11338. _context.prev = 2;
  11339. query = new _ParseQuery.default(this.className);
  11340. _context.next = 6;
  11341. return query.get(this.id, options);
  11342. case 6:
  11343. return _context.abrupt("return", true);
  11344. case 9:
  11345. _context.prev = 9;
  11346. _context.t0 = _context["catch"](2);
  11347. if (!(_context.t0.code === _ParseError.default.OBJECT_NOT_FOUND)) {
  11348. _context.next = 13;
  11349. break;
  11350. }
  11351. return _context.abrupt("return", false);
  11352. case 13:
  11353. throw _context.t0;
  11354. case 14:
  11355. case "end":
  11356. return _context.stop();
  11357. }
  11358. }
  11359. }, _callee, this, [[2, 9]]);
  11360. }));
  11361. function exists(_x) {
  11362. return _exists.apply(this, arguments);
  11363. }
  11364. return exists;
  11365. }()
  11366. /**
  11367. * Checks if the model is currently in a valid state.
  11368. *
  11369. * @returns {boolean}
  11370. */
  11371. }, {
  11372. key: "isValid",
  11373. value: function isValid()
  11374. /*: boolean*/
  11375. {
  11376. return !this.validate(this.attributes);
  11377. }
  11378. /**
  11379. * You should not call this function directly unless you subclass
  11380. * <code>Parse.Object</code>, in which case you can override this method
  11381. * to provide additional validation on <code>set</code> and
  11382. * <code>save</code>. Your implementation should return
  11383. *
  11384. * @param {object} attrs The current data to validate.
  11385. * @returns {Parse.Error|boolean} False if the data is valid. An error object otherwise.
  11386. * @see Parse.Object#set
  11387. */
  11388. }, {
  11389. key: "validate",
  11390. value: function validate(attrs
  11391. /*: AttributeMap*/
  11392. )
  11393. /*: ParseError | boolean*/
  11394. {
  11395. if (attrs.hasOwnProperty('ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
  11396. return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
  11397. }
  11398. for (var _key in attrs) {
  11399. if (!/^[A-Za-z][0-9A-Za-z_.]*$/.test(_key)) {
  11400. return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME);
  11401. }
  11402. }
  11403. return false;
  11404. }
  11405. /**
  11406. * Returns the ACL for this object.
  11407. *
  11408. * @returns {Parse.ACL} An instance of Parse.ACL.
  11409. * @see Parse.Object#get
  11410. */
  11411. }, {
  11412. key: "getACL",
  11413. value: function getACL()
  11414. /*: ?ParseACL*/
  11415. {
  11416. var acl = this.get('ACL');
  11417. if (acl instanceof _ParseACL.default) {
  11418. return acl;
  11419. }
  11420. return null;
  11421. }
  11422. /**
  11423. * Sets the ACL to be used for this object.
  11424. *
  11425. * @param {Parse.ACL} acl An instance of Parse.ACL.
  11426. * @param {object} options
  11427. * @returns {(ParseObject | boolean)} Whether the set passed validation.
  11428. * @see Parse.Object#set
  11429. */
  11430. }, {
  11431. key: "setACL",
  11432. value: function setACL(acl
  11433. /*: ParseACL*/
  11434. , options
  11435. /*:: ?: mixed*/
  11436. )
  11437. /*: ParseObject | boolean*/
  11438. {
  11439. return this.set('ACL', acl, options);
  11440. }
  11441. /**
  11442. * Clears any (or specific) changes to this object made since the last call to save()
  11443. *
  11444. * @param {string} [keys] - specify which fields to revert
  11445. */
  11446. }, {
  11447. key: "revert",
  11448. value: function revert()
  11449. /*: void*/
  11450. {
  11451. var keysToRevert;
  11452. for (var _len = arguments.length, keys = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
  11453. keys[_key2] = arguments[_key2];
  11454. }
  11455. if (keys.length) {
  11456. keysToRevert = [];
  11457. var _iterator = _createForOfIteratorHelper(keys),
  11458. _step;
  11459. try {
  11460. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  11461. var _key3 = _step.value;
  11462. if (typeof _key3 === 'string') {
  11463. keysToRevert.push(_key3);
  11464. } else {
  11465. throw new Error('Parse.Object#revert expects either no, or a list of string, arguments.');
  11466. }
  11467. }
  11468. } catch (err) {
  11469. _iterator.e(err);
  11470. } finally {
  11471. _iterator.f();
  11472. }
  11473. }
  11474. this._clearPendingOps(keysToRevert);
  11475. }
  11476. /**
  11477. * Clears all attributes on a model
  11478. *
  11479. * @returns {(ParseObject | boolean)}
  11480. */
  11481. }, {
  11482. key: "clear",
  11483. value: function clear()
  11484. /*: ParseObject | boolean*/
  11485. {
  11486. var attributes = this.attributes;
  11487. var erasable = {};
  11488. var readonly = ['createdAt', 'updatedAt'];
  11489. if (typeof this.constructor.readOnlyAttributes === 'function') {
  11490. readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
  11491. }
  11492. for (var _attr11 in attributes) {
  11493. if ((0, _indexOf.default)(readonly).call(readonly, _attr11) < 0) {
  11494. erasable[_attr11] = true;
  11495. }
  11496. }
  11497. return this.set(erasable, {
  11498. unset: true
  11499. });
  11500. }
  11501. /**
  11502. * Fetch the model from the server. If the server's representation of the
  11503. * model differs from its current attributes, they will be overriden.
  11504. *
  11505. * @param {object} options
  11506. * Valid options are:<ul>
  11507. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  11508. * be used for this request.
  11509. * <li>sessionToken: A valid session token, used for making a request on
  11510. * behalf of a specific user.
  11511. * <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
  11512. * or an array of array of strings.
  11513. * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
  11514. * </ul>
  11515. * @returns {Promise} A promise that is fulfilled when the fetch
  11516. * completes.
  11517. */
  11518. }, {
  11519. key: "fetch",
  11520. value: function fetch(options
  11521. /*: RequestOptions*/
  11522. )
  11523. /*: Promise*/
  11524. {
  11525. options = options || {};
  11526. var fetchOptions = {};
  11527. if (options.hasOwnProperty('useMasterKey')) {
  11528. fetchOptions.useMasterKey = options.useMasterKey;
  11529. }
  11530. if (options.hasOwnProperty('sessionToken')) {
  11531. fetchOptions.sessionToken = options.sessionToken;
  11532. }
  11533. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  11534. fetchOptions.context = options.context;
  11535. }
  11536. if (options.hasOwnProperty('include')) {
  11537. fetchOptions.include = [];
  11538. if ((0, _isArray.default)(options.include)) {
  11539. var _context2;
  11540. (0, _forEach.default)(_context2 = options.include).call(_context2, function (key) {
  11541. if ((0, _isArray.default)(key)) {
  11542. var _context3;
  11543. fetchOptions.include = (0, _concat.default)(_context3 = fetchOptions.include).call(_context3, key);
  11544. } else {
  11545. fetchOptions.include.push(key);
  11546. }
  11547. });
  11548. } else {
  11549. fetchOptions.include.push(options.include);
  11550. }
  11551. }
  11552. var controller = _CoreManager.default.getObjectController();
  11553. return controller.fetch(this, true, fetchOptions);
  11554. }
  11555. /**
  11556. * Fetch the model from the server. If the server's representation of the
  11557. * model differs from its current attributes, they will be overriden.
  11558. *
  11559. * Includes nested Parse.Objects for the provided key. You can use dot
  11560. * notation to specify which fields in the included object are also fetched.
  11561. *
  11562. * @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
  11563. * @param {object} options
  11564. * Valid options are:<ul>
  11565. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  11566. * be used for this request.
  11567. * <li>sessionToken: A valid session token, used for making a request on
  11568. * behalf of a specific user.
  11569. * </ul>
  11570. * @returns {Promise} A promise that is fulfilled when the fetch
  11571. * completes.
  11572. */
  11573. }, {
  11574. key: "fetchWithInclude",
  11575. value: function fetchWithInclude(keys
  11576. /*: String | Array<string | Array<string>>*/
  11577. , options
  11578. /*: RequestOptions*/
  11579. )
  11580. /*: Promise*/
  11581. {
  11582. options = options || {};
  11583. options.include = keys;
  11584. return this.fetch(options);
  11585. }
  11586. /**
  11587. * Saves this object to the server at some unspecified time in the future,
  11588. * even if Parse is currently inaccessible.
  11589. *
  11590. * Use this when you may not have a solid network connection, and don't need to know when the save completes.
  11591. * If there is some problem with the object such that it can't be saved, it will be silently discarded.
  11592. *
  11593. * Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse.
  11594. * They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is
  11595. * available. Objects saved this way will persist even after the app is closed, in which case they will be sent the
  11596. * next time the app is opened.
  11597. *
  11598. * @param {object} [options]
  11599. * Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
  11600. * Valid options are:
  11601. * <ul>
  11602. * <li>sessionToken: A valid session token, used for making a request on
  11603. * behalf of a specific user.
  11604. * <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
  11605. * <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
  11606. * </ul>
  11607. * @returns {Promise} A promise that is fulfilled when the save
  11608. * completes.
  11609. */
  11610. }, {
  11611. key: "saveEventually",
  11612. value: function () {
  11613. var _saveEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options
  11614. /*: SaveOptions*/
  11615. ) {
  11616. return _regeneratorRuntime().wrap(function _callee2$(_context4) {
  11617. while (1) {
  11618. switch (_context4.prev = _context4.next) {
  11619. case 0:
  11620. _context4.prev = 0;
  11621. _context4.next = 3;
  11622. return this.save(null, options);
  11623. case 3:
  11624. _context4.next = 11;
  11625. break;
  11626. case 5:
  11627. _context4.prev = 5;
  11628. _context4.t0 = _context4["catch"](0);
  11629. if (!(_context4.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
  11630. _context4.next = 11;
  11631. break;
  11632. }
  11633. _context4.next = 10;
  11634. return _EventuallyQueue.default.save(this, options);
  11635. case 10:
  11636. _EventuallyQueue.default.poll();
  11637. case 11:
  11638. return _context4.abrupt("return", this);
  11639. case 12:
  11640. case "end":
  11641. return _context4.stop();
  11642. }
  11643. }
  11644. }, _callee2, this, [[0, 5]]);
  11645. }));
  11646. function saveEventually(_x2) {
  11647. return _saveEventually.apply(this, arguments);
  11648. }
  11649. return saveEventually;
  11650. }()
  11651. /**
  11652. * Set a hash of model attributes, and save the model to the server.
  11653. * updatedAt will be updated when the request returns.
  11654. * You can either call it as:<pre>
  11655. * object.save();</pre>
  11656. * or<pre>
  11657. * object.save(attrs);</pre>
  11658. * or<pre>
  11659. * object.save(null, options);</pre>
  11660. * or<pre>
  11661. * object.save(attrs, options);</pre>
  11662. * or<pre>
  11663. * object.save(key, value);</pre>
  11664. * or<pre>
  11665. * object.save(key, value, options);</pre>
  11666. *
  11667. * Example 1: <pre>
  11668. * gameTurn.save({
  11669. * player: "Jake Cutter",
  11670. * diceRoll: 2
  11671. * }).then(function(gameTurnAgain) {
  11672. * // The save was successful.
  11673. * }, function(error) {
  11674. * // The save failed. Error is an instance of Parse.Error.
  11675. * });</pre>
  11676. *
  11677. * Example 2: <pre>
  11678. * gameTurn.save("player", "Jake Cutter");</pre>
  11679. *
  11680. * @param {string | object | null} [arg1]
  11681. * Valid options are:<ul>
  11682. * <li>`Object` - Key/value pairs to update on the object.</li>
  11683. * <li>`String` Key - Key of attribute to update (requires arg2 to also be string)</li>
  11684. * <li>`null` - Passing null for arg1 allows you to save the object with options passed in arg2.</li>
  11685. * </ul>
  11686. * @param {string | object} [arg2]
  11687. * <ul>
  11688. * <li>`String` Value - If arg1 was passed as a key, arg2 is the value that should be set on that key.</li>
  11689. * <li>`Object` Options - Valid options are:
  11690. * <ul>
  11691. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  11692. * be used for this request.
  11693. * <li>sessionToken: A valid session token, used for making a request on
  11694. * behalf of a specific user.
  11695. * <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
  11696. * <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
  11697. * </ul>
  11698. * </li>
  11699. * </ul>
  11700. * @param {object} [arg3]
  11701. * Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
  11702. * Valid options are:
  11703. * <ul>
  11704. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  11705. * be used for this request.
  11706. * <li>sessionToken: A valid session token, used for making a request on
  11707. * behalf of a specific user.
  11708. * <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
  11709. * <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
  11710. * </ul>
  11711. * @returns {Promise} A promise that is fulfilled when the save
  11712. * completes.
  11713. */
  11714. }, {
  11715. key: "save",
  11716. value: function save(arg1
  11717. /*: ?string | { [attr: string]: mixed }*/
  11718. , arg2
  11719. /*: SaveOptions | mixed*/
  11720. , arg3
  11721. /*:: ?: SaveOptions*/
  11722. )
  11723. /*: Promise*/
  11724. {
  11725. var _this = this;
  11726. var attrs;
  11727. var options;
  11728. if ((0, _typeof2.default)(arg1) === 'object' || typeof arg1 === 'undefined') {
  11729. attrs = arg1;
  11730. if ((0, _typeof2.default)(arg2) === 'object') {
  11731. options = arg2;
  11732. }
  11733. } else {
  11734. attrs = {};
  11735. attrs[arg1] = arg2;
  11736. options = arg3;
  11737. }
  11738. if (attrs) {
  11739. var validation = this.validate(attrs);
  11740. if (validation) {
  11741. return _promise.default.reject(validation);
  11742. }
  11743. this.set(attrs, options);
  11744. }
  11745. options = options || {};
  11746. var saveOptions = {};
  11747. if (options.hasOwnProperty('useMasterKey')) {
  11748. saveOptions.useMasterKey = !!options.useMasterKey;
  11749. }
  11750. if (options.hasOwnProperty('sessionToken') && typeof options.sessionToken === 'string') {
  11751. saveOptions.sessionToken = options.sessionToken;
  11752. }
  11753. if (options.hasOwnProperty('installationId') && typeof options.installationId === 'string') {
  11754. saveOptions.installationId = options.installationId;
  11755. }
  11756. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  11757. saveOptions.context = options.context;
  11758. }
  11759. var controller = _CoreManager.default.getObjectController();
  11760. var unsaved = options.cascadeSave !== false ? (0, _unsavedChildren.default)(this) : null;
  11761. return controller.save(unsaved, saveOptions).then(function () {
  11762. return controller.save(_this, saveOptions);
  11763. });
  11764. }
  11765. /**
  11766. * Deletes this object from the server at some unspecified time in the future,
  11767. * even if Parse is currently inaccessible.
  11768. *
  11769. * Use this when you may not have a solid network connection,
  11770. * and don't need to know when the delete completes. If there is some problem with the object
  11771. * such that it can't be deleted, the request will be silently discarded.
  11772. *
  11773. * Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted
  11774. * to Parse. They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection
  11775. * is available. Delete requests will persist even after the app is closed, in which case they will be sent the
  11776. * next time the app is opened.
  11777. *
  11778. * @param {object} [options]
  11779. * Valid options are:<ul>
  11780. * <li>sessionToken: A valid session token, used for making a request on
  11781. * behalf of a specific user.
  11782. * <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
  11783. * </ul>
  11784. * @returns {Promise} A promise that is fulfilled when the destroy
  11785. * completes.
  11786. */
  11787. }, {
  11788. key: "destroyEventually",
  11789. value: function () {
  11790. var _destroyEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options
  11791. /*: RequestOptions*/
  11792. ) {
  11793. return _regeneratorRuntime().wrap(function _callee3$(_context5) {
  11794. while (1) {
  11795. switch (_context5.prev = _context5.next) {
  11796. case 0:
  11797. _context5.prev = 0;
  11798. _context5.next = 3;
  11799. return this.destroy(options);
  11800. case 3:
  11801. _context5.next = 11;
  11802. break;
  11803. case 5:
  11804. _context5.prev = 5;
  11805. _context5.t0 = _context5["catch"](0);
  11806. if (!(_context5.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
  11807. _context5.next = 11;
  11808. break;
  11809. }
  11810. _context5.next = 10;
  11811. return _EventuallyQueue.default.destroy(this, options);
  11812. case 10:
  11813. _EventuallyQueue.default.poll();
  11814. case 11:
  11815. return _context5.abrupt("return", this);
  11816. case 12:
  11817. case "end":
  11818. return _context5.stop();
  11819. }
  11820. }
  11821. }, _callee3, this, [[0, 5]]);
  11822. }));
  11823. function destroyEventually(_x3) {
  11824. return _destroyEventually.apply(this, arguments);
  11825. }
  11826. return destroyEventually;
  11827. }()
  11828. /**
  11829. * Destroy this model on the server if it was already persisted.
  11830. *
  11831. * @param {object} options
  11832. * Valid options are:<ul>
  11833. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  11834. * be used for this request.
  11835. * <li>sessionToken: A valid session token, used for making a request on
  11836. * behalf of a specific user.
  11837. * <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
  11838. * </ul>
  11839. * @returns {Promise} A promise that is fulfilled when the destroy
  11840. * completes.
  11841. */
  11842. }, {
  11843. key: "destroy",
  11844. value: function destroy(options
  11845. /*: RequestOptions*/
  11846. )
  11847. /*: Promise*/
  11848. {
  11849. options = options || {};
  11850. var destroyOptions = {};
  11851. if (options.hasOwnProperty('useMasterKey')) {
  11852. destroyOptions.useMasterKey = options.useMasterKey;
  11853. }
  11854. if (options.hasOwnProperty('sessionToken')) {
  11855. destroyOptions.sessionToken = options.sessionToken;
  11856. }
  11857. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  11858. destroyOptions.context = options.context;
  11859. }
  11860. if (!this.id) {
  11861. return _promise.default.resolve();
  11862. }
  11863. return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
  11864. }
  11865. /**
  11866. * Asynchronously stores the object and every object it points to in the local datastore,
  11867. * recursively, using a default pin name: _default.
  11868. *
  11869. * If those other objects have not been fetched from Parse, they will not be stored.
  11870. * However, if they have changed data, all the changes will be retained.
  11871. *
  11872. * <pre>
  11873. * await object.pin();
  11874. * </pre>
  11875. *
  11876. * To retrieve object:
  11877. * <code>query.fromLocalDatastore()</code> or <code>query.fromPin()</code>
  11878. *
  11879. * @returns {Promise} A promise that is fulfilled when the pin completes.
  11880. */
  11881. }, {
  11882. key: "pin",
  11883. value: function pin()
  11884. /*: Promise<void>*/
  11885. {
  11886. return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
  11887. }
  11888. /**
  11889. * Asynchronously removes the object and every object it points to in the local datastore,
  11890. * recursively, using a default pin name: _default.
  11891. *
  11892. * <pre>
  11893. * await object.unPin();
  11894. * </pre>
  11895. *
  11896. * @returns {Promise} A promise that is fulfilled when the unPin completes.
  11897. */
  11898. }, {
  11899. key: "unPin",
  11900. value: function unPin()
  11901. /*: Promise<void>*/
  11902. {
  11903. return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
  11904. }
  11905. /**
  11906. * Asynchronously returns if the object is pinned
  11907. *
  11908. * <pre>
  11909. * const isPinned = await object.isPinned();
  11910. * </pre>
  11911. *
  11912. * @returns {Promise<boolean>} A boolean promise that is fulfilled if object is pinned.
  11913. */
  11914. }, {
  11915. key: "isPinned",
  11916. value: function () {
  11917. var _isPinned = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
  11918. var localDatastore, objectKey, pin;
  11919. return _regeneratorRuntime().wrap(function _callee4$(_context6) {
  11920. while (1) {
  11921. switch (_context6.prev = _context6.next) {
  11922. case 0:
  11923. localDatastore = _CoreManager.default.getLocalDatastore();
  11924. if (localDatastore.isEnabled) {
  11925. _context6.next = 3;
  11926. break;
  11927. }
  11928. return _context6.abrupt("return", _promise.default.reject('Parse.enableLocalDatastore() must be called first'));
  11929. case 3:
  11930. objectKey = localDatastore.getKeyForObject(this);
  11931. _context6.next = 6;
  11932. return localDatastore.fromPinWithName(objectKey);
  11933. case 6:
  11934. pin = _context6.sent;
  11935. return _context6.abrupt("return", pin.length > 0);
  11936. case 8:
  11937. case "end":
  11938. return _context6.stop();
  11939. }
  11940. }
  11941. }, _callee4, this);
  11942. }));
  11943. function isPinned() {
  11944. return _isPinned.apply(this, arguments);
  11945. }
  11946. return isPinned;
  11947. }()
  11948. /**
  11949. * Asynchronously stores the objects and every object they point to in the local datastore, recursively.
  11950. *
  11951. * If those other objects have not been fetched from Parse, they will not be stored.
  11952. * However, if they have changed data, all the changes will be retained.
  11953. *
  11954. * <pre>
  11955. * await object.pinWithName(name);
  11956. * </pre>
  11957. *
  11958. * To retrieve object:
  11959. * <code>query.fromLocalDatastore()</code> or <code>query.fromPinWithName(name)</code>
  11960. *
  11961. * @param {string} name Name of Pin.
  11962. * @returns {Promise} A promise that is fulfilled when the pin completes.
  11963. */
  11964. }, {
  11965. key: "pinWithName",
  11966. value: function pinWithName(name
  11967. /*: string*/
  11968. )
  11969. /*: Promise<void>*/
  11970. {
  11971. return ParseObject.pinAllWithName(name, [this]);
  11972. }
  11973. /**
  11974. * Asynchronously removes the object and every object it points to in the local datastore, recursively.
  11975. *
  11976. * <pre>
  11977. * await object.unPinWithName(name);
  11978. * </pre>
  11979. *
  11980. * @param {string} name Name of Pin.
  11981. * @returns {Promise} A promise that is fulfilled when the unPin completes.
  11982. */
  11983. }, {
  11984. key: "unPinWithName",
  11985. value: function unPinWithName(name
  11986. /*: string*/
  11987. )
  11988. /*: Promise<void>*/
  11989. {
  11990. return ParseObject.unPinAllWithName(name, [this]);
  11991. }
  11992. /**
  11993. * Asynchronously loads data from the local datastore into this object.
  11994. *
  11995. * <pre>
  11996. * await object.fetchFromLocalDatastore();
  11997. * </pre>
  11998. *
  11999. * You can create an unfetched pointer with <code>Parse.Object.createWithoutData()</code>
  12000. * and then call <code>fetchFromLocalDatastore()</code> on it.
  12001. *
  12002. * @returns {Promise} A promise that is fulfilled when the fetch completes.
  12003. */
  12004. }, {
  12005. key: "fetchFromLocalDatastore",
  12006. value: function () {
  12007. var _fetchFromLocalDatastore = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
  12008. var localDatastore, objectKey, pinned, result;
  12009. return _regeneratorRuntime().wrap(function _callee5$(_context7) {
  12010. while (1) {
  12011. switch (_context7.prev = _context7.next) {
  12012. case 0:
  12013. localDatastore = _CoreManager.default.getLocalDatastore();
  12014. if (localDatastore.isEnabled) {
  12015. _context7.next = 3;
  12016. break;
  12017. }
  12018. throw new Error('Parse.enableLocalDatastore() must be called first');
  12019. case 3:
  12020. objectKey = localDatastore.getKeyForObject(this);
  12021. _context7.next = 6;
  12022. return localDatastore._serializeObject(objectKey);
  12023. case 6:
  12024. pinned = _context7.sent;
  12025. if (pinned) {
  12026. _context7.next = 9;
  12027. break;
  12028. }
  12029. throw new Error('Cannot fetch an unsaved ParseObject');
  12030. case 9:
  12031. result = ParseObject.fromJSON(pinned);
  12032. this._finishFetch(result.toJSON());
  12033. return _context7.abrupt("return", this);
  12034. case 12:
  12035. case "end":
  12036. return _context7.stop();
  12037. }
  12038. }
  12039. }, _callee5, this);
  12040. }));
  12041. function fetchFromLocalDatastore() {
  12042. return _fetchFromLocalDatastore.apply(this, arguments);
  12043. }
  12044. return fetchFromLocalDatastore;
  12045. }()
  12046. /** Static methods **/
  12047. }], [{
  12048. key: "_getClassMap",
  12049. value: function _getClassMap() {
  12050. return classMap;
  12051. }
  12052. }, {
  12053. key: "_clearAllState",
  12054. value: function _clearAllState() {
  12055. var stateController = _CoreManager.default.getObjectStateController();
  12056. stateController.clearAllState();
  12057. }
  12058. /**
  12059. * Fetches the given list of Parse.Object.
  12060. * If any error is encountered, stops and calls the error handler.
  12061. *
  12062. * <pre>
  12063. * Parse.Object.fetchAll([object1, object2, ...])
  12064. * .then((list) => {
  12065. * // All the objects were fetched.
  12066. * }, (error) => {
  12067. * // An error occurred while fetching one of the objects.
  12068. * });
  12069. * </pre>
  12070. *
  12071. * @param {Array} list A list of <code>Parse.Object</code>.
  12072. * @param {object} options
  12073. * Valid options are:<ul>
  12074. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  12075. * be used for this request.
  12076. * <li>sessionToken: A valid session token, used for making a request on
  12077. * behalf of a specific user.
  12078. * <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
  12079. * or an array of array of strings.
  12080. * </ul>
  12081. * @static
  12082. * @returns {Parse.Object[]}
  12083. */
  12084. }, {
  12085. key: "fetchAll",
  12086. value: function fetchAll(list
  12087. /*: Array<ParseObject>*/
  12088. ) {
  12089. var options
  12090. /*: RequestOptions*/
  12091. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  12092. var queryOptions = {};
  12093. if (options.hasOwnProperty('useMasterKey')) {
  12094. queryOptions.useMasterKey = options.useMasterKey;
  12095. }
  12096. if (options.hasOwnProperty('sessionToken')) {
  12097. queryOptions.sessionToken = options.sessionToken;
  12098. }
  12099. if (options.hasOwnProperty('include')) {
  12100. queryOptions.include = ParseObject.handleIncludeOptions(options);
  12101. }
  12102. return _CoreManager.default.getObjectController().fetch(list, true, queryOptions);
  12103. }
  12104. /**
  12105. * Fetches the given list of Parse.Object.
  12106. *
  12107. * Includes nested Parse.Objects for the provided key. You can use dot
  12108. * notation to specify which fields in the included object are also fetched.
  12109. *
  12110. * If any error is encountered, stops and calls the error handler.
  12111. *
  12112. * <pre>
  12113. * Parse.Object.fetchAllWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
  12114. * .then((list) => {
  12115. * // All the objects were fetched.
  12116. * }, (error) => {
  12117. * // An error occurred while fetching one of the objects.
  12118. * });
  12119. * </pre>
  12120. *
  12121. * @param {Array} list A list of <code>Parse.Object</code>.
  12122. * @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
  12123. * @param {object} options
  12124. * Valid options are:<ul>
  12125. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  12126. * be used for this request.
  12127. * <li>sessionToken: A valid session token, used for making a request on
  12128. * behalf of a specific user.
  12129. * </ul>
  12130. * @static
  12131. * @returns {Parse.Object[]}
  12132. */
  12133. }, {
  12134. key: "fetchAllWithInclude",
  12135. value: function fetchAllWithInclude(list
  12136. /*: Array<ParseObject>*/
  12137. , keys
  12138. /*: String | Array<string | Array<string>>*/
  12139. , options
  12140. /*: RequestOptions*/
  12141. ) {
  12142. options = options || {};
  12143. options.include = keys;
  12144. return ParseObject.fetchAll(list, options);
  12145. }
  12146. /**
  12147. * Fetches the given list of Parse.Object if needed.
  12148. * If any error is encountered, stops and calls the error handler.
  12149. *
  12150. * Includes nested Parse.Objects for the provided key. You can use dot
  12151. * notation to specify which fields in the included object are also fetched.
  12152. *
  12153. * If any error is encountered, stops and calls the error handler.
  12154. *
  12155. * <pre>
  12156. * Parse.Object.fetchAllIfNeededWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
  12157. * .then((list) => {
  12158. * // All the objects were fetched.
  12159. * }, (error) => {
  12160. * // An error occurred while fetching one of the objects.
  12161. * });
  12162. * </pre>
  12163. *
  12164. * @param {Array} list A list of <code>Parse.Object</code>.
  12165. * @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
  12166. * @param {object} options
  12167. * Valid options are:<ul>
  12168. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  12169. * be used for this request.
  12170. * <li>sessionToken: A valid session token, used for making a request on
  12171. * behalf of a specific user.
  12172. * </ul>
  12173. * @static
  12174. * @returns {Parse.Object[]}
  12175. */
  12176. }, {
  12177. key: "fetchAllIfNeededWithInclude",
  12178. value: function fetchAllIfNeededWithInclude(list
  12179. /*: Array<ParseObject>*/
  12180. , keys
  12181. /*: String | Array<string | Array<string>>*/
  12182. , options
  12183. /*: RequestOptions*/
  12184. ) {
  12185. options = options || {};
  12186. options.include = keys;
  12187. return ParseObject.fetchAllIfNeeded(list, options);
  12188. }
  12189. /**
  12190. * Fetches the given list of Parse.Object if needed.
  12191. * If any error is encountered, stops and calls the error handler.
  12192. *
  12193. * <pre>
  12194. * Parse.Object.fetchAllIfNeeded([object1, ...])
  12195. * .then((list) => {
  12196. * // Objects were fetched and updated.
  12197. * }, (error) => {
  12198. * // An error occurred while fetching one of the objects.
  12199. * });
  12200. * </pre>
  12201. *
  12202. * @param {Array} list A list of <code>Parse.Object</code>.
  12203. * @param {object} options
  12204. * @static
  12205. * @returns {Parse.Object[]}
  12206. */
  12207. }, {
  12208. key: "fetchAllIfNeeded",
  12209. value: function fetchAllIfNeeded(list
  12210. /*: Array<ParseObject>*/
  12211. , options) {
  12212. options = options || {};
  12213. var queryOptions = {};
  12214. if (options.hasOwnProperty('useMasterKey')) {
  12215. queryOptions.useMasterKey = options.useMasterKey;
  12216. }
  12217. if (options.hasOwnProperty('sessionToken')) {
  12218. queryOptions.sessionToken = options.sessionToken;
  12219. }
  12220. if (options.hasOwnProperty('include')) {
  12221. queryOptions.include = ParseObject.handleIncludeOptions(options);
  12222. }
  12223. return _CoreManager.default.getObjectController().fetch(list, false, queryOptions);
  12224. }
  12225. }, {
  12226. key: "handleIncludeOptions",
  12227. value: function handleIncludeOptions(options) {
  12228. var include = [];
  12229. if ((0, _isArray.default)(options.include)) {
  12230. var _context8;
  12231. (0, _forEach.default)(_context8 = options.include).call(_context8, function (key) {
  12232. if ((0, _isArray.default)(key)) {
  12233. include = (0, _concat.default)(include).call(include, key);
  12234. } else {
  12235. include.push(key);
  12236. }
  12237. });
  12238. } else {
  12239. include.push(options.include);
  12240. }
  12241. return include;
  12242. }
  12243. /**
  12244. * Destroy the given list of models on the server if it was already persisted.
  12245. *
  12246. * <p>Unlike saveAll, if an error occurs while deleting an individual model,
  12247. * this method will continue trying to delete the rest of the models if
  12248. * possible, except in the case of a fatal error like a connection error.
  12249. *
  12250. * <p>In particular, the Parse.Error object returned in the case of error may
  12251. * be one of two types:
  12252. *
  12253. * <ul>
  12254. * <li>A Parse.Error.AGGREGATE_ERROR. This object's "errors" property is an
  12255. * array of other Parse.Error objects. Each error object in this array
  12256. * has an "object" property that references the object that could not be
  12257. * deleted (for instance, because that object could not be found).</li>
  12258. * <li>A non-aggregate Parse.Error. This indicates a serious error that
  12259. * caused the delete operation to be aborted partway through (for
  12260. * instance, a connection failure in the middle of the delete).</li>
  12261. * </ul>
  12262. *
  12263. * <pre>
  12264. * Parse.Object.destroyAll([object1, object2, ...])
  12265. * .then((list) => {
  12266. * // All the objects were deleted.
  12267. * }, (error) => {
  12268. * // An error occurred while deleting one or more of the objects.
  12269. * // If this is an aggregate error, then we can inspect each error
  12270. * // object individually to determine the reason why a particular
  12271. * // object was not deleted.
  12272. * if (error.code === Parse.Error.AGGREGATE_ERROR) {
  12273. * for (var i = 0; i < error.errors.length; i++) {
  12274. * console.log("Couldn't delete " + error.errors[i].object.id +
  12275. * "due to " + error.errors[i].message);
  12276. * }
  12277. * } else {
  12278. * console.log("Delete aborted because of " + error.message);
  12279. * }
  12280. * });
  12281. * </pre>
  12282. *
  12283. * @param {Array} list A list of <code>Parse.Object</code>.
  12284. * @param {object} options
  12285. * @static
  12286. * @returns {Promise} A promise that is fulfilled when the destroyAll
  12287. * completes.
  12288. */
  12289. }, {
  12290. key: "destroyAll",
  12291. value: function destroyAll(list
  12292. /*: Array<ParseObject>*/
  12293. ) {
  12294. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  12295. var destroyOptions = {};
  12296. if (options.hasOwnProperty('useMasterKey')) {
  12297. destroyOptions.useMasterKey = options.useMasterKey;
  12298. }
  12299. if (options.hasOwnProperty('sessionToken')) {
  12300. destroyOptions.sessionToken = options.sessionToken;
  12301. }
  12302. if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
  12303. destroyOptions.batchSize = options.batchSize;
  12304. }
  12305. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  12306. destroyOptions.context = options.context;
  12307. }
  12308. return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
  12309. }
  12310. /**
  12311. * Saves the given list of Parse.Object.
  12312. * If any error is encountered, stops and calls the error handler.
  12313. *
  12314. * <pre>
  12315. * Parse.Object.saveAll([object1, object2, ...])
  12316. * .then((list) => {
  12317. * // All the objects were saved.
  12318. * }, (error) => {
  12319. * // An error occurred while saving one of the objects.
  12320. * });
  12321. * </pre>
  12322. *
  12323. * @param {Array} list A list of <code>Parse.Object</code>.
  12324. * @param {object} options
  12325. * @static
  12326. * @returns {Parse.Object[]}
  12327. */
  12328. }, {
  12329. key: "saveAll",
  12330. value: function saveAll(list
  12331. /*: Array<ParseObject>*/
  12332. ) {
  12333. var options
  12334. /*: RequestOptions*/
  12335. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  12336. var saveOptions = {};
  12337. if (options.hasOwnProperty('useMasterKey')) {
  12338. saveOptions.useMasterKey = options.useMasterKey;
  12339. }
  12340. if (options.hasOwnProperty('sessionToken')) {
  12341. saveOptions.sessionToken = options.sessionToken;
  12342. }
  12343. if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
  12344. saveOptions.batchSize = options.batchSize;
  12345. }
  12346. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  12347. saveOptions.context = options.context;
  12348. }
  12349. return _CoreManager.default.getObjectController().save(list, saveOptions);
  12350. }
  12351. /**
  12352. * Creates a reference to a subclass of Parse.Object with the given id. This
  12353. * does not exist on Parse.Object, only on subclasses.
  12354. *
  12355. * <p>A shortcut for: <pre>
  12356. * var Foo = Parse.Object.extend("Foo");
  12357. * var pointerToFoo = new Foo();
  12358. * pointerToFoo.id = "myObjectId";
  12359. * </pre>
  12360. *
  12361. * @param {string} id The ID of the object to create a reference to.
  12362. * @static
  12363. * @returns {Parse.Object} A Parse.Object reference.
  12364. */
  12365. }, {
  12366. key: "createWithoutData",
  12367. value: function createWithoutData(id
  12368. /*: string*/
  12369. ) {
  12370. var obj = new this();
  12371. obj.id = id;
  12372. return obj;
  12373. }
  12374. /**
  12375. * Creates a new instance of a Parse Object from a JSON representation.
  12376. *
  12377. * @param {object} json The JSON map of the Object's data
  12378. * @param {boolean} override In single instance mode, all old server data
  12379. * is overwritten if this is set to true
  12380. * @param {boolean} dirty Whether the Parse.Object should set JSON keys to dirty
  12381. * @static
  12382. * @returns {Parse.Object} A Parse.Object reference
  12383. */
  12384. }, {
  12385. key: "fromJSON",
  12386. value: function fromJSON(json
  12387. /*: any*/
  12388. , override
  12389. /*:: ?: boolean*/
  12390. , dirty
  12391. /*:: ?: boolean*/
  12392. ) {
  12393. if (!json.className) {
  12394. throw new Error('Cannot create an object without a className');
  12395. }
  12396. var constructor = classMap[json.className];
  12397. var o = constructor ? new constructor(json.className) : new ParseObject(json.className);
  12398. var otherAttributes = {};
  12399. for (var _attr12 in json) {
  12400. if (_attr12 !== 'className' && _attr12 !== '__type') {
  12401. otherAttributes[_attr12] = json[_attr12];
  12402. if (dirty) {
  12403. o.set(_attr12, json[_attr12]);
  12404. }
  12405. }
  12406. }
  12407. if (override) {
  12408. // id needs to be set before clearServerData can work
  12409. if (otherAttributes.objectId) {
  12410. o.id = otherAttributes.objectId;
  12411. }
  12412. var preserved = null;
  12413. if (typeof o._preserveFieldsOnFetch === 'function') {
  12414. preserved = o._preserveFieldsOnFetch();
  12415. }
  12416. o._clearServerData();
  12417. if (preserved) {
  12418. o._finishFetch(preserved);
  12419. }
  12420. }
  12421. o._finishFetch(otherAttributes);
  12422. if (json.objectId) {
  12423. o._setExisted(true);
  12424. }
  12425. return o;
  12426. }
  12427. /**
  12428. * Registers a subclass of Parse.Object with a specific class name.
  12429. * When objects of that class are retrieved from a query, they will be
  12430. * instantiated with this subclass.
  12431. * This is only necessary when using ES6 subclassing.
  12432. *
  12433. * @param {string} className The class name of the subclass
  12434. * @param {Function} constructor The subclass
  12435. */
  12436. }, {
  12437. key: "registerSubclass",
  12438. value: function registerSubclass(className
  12439. /*: string*/
  12440. , constructor
  12441. /*: any*/
  12442. ) {
  12443. if (typeof className !== 'string') {
  12444. throw new TypeError('The first argument must be a valid class name.');
  12445. }
  12446. if (typeof constructor === 'undefined') {
  12447. throw new TypeError('You must supply a subclass constructor.');
  12448. }
  12449. if (typeof constructor !== 'function') {
  12450. throw new TypeError('You must register the subclass constructor. ' + 'Did you attempt to register an instance of the subclass?');
  12451. }
  12452. classMap[className] = constructor;
  12453. if (!constructor.className) {
  12454. constructor.className = className;
  12455. }
  12456. }
  12457. /**
  12458. * Unegisters a subclass of Parse.Object with a specific class name.
  12459. *
  12460. * @param {string} className The class name of the subclass
  12461. */
  12462. }, {
  12463. key: "unregisterSubclass",
  12464. value: function unregisterSubclass(className
  12465. /*: string*/
  12466. ) {
  12467. if (typeof className !== 'string') {
  12468. throw new TypeError('The first argument must be a valid class name.');
  12469. }
  12470. delete classMap[className];
  12471. }
  12472. /**
  12473. * Creates a new subclass of Parse.Object for the given Parse class name.
  12474. *
  12475. * <p>Every extension of a Parse class will inherit from the most recent
  12476. * previous extension of that class. When a Parse.Object is automatically
  12477. * created by parsing JSON, it will use the most recent extension of that
  12478. * class.</p>
  12479. *
  12480. * <p>You should call either:<pre>
  12481. * var MyClass = Parse.Object.extend("MyClass", {
  12482. * <i>Instance methods</i>,
  12483. * initialize: function(attrs, options) {
  12484. * this.someInstanceProperty = [],
  12485. * <i>Other instance properties</i>
  12486. * }
  12487. * }, {
  12488. * <i>Class properties</i>
  12489. * });</pre>
  12490. * or, for Backbone compatibility:<pre>
  12491. * var MyClass = Parse.Object.extend({
  12492. * className: "MyClass",
  12493. * <i>Instance methods</i>,
  12494. * initialize: function(attrs, options) {
  12495. * this.someInstanceProperty = [],
  12496. * <i>Other instance properties</i>
  12497. * }
  12498. * }, {
  12499. * <i>Class properties</i>
  12500. * });</pre></p>
  12501. *
  12502. * @param {string} className The name of the Parse class backing this model.
  12503. * @param {object} protoProps Instance properties to add to instances of the
  12504. * class returned from this method.
  12505. * @param {object} classProps Class properties to add the class returned from
  12506. * this method.
  12507. * @returns {Parse.Object} A new subclass of Parse.Object.
  12508. */
  12509. }, {
  12510. key: "extend",
  12511. value: function extend(className
  12512. /*: any*/
  12513. , protoProps
  12514. /*: any*/
  12515. , classProps
  12516. /*: any*/
  12517. ) {
  12518. if (typeof className !== 'string') {
  12519. if (className && typeof className.className === 'string') {
  12520. return ParseObject.extend(className.className, className, protoProps);
  12521. } else {
  12522. throw new Error("Parse.Object.extend's first argument should be the className.");
  12523. }
  12524. }
  12525. var adjustedClassName = className;
  12526. if (adjustedClassName === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
  12527. adjustedClassName = '_User';
  12528. }
  12529. var parentProto = ParseObject.prototype;
  12530. if (this.hasOwnProperty('__super__') && this.__super__) {
  12531. parentProto = this.prototype;
  12532. } else if (classMap[adjustedClassName]) {
  12533. parentProto = classMap[adjustedClassName].prototype;
  12534. }
  12535. var ParseObjectSubclass = function ParseObjectSubclass(attributes, options) {
  12536. this.className = adjustedClassName;
  12537. this._objCount = objectCount++; // Enable legacy initializers
  12538. if (typeof this.initialize === 'function') {
  12539. this.initialize.apply(this, arguments);
  12540. }
  12541. if (attributes && (0, _typeof2.default)(attributes) === 'object') {
  12542. if (!this.set(attributes || {}, options)) {
  12543. throw new Error("Can't create an invalid Parse Object");
  12544. }
  12545. }
  12546. };
  12547. ParseObjectSubclass.className = adjustedClassName;
  12548. ParseObjectSubclass.__super__ = parentProto;
  12549. ParseObjectSubclass.prototype = (0, _create.default)(parentProto, {
  12550. constructor: {
  12551. value: ParseObjectSubclass,
  12552. enumerable: false,
  12553. writable: true,
  12554. configurable: true
  12555. }
  12556. });
  12557. if (protoProps) {
  12558. for (var prop in protoProps) {
  12559. if (prop !== 'className') {
  12560. (0, _defineProperty2.default)(ParseObjectSubclass.prototype, prop, {
  12561. value: protoProps[prop],
  12562. enumerable: false,
  12563. writable: true,
  12564. configurable: true
  12565. });
  12566. }
  12567. }
  12568. }
  12569. if (classProps) {
  12570. for (var _prop in classProps) {
  12571. if (_prop !== 'className') {
  12572. (0, _defineProperty2.default)(ParseObjectSubclass, _prop, {
  12573. value: classProps[_prop],
  12574. enumerable: false,
  12575. writable: true,
  12576. configurable: true
  12577. });
  12578. }
  12579. }
  12580. }
  12581. ParseObjectSubclass.extend = function (name, protoProps, classProps) {
  12582. if (typeof name === 'string') {
  12583. return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
  12584. }
  12585. return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
  12586. };
  12587. ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
  12588. classMap[adjustedClassName] = ParseObjectSubclass;
  12589. return ParseObjectSubclass;
  12590. }
  12591. /**
  12592. * Enable single instance objects, where any local objects with the same Id
  12593. * share the same attributes, and stay synchronized with each other.
  12594. * This is disabled by default in server environments, since it can lead to
  12595. * security issues.
  12596. *
  12597. * @static
  12598. */
  12599. }, {
  12600. key: "enableSingleInstance",
  12601. value: function enableSingleInstance() {
  12602. singleInstance = true;
  12603. _CoreManager.default.setObjectStateController(SingleInstanceStateController);
  12604. }
  12605. /**
  12606. * Disable single instance objects, where any local objects with the same Id
  12607. * share the same attributes, and stay synchronized with each other.
  12608. * When disabled, you can have two instances of the same object in memory
  12609. * without them sharing attributes.
  12610. *
  12611. * @static
  12612. */
  12613. }, {
  12614. key: "disableSingleInstance",
  12615. value: function disableSingleInstance() {
  12616. singleInstance = false;
  12617. _CoreManager.default.setObjectStateController(UniqueInstanceStateController);
  12618. }
  12619. /**
  12620. * Asynchronously stores the objects and every object they point to in the local datastore,
  12621. * recursively, using a default pin name: _default.
  12622. *
  12623. * If those other objects have not been fetched from Parse, they will not be stored.
  12624. * However, if they have changed data, all the changes will be retained.
  12625. *
  12626. * <pre>
  12627. * await Parse.Object.pinAll([...]);
  12628. * </pre>
  12629. *
  12630. * To retrieve object:
  12631. * <code>query.fromLocalDatastore()</code> or <code>query.fromPin()</code>
  12632. *
  12633. * @param {Array} objects A list of <code>Parse.Object</code>.
  12634. * @returns {Promise} A promise that is fulfilled when the pin completes.
  12635. * @static
  12636. */
  12637. }, {
  12638. key: "pinAll",
  12639. value: function pinAll(objects
  12640. /*: Array<ParseObject>*/
  12641. )
  12642. /*: Promise<void>*/
  12643. {
  12644. var localDatastore = _CoreManager.default.getLocalDatastore();
  12645. if (!localDatastore.isEnabled) {
  12646. return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
  12647. }
  12648. return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, objects);
  12649. }
  12650. /**
  12651. * Asynchronously stores the objects and every object they point to in the local datastore, recursively.
  12652. *
  12653. * If those other objects have not been fetched from Parse, they will not be stored.
  12654. * However, if they have changed data, all the changes will be retained.
  12655. *
  12656. * <pre>
  12657. * await Parse.Object.pinAllWithName(name, [obj1, obj2, ...]);
  12658. * </pre>
  12659. *
  12660. * To retrieve object:
  12661. * <code>query.fromLocalDatastore()</code> or <code>query.fromPinWithName(name)</code>
  12662. *
  12663. * @param {string} name Name of Pin.
  12664. * @param {Array} objects A list of <code>Parse.Object</code>.
  12665. * @returns {Promise} A promise that is fulfilled when the pin completes.
  12666. * @static
  12667. */
  12668. }, {
  12669. key: "pinAllWithName",
  12670. value: function pinAllWithName(name
  12671. /*: string*/
  12672. , objects
  12673. /*: Array<ParseObject>*/
  12674. )
  12675. /*: Promise<void>*/
  12676. {
  12677. var localDatastore = _CoreManager.default.getLocalDatastore();
  12678. if (!localDatastore.isEnabled) {
  12679. return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
  12680. }
  12681. return localDatastore._handlePinAllWithName(name, objects);
  12682. }
  12683. /**
  12684. * Asynchronously removes the objects and every object they point to in the local datastore,
  12685. * recursively, using a default pin name: _default.
  12686. *
  12687. * <pre>
  12688. * await Parse.Object.unPinAll([...]);
  12689. * </pre>
  12690. *
  12691. * @param {Array} objects A list of <code>Parse.Object</code>.
  12692. * @returns {Promise} A promise that is fulfilled when the unPin completes.
  12693. * @static
  12694. */
  12695. }, {
  12696. key: "unPinAll",
  12697. value: function unPinAll(objects
  12698. /*: Array<ParseObject>*/
  12699. )
  12700. /*: Promise<void>*/
  12701. {
  12702. var localDatastore = _CoreManager.default.getLocalDatastore();
  12703. if (!localDatastore.isEnabled) {
  12704. return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
  12705. }
  12706. return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, objects);
  12707. }
  12708. /**
  12709. * Asynchronously removes the objects and every object they point to in the local datastore, recursively.
  12710. *
  12711. * <pre>
  12712. * await Parse.Object.unPinAllWithName(name, [obj1, obj2, ...]);
  12713. * </pre>
  12714. *
  12715. * @param {string} name Name of Pin.
  12716. * @param {Array} objects A list of <code>Parse.Object</code>.
  12717. * @returns {Promise} A promise that is fulfilled when the unPin completes.
  12718. * @static
  12719. */
  12720. }, {
  12721. key: "unPinAllWithName",
  12722. value: function unPinAllWithName(name
  12723. /*: string*/
  12724. , objects
  12725. /*: Array<ParseObject>*/
  12726. )
  12727. /*: Promise<void>*/
  12728. {
  12729. var localDatastore = _CoreManager.default.getLocalDatastore();
  12730. if (!localDatastore.isEnabled) {
  12731. return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
  12732. }
  12733. return localDatastore._handleUnPinAllWithName(name, objects);
  12734. }
  12735. /**
  12736. * Asynchronously removes all objects in the local datastore using a default pin name: _default.
  12737. *
  12738. * <pre>
  12739. * await Parse.Object.unPinAllObjects();
  12740. * </pre>
  12741. *
  12742. * @returns {Promise} A promise that is fulfilled when the unPin completes.
  12743. * @static
  12744. */
  12745. }, {
  12746. key: "unPinAllObjects",
  12747. value: function unPinAllObjects()
  12748. /*: Promise<void>*/
  12749. {
  12750. var localDatastore = _CoreManager.default.getLocalDatastore();
  12751. if (!localDatastore.isEnabled) {
  12752. return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
  12753. }
  12754. return localDatastore.unPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
  12755. }
  12756. /**
  12757. * Asynchronously removes all objects with the specified pin name.
  12758. * Deletes the pin name also.
  12759. *
  12760. * <pre>
  12761. * await Parse.Object.unPinAllObjectsWithName(name);
  12762. * </pre>
  12763. *
  12764. * @param {string} name Name of Pin.
  12765. * @returns {Promise} A promise that is fulfilled when the unPin completes.
  12766. * @static
  12767. */
  12768. }, {
  12769. key: "unPinAllObjectsWithName",
  12770. value: function unPinAllObjectsWithName(name
  12771. /*: string*/
  12772. )
  12773. /*: Promise<void>*/
  12774. {
  12775. var localDatastore = _CoreManager.default.getLocalDatastore();
  12776. if (!localDatastore.isEnabled) {
  12777. return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
  12778. }
  12779. return localDatastore.unPinWithName(_LocalDatastoreUtils.PIN_PREFIX + name);
  12780. }
  12781. }]);
  12782. return ParseObject;
  12783. }();
  12784. var DefaultController = {
  12785. fetch: function fetch(target
  12786. /*: ParseObject | Array<ParseObject>*/
  12787. , forceFetch
  12788. /*: boolean*/
  12789. , options
  12790. /*: RequestOptions*/
  12791. )
  12792. /*: Promise<Array<void> | ParseObject>*/
  12793. {
  12794. var localDatastore = _CoreManager.default.getLocalDatastore();
  12795. if ((0, _isArray.default)(target)) {
  12796. if (target.length < 1) {
  12797. return _promise.default.resolve([]);
  12798. }
  12799. var objs = [];
  12800. var ids = [];
  12801. var className = null;
  12802. var results = [];
  12803. var error = null;
  12804. (0, _forEach.default)(target).call(target, function (el) {
  12805. if (error) {
  12806. return;
  12807. }
  12808. if (!className) {
  12809. className = el.className;
  12810. }
  12811. if (className !== el.className) {
  12812. error = new _ParseError.default(_ParseError.default.INVALID_CLASS_NAME, 'All objects should be of the same class');
  12813. }
  12814. if (!el.id) {
  12815. error = new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'All objects must have an ID');
  12816. }
  12817. if (forceFetch || !el.isDataAvailable()) {
  12818. ids.push(el.id);
  12819. objs.push(el);
  12820. }
  12821. results.push(el);
  12822. });
  12823. if (error) {
  12824. return _promise.default.reject(error);
  12825. }
  12826. var query = new _ParseQuery.default(className);
  12827. query.containedIn('objectId', ids);
  12828. if (options && options.include) {
  12829. query.include(options.include);
  12830. }
  12831. query._limit = ids.length;
  12832. return (0, _find.default)(query).call(query, options).then( /*#__PURE__*/function () {
  12833. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(objects) {
  12834. var idMap, i, obj, _i, _obj, id, _iterator2, _step2, object;
  12835. return _regeneratorRuntime().wrap(function _callee6$(_context9) {
  12836. while (1) {
  12837. switch (_context9.prev = _context9.next) {
  12838. case 0:
  12839. idMap = {};
  12840. (0, _forEach.default)(objects).call(objects, function (o) {
  12841. idMap[o.id] = o;
  12842. });
  12843. i = 0;
  12844. case 3:
  12845. if (!(i < objs.length)) {
  12846. _context9.next = 11;
  12847. break;
  12848. }
  12849. obj = objs[i];
  12850. if (!(!obj || !obj.id || !idMap[obj.id])) {
  12851. _context9.next = 8;
  12852. break;
  12853. }
  12854. if (!forceFetch) {
  12855. _context9.next = 8;
  12856. break;
  12857. }
  12858. return _context9.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'All objects must exist on the server.')));
  12859. case 8:
  12860. i++;
  12861. _context9.next = 3;
  12862. break;
  12863. case 11:
  12864. if (!singleInstance) {
  12865. // If single instance objects are disabled, we need to replace the
  12866. for (_i = 0; _i < results.length; _i++) {
  12867. _obj = results[_i];
  12868. if (_obj && _obj.id && idMap[_obj.id]) {
  12869. id = _obj.id;
  12870. _obj._finishFetch(idMap[id].toJSON());
  12871. results[_i] = idMap[id];
  12872. }
  12873. }
  12874. }
  12875. _iterator2 = _createForOfIteratorHelper(results);
  12876. _context9.prev = 13;
  12877. _iterator2.s();
  12878. case 15:
  12879. if ((_step2 = _iterator2.n()).done) {
  12880. _context9.next = 21;
  12881. break;
  12882. }
  12883. object = _step2.value;
  12884. _context9.next = 19;
  12885. return localDatastore._updateObjectIfPinned(object);
  12886. case 19:
  12887. _context9.next = 15;
  12888. break;
  12889. case 21:
  12890. _context9.next = 26;
  12891. break;
  12892. case 23:
  12893. _context9.prev = 23;
  12894. _context9.t0 = _context9["catch"](13);
  12895. _iterator2.e(_context9.t0);
  12896. case 26:
  12897. _context9.prev = 26;
  12898. _iterator2.f();
  12899. return _context9.finish(26);
  12900. case 29:
  12901. return _context9.abrupt("return", _promise.default.resolve(results));
  12902. case 30:
  12903. case "end":
  12904. return _context9.stop();
  12905. }
  12906. }
  12907. }, _callee6, null, [[13, 23, 26, 29]]);
  12908. }));
  12909. return function (_x4) {
  12910. return _ref.apply(this, arguments);
  12911. };
  12912. }());
  12913. } else if (target instanceof ParseObject) {
  12914. if (!target.id) {
  12915. return _promise.default.reject(new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'Object does not have an ID'));
  12916. }
  12917. var RESTController = _CoreManager.default.getRESTController();
  12918. var params = {};
  12919. if (options && options.include) {
  12920. params.include = options.include.join();
  12921. }
  12922. return RESTController.request('GET', 'classes/' + target.className + '/' + target._getId(), params, options).then( /*#__PURE__*/function () {
  12923. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(response) {
  12924. return _regeneratorRuntime().wrap(function _callee7$(_context10) {
  12925. while (1) {
  12926. switch (_context10.prev = _context10.next) {
  12927. case 0:
  12928. target._clearPendingOps();
  12929. target._clearServerData();
  12930. target._finishFetch(response);
  12931. _context10.next = 5;
  12932. return localDatastore._updateObjectIfPinned(target);
  12933. case 5:
  12934. return _context10.abrupt("return", target);
  12935. case 6:
  12936. case "end":
  12937. return _context10.stop();
  12938. }
  12939. }
  12940. }, _callee7);
  12941. }));
  12942. return function (_x5) {
  12943. return _ref2.apply(this, arguments);
  12944. };
  12945. }());
  12946. }
  12947. return _promise.default.resolve();
  12948. },
  12949. destroy: function destroy(target
  12950. /*: ParseObject | Array<ParseObject>*/
  12951. , options
  12952. /*: RequestOptions*/
  12953. )
  12954. /*: Promise<Array<void> | ParseObject>*/
  12955. {
  12956. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
  12957. var batchSize, localDatastore, RESTController, batches, deleteCompleted, errors;
  12958. return _regeneratorRuntime().wrap(function _callee10$(_context13) {
  12959. while (1) {
  12960. switch (_context13.prev = _context13.next) {
  12961. case 0:
  12962. batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
  12963. localDatastore = _CoreManager.default.getLocalDatastore();
  12964. RESTController = _CoreManager.default.getRESTController();
  12965. if (!(0, _isArray.default)(target)) {
  12966. _context13.next = 15;
  12967. break;
  12968. }
  12969. if (!(target.length < 1)) {
  12970. _context13.next = 6;
  12971. break;
  12972. }
  12973. return _context13.abrupt("return", _promise.default.resolve([]));
  12974. case 6:
  12975. batches = [[]];
  12976. (0, _forEach.default)(target).call(target, function (obj) {
  12977. if (!obj.id) {
  12978. return;
  12979. }
  12980. batches[batches.length - 1].push(obj);
  12981. if (batches[batches.length - 1].length >= batchSize) {
  12982. batches.push([]);
  12983. }
  12984. });
  12985. if (batches[batches.length - 1].length === 0) {
  12986. // If the last batch is empty, remove it
  12987. batches.pop();
  12988. }
  12989. deleteCompleted = _promise.default.resolve();
  12990. errors = [];
  12991. (0, _forEach.default)(batches).call(batches, function (batch) {
  12992. deleteCompleted = deleteCompleted.then(function () {
  12993. return RESTController.request('POST', 'batch', {
  12994. requests: (0, _map.default)(batch).call(batch, function (obj) {
  12995. return {
  12996. method: 'DELETE',
  12997. path: getServerUrlPath() + 'classes/' + obj.className + '/' + obj._getId(),
  12998. body: {}
  12999. };
  13000. })
  13001. }, options).then(function (results) {
  13002. for (var i = 0; i < results.length; i++) {
  13003. if (results[i] && results[i].hasOwnProperty('error')) {
  13004. var err = new _ParseError.default(results[i].error.code, results[i].error.error);
  13005. err.object = batch[i];
  13006. errors.push(err);
  13007. }
  13008. }
  13009. });
  13010. });
  13011. });
  13012. return _context13.abrupt("return", deleteCompleted.then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
  13013. var aggregate, _iterator3, _step3, object;
  13014. return _regeneratorRuntime().wrap(function _callee8$(_context11) {
  13015. while (1) {
  13016. switch (_context11.prev = _context11.next) {
  13017. case 0:
  13018. if (!errors.length) {
  13019. _context11.next = 4;
  13020. break;
  13021. }
  13022. aggregate = new _ParseError.default(_ParseError.default.AGGREGATE_ERROR);
  13023. aggregate.errors = errors;
  13024. return _context11.abrupt("return", _promise.default.reject(aggregate));
  13025. case 4:
  13026. _iterator3 = _createForOfIteratorHelper(target);
  13027. _context11.prev = 5;
  13028. _iterator3.s();
  13029. case 7:
  13030. if ((_step3 = _iterator3.n()).done) {
  13031. _context11.next = 13;
  13032. break;
  13033. }
  13034. object = _step3.value;
  13035. _context11.next = 11;
  13036. return localDatastore._destroyObjectIfPinned(object);
  13037. case 11:
  13038. _context11.next = 7;
  13039. break;
  13040. case 13:
  13041. _context11.next = 18;
  13042. break;
  13043. case 15:
  13044. _context11.prev = 15;
  13045. _context11.t0 = _context11["catch"](5);
  13046. _iterator3.e(_context11.t0);
  13047. case 18:
  13048. _context11.prev = 18;
  13049. _iterator3.f();
  13050. return _context11.finish(18);
  13051. case 21:
  13052. return _context11.abrupt("return", _promise.default.resolve(target));
  13053. case 22:
  13054. case "end":
  13055. return _context11.stop();
  13056. }
  13057. }
  13058. }, _callee8, null, [[5, 15, 18, 21]]);
  13059. }))));
  13060. case 15:
  13061. if (!(target instanceof ParseObject)) {
  13062. _context13.next = 17;
  13063. break;
  13064. }
  13065. return _context13.abrupt("return", RESTController.request('DELETE', 'classes/' + target.className + '/' + target._getId(), {}, options).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
  13066. return _regeneratorRuntime().wrap(function _callee9$(_context12) {
  13067. while (1) {
  13068. switch (_context12.prev = _context12.next) {
  13069. case 0:
  13070. _context12.next = 2;
  13071. return localDatastore._destroyObjectIfPinned(target);
  13072. case 2:
  13073. return _context12.abrupt("return", _promise.default.resolve(target));
  13074. case 3:
  13075. case "end":
  13076. return _context12.stop();
  13077. }
  13078. }
  13079. }, _callee9);
  13080. }))));
  13081. case 17:
  13082. return _context13.abrupt("return", _promise.default.resolve(target));
  13083. case 18:
  13084. case "end":
  13085. return _context13.stop();
  13086. }
  13087. }
  13088. }, _callee10);
  13089. }))();
  13090. },
  13091. save: function save(target
  13092. /*: ParseObject | Array<ParseObject | ParseFile>*/
  13093. , options
  13094. /*: RequestOptions*/
  13095. ) {
  13096. var batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
  13097. var localDatastore = _CoreManager.default.getLocalDatastore();
  13098. var mapIdForPin = {};
  13099. var RESTController = _CoreManager.default.getRESTController();
  13100. var stateController = _CoreManager.default.getObjectStateController();
  13101. var allowCustomObjectId = _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
  13102. options = options || {};
  13103. options.returnStatus = options.returnStatus || true;
  13104. if ((0, _isArray.default)(target)) {
  13105. if (target.length < 1) {
  13106. return _promise.default.resolve([]);
  13107. }
  13108. var unsaved = (0, _concat.default)(target).call(target);
  13109. for (var i = 0; i < target.length; i++) {
  13110. if (target[i] instanceof ParseObject) {
  13111. unsaved = (0, _concat.default)(unsaved).call(unsaved, (0, _unsavedChildren.default)(target[i], true));
  13112. }
  13113. }
  13114. unsaved = (0, _unique.default)(unsaved);
  13115. var filesSaved
  13116. /*: Array<ParseFile>*/
  13117. = [];
  13118. var pending
  13119. /*: Array<ParseObject>*/
  13120. = [];
  13121. (0, _forEach.default)(unsaved).call(unsaved, function (el) {
  13122. if (el instanceof _ParseFile.default) {
  13123. filesSaved.push(el.save(options));
  13124. } else if (el instanceof ParseObject) {
  13125. pending.push(el);
  13126. }
  13127. });
  13128. return _promise.default.all(filesSaved).then(function () {
  13129. var objectError = null;
  13130. return (0, _promiseUtils.continueWhile)(function () {
  13131. return pending.length > 0;
  13132. }, function () {
  13133. var batch = [];
  13134. var nextPending = [];
  13135. (0, _forEach.default)(pending).call(pending, function (el) {
  13136. if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(el, 'id') && !el.id) {
  13137. throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
  13138. }
  13139. if (batch.length < batchSize && (0, _canBeSerialized.default)(el)) {
  13140. batch.push(el);
  13141. } else {
  13142. nextPending.push(el);
  13143. }
  13144. });
  13145. pending = nextPending;
  13146. if (batch.length < 1) {
  13147. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
  13148. } // Queue up tasks for each object in the batch.
  13149. // When every task is ready, the API request will execute
  13150. var batchReturned = new _promiseUtils.resolvingPromise();
  13151. var batchReady = [];
  13152. var batchTasks = [];
  13153. (0, _forEach.default)(batch).call(batch, function (obj, index) {
  13154. var ready = new _promiseUtils.resolvingPromise();
  13155. batchReady.push(ready);
  13156. var task = function task() {
  13157. ready.resolve();
  13158. return batchReturned.then(function (responses) {
  13159. if (responses[index].hasOwnProperty('success')) {
  13160. var objectId = responses[index].success.objectId;
  13161. var status = responses[index]._status;
  13162. delete responses[index]._status;
  13163. mapIdForPin[objectId] = obj._localId;
  13164. obj._handleSaveResponse(responses[index].success, status);
  13165. } else {
  13166. if (!objectError && responses[index].hasOwnProperty('error')) {
  13167. var serverError = responses[index].error;
  13168. objectError = new _ParseError.default(serverError.code, serverError.error); // Cancel the rest of the save
  13169. pending = [];
  13170. }
  13171. obj._handleSaveError();
  13172. }
  13173. });
  13174. };
  13175. stateController.pushPendingState(obj._getStateIdentifier());
  13176. batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), task));
  13177. });
  13178. (0, _promiseUtils.when)(batchReady).then(function () {
  13179. // Kick off the batch request
  13180. return RESTController.request('POST', 'batch', {
  13181. requests: (0, _map.default)(batch).call(batch, function (obj) {
  13182. var params = obj._getSaveParams();
  13183. params.path = getServerUrlPath() + params.path;
  13184. return params;
  13185. })
  13186. }, options);
  13187. }).then(batchReturned.resolve, function (error) {
  13188. batchReturned.reject(new _ParseError.default(_ParseError.default.INCORRECT_TYPE, error.message));
  13189. });
  13190. return (0, _promiseUtils.when)(batchTasks);
  13191. }).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
  13192. var _iterator4, _step4, object;
  13193. return _regeneratorRuntime().wrap(function _callee11$(_context14) {
  13194. while (1) {
  13195. switch (_context14.prev = _context14.next) {
  13196. case 0:
  13197. if (!objectError) {
  13198. _context14.next = 2;
  13199. break;
  13200. }
  13201. return _context14.abrupt("return", _promise.default.reject(objectError));
  13202. case 2:
  13203. _iterator4 = _createForOfIteratorHelper(target);
  13204. _context14.prev = 3;
  13205. _iterator4.s();
  13206. case 5:
  13207. if ((_step4 = _iterator4.n()).done) {
  13208. _context14.next = 13;
  13209. break;
  13210. }
  13211. object = _step4.value;
  13212. _context14.next = 9;
  13213. return localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object);
  13214. case 9:
  13215. _context14.next = 11;
  13216. return localDatastore._updateObjectIfPinned(object);
  13217. case 11:
  13218. _context14.next = 5;
  13219. break;
  13220. case 13:
  13221. _context14.next = 18;
  13222. break;
  13223. case 15:
  13224. _context14.prev = 15;
  13225. _context14.t0 = _context14["catch"](3);
  13226. _iterator4.e(_context14.t0);
  13227. case 18:
  13228. _context14.prev = 18;
  13229. _iterator4.f();
  13230. return _context14.finish(18);
  13231. case 21:
  13232. return _context14.abrupt("return", _promise.default.resolve(target));
  13233. case 22:
  13234. case "end":
  13235. return _context14.stop();
  13236. }
  13237. }
  13238. }, _callee11, null, [[3, 15, 18, 21]]);
  13239. })));
  13240. });
  13241. } else if (target instanceof ParseObject) {
  13242. if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(target, 'id') && !target.id) {
  13243. throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
  13244. } // generate _localId in case if cascadeSave=false
  13245. target._getId();
  13246. var localId = target._localId; // copying target lets Flow guarantee the pointer isn't modified elsewhere
  13247. var targetCopy = target;
  13248. var task = function task() {
  13249. var params = targetCopy._getSaveParams();
  13250. return RESTController.request(params.method, params.path, params.body, options).then(function (response) {
  13251. var status = response._status;
  13252. delete response._status;
  13253. targetCopy._handleSaveResponse(response, status);
  13254. }, function (error) {
  13255. targetCopy._handleSaveError();
  13256. return _promise.default.reject(error);
  13257. });
  13258. };
  13259. stateController.pushPendingState(target._getStateIdentifier());
  13260. return stateController.enqueueTask(target._getStateIdentifier(), task).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
  13261. return _regeneratorRuntime().wrap(function _callee12$(_context15) {
  13262. while (1) {
  13263. switch (_context15.prev = _context15.next) {
  13264. case 0:
  13265. _context15.next = 2;
  13266. return localDatastore._updateLocalIdForObject(localId, target);
  13267. case 2:
  13268. _context15.next = 4;
  13269. return localDatastore._updateObjectIfPinned(target);
  13270. case 4:
  13271. return _context15.abrupt("return", target);
  13272. case 5:
  13273. case "end":
  13274. return _context15.stop();
  13275. }
  13276. }
  13277. }, _callee12);
  13278. })), function (error) {
  13279. return _promise.default.reject(error);
  13280. });
  13281. }
  13282. return _promise.default.resolve();
  13283. }
  13284. };
  13285. _CoreManager.default.setObjectController(DefaultController);
  13286. var _default = ParseObject;
  13287. exports.default = _default;
  13288. },{"./CoreManager":4,"./EventuallyQueue":7,"./LocalDatastoreUtils":14,"./ParseACL":18,"./ParseError":21,"./ParseFile":22,"./ParseOp":27,"./ParseQuery":29,"./ParseRelation":30,"./SingleInstanceStateController":37,"./UniqueInstanceStateController":42,"./canBeSerialized":45,"./decode":46,"./encode":47,"./escape":49,"./parseDate":51,"./promiseUtils":52,"./unique":53,"./unsavedChildren":54,"./uuid":55,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/find":64,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/includes":66,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-properties":82,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/freeze":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":87,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":88,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js-stable/weak-map":99,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],27:[function(_dereq_,module,exports){
  13289. "use strict";
  13290. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  13291. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  13292. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  13293. _Object$defineProperty(exports, "__esModule", {
  13294. value: true
  13295. });
  13296. exports.UnsetOp = exports.SetOp = exports.RemoveOp = exports.RelationOp = exports.Op = exports.IncrementOp = exports.AddUniqueOp = exports.AddOp = void 0;
  13297. exports.opFromJSON = opFromJSON;
  13298. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  13299. var _splice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/splice"));
  13300. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  13301. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  13302. var _assertThisInitialized2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/assertThisInitialized"));
  13303. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  13304. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  13305. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  13306. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  13307. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  13308. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  13309. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  13310. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  13311. var _arrayContainsObject = _interopRequireDefault(_dereq_("./arrayContainsObject"));
  13312. var _decode = _interopRequireDefault(_dereq_("./decode"));
  13313. var _encode = _interopRequireDefault(_dereq_("./encode"));
  13314. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  13315. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  13316. var _unique = _interopRequireDefault(_dereq_("./unique"));
  13317. function _createSuper(Derived) {
  13318. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  13319. return function () {
  13320. var Super = (0, _getPrototypeOf2.default)(Derived),
  13321. result;
  13322. if (hasNativeReflectConstruct) {
  13323. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  13324. result = _Reflect$construct(Super, arguments, NewTarget);
  13325. } else {
  13326. result = Super.apply(this, arguments);
  13327. }
  13328. return (0, _possibleConstructorReturn2.default)(this, result);
  13329. };
  13330. }
  13331. function _isNativeReflectConstruct() {
  13332. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  13333. if (_Reflect$construct.sham) return false;
  13334. if (typeof Proxy === "function") return true;
  13335. try {
  13336. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  13337. return true;
  13338. } catch (e) {
  13339. return false;
  13340. }
  13341. }
  13342. function opFromJSON(json
  13343. /*: { [key: string]: any }*/
  13344. )
  13345. /*: ?Op*/
  13346. {
  13347. if (!json || !json.__op) {
  13348. return null;
  13349. }
  13350. switch (json.__op) {
  13351. case 'Delete':
  13352. return new UnsetOp();
  13353. case 'Increment':
  13354. return new IncrementOp(json.amount);
  13355. case 'Add':
  13356. return new AddOp((0, _decode.default)(json.objects));
  13357. case 'AddUnique':
  13358. return new AddUniqueOp((0, _decode.default)(json.objects));
  13359. case 'Remove':
  13360. return new RemoveOp((0, _decode.default)(json.objects));
  13361. case 'AddRelation':
  13362. {
  13363. var toAdd = (0, _decode.default)(json.objects);
  13364. if (!(0, _isArray.default)(toAdd)) {
  13365. return new RelationOp([], []);
  13366. }
  13367. return new RelationOp(toAdd, []);
  13368. }
  13369. case 'RemoveRelation':
  13370. {
  13371. var toRemove = (0, _decode.default)(json.objects);
  13372. if (!(0, _isArray.default)(toRemove)) {
  13373. return new RelationOp([], []);
  13374. }
  13375. return new RelationOp([], toRemove);
  13376. }
  13377. case 'Batch':
  13378. {
  13379. var _toAdd = [];
  13380. var _toRemove = [];
  13381. for (var i = 0; i < json.ops.length; i++) {
  13382. if (json.ops[i].__op === 'AddRelation') {
  13383. _toAdd = (0, _concat.default)(_toAdd).call(_toAdd, (0, _decode.default)(json.ops[i].objects));
  13384. } else if (json.ops[i].__op === 'RemoveRelation') {
  13385. _toRemove = (0, _concat.default)(_toRemove).call(_toRemove, (0, _decode.default)(json.ops[i].objects));
  13386. }
  13387. }
  13388. return new RelationOp(_toAdd, _toRemove);
  13389. }
  13390. }
  13391. return null;
  13392. }
  13393. var Op = /*#__PURE__*/function () {
  13394. function Op() {
  13395. (0, _classCallCheck2.default)(this, Op);
  13396. }
  13397. (0, _createClass2.default)(Op, [{
  13398. key: "applyTo",
  13399. value: // Empty parent class
  13400. function ()
  13401. /*: mixed*/
  13402. {}
  13403. /* eslint-disable-line no-unused-vars */
  13404. }, {
  13405. key: "mergeWith",
  13406. value: function ()
  13407. /*: ?Op*/
  13408. {}
  13409. /* eslint-disable-line no-unused-vars */
  13410. }, {
  13411. key: "toJSON",
  13412. value: function ()
  13413. /*: mixed*/
  13414. {}
  13415. }]);
  13416. return Op;
  13417. }();
  13418. exports.Op = Op;
  13419. var SetOp = /*#__PURE__*/function (_Op) {
  13420. (0, _inherits2.default)(SetOp, _Op);
  13421. var _super = _createSuper(SetOp);
  13422. function SetOp(value
  13423. /*: mixed*/
  13424. ) {
  13425. var _this;
  13426. (0, _classCallCheck2.default)(this, SetOp);
  13427. _this = _super.call(this);
  13428. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_value", void 0);
  13429. _this._value = value;
  13430. return _this;
  13431. }
  13432. (0, _createClass2.default)(SetOp, [{
  13433. key: "applyTo",
  13434. value: function ()
  13435. /*: mixed*/
  13436. {
  13437. return this._value;
  13438. }
  13439. }, {
  13440. key: "mergeWith",
  13441. value: function ()
  13442. /*: SetOp*/
  13443. {
  13444. return new SetOp(this._value);
  13445. }
  13446. }, {
  13447. key: "toJSON",
  13448. value: function (offline
  13449. /*:: ?: boolean*/
  13450. ) {
  13451. return (0, _encode.default)(this._value, false, true, undefined, offline);
  13452. }
  13453. }]);
  13454. return SetOp;
  13455. }(Op);
  13456. exports.SetOp = SetOp;
  13457. var UnsetOp = /*#__PURE__*/function (_Op2) {
  13458. (0, _inherits2.default)(UnsetOp, _Op2);
  13459. var _super2 = _createSuper(UnsetOp);
  13460. function UnsetOp() {
  13461. (0, _classCallCheck2.default)(this, UnsetOp);
  13462. return _super2.apply(this, arguments);
  13463. }
  13464. (0, _createClass2.default)(UnsetOp, [{
  13465. key: "applyTo",
  13466. value: function () {
  13467. return undefined;
  13468. }
  13469. }, {
  13470. key: "mergeWith",
  13471. value: function ()
  13472. /*: UnsetOp*/
  13473. {
  13474. return new UnsetOp();
  13475. }
  13476. }, {
  13477. key: "toJSON",
  13478. value: function ()
  13479. /*: { __op: string }*/
  13480. {
  13481. return {
  13482. __op: 'Delete'
  13483. };
  13484. }
  13485. }]);
  13486. return UnsetOp;
  13487. }(Op);
  13488. exports.UnsetOp = UnsetOp;
  13489. var IncrementOp = /*#__PURE__*/function (_Op3) {
  13490. (0, _inherits2.default)(IncrementOp, _Op3);
  13491. var _super3 = _createSuper(IncrementOp);
  13492. function IncrementOp(amount
  13493. /*: number*/
  13494. ) {
  13495. var _this2;
  13496. (0, _classCallCheck2.default)(this, IncrementOp);
  13497. _this2 = _super3.call(this);
  13498. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "_amount", void 0);
  13499. if (typeof amount !== 'number') {
  13500. throw new TypeError('Increment Op must be initialized with a numeric amount.');
  13501. }
  13502. _this2._amount = amount;
  13503. return _this2;
  13504. }
  13505. (0, _createClass2.default)(IncrementOp, [{
  13506. key: "applyTo",
  13507. value: function (value
  13508. /*: ?mixed*/
  13509. )
  13510. /*: number*/
  13511. {
  13512. if (typeof value === 'undefined') {
  13513. return this._amount;
  13514. }
  13515. if (typeof value !== 'number') {
  13516. throw new TypeError('Cannot increment a non-numeric value.');
  13517. }
  13518. return this._amount + value;
  13519. }
  13520. }, {
  13521. key: "mergeWith",
  13522. value: function (previous
  13523. /*: Op*/
  13524. )
  13525. /*: Op*/
  13526. {
  13527. if (!previous) {
  13528. return this;
  13529. }
  13530. if (previous instanceof SetOp) {
  13531. return new SetOp(this.applyTo(previous._value));
  13532. }
  13533. if (previous instanceof UnsetOp) {
  13534. return new SetOp(this._amount);
  13535. }
  13536. if (previous instanceof IncrementOp) {
  13537. return new IncrementOp(this.applyTo(previous._amount));
  13538. }
  13539. throw new Error('Cannot merge Increment Op with the previous Op');
  13540. }
  13541. }, {
  13542. key: "toJSON",
  13543. value: function ()
  13544. /*: { __op: string, amount: number }*/
  13545. {
  13546. return {
  13547. __op: 'Increment',
  13548. amount: this._amount
  13549. };
  13550. }
  13551. }]);
  13552. return IncrementOp;
  13553. }(Op);
  13554. exports.IncrementOp = IncrementOp;
  13555. var AddOp = /*#__PURE__*/function (_Op4) {
  13556. (0, _inherits2.default)(AddOp, _Op4);
  13557. var _super4 = _createSuper(AddOp);
  13558. function AddOp(value
  13559. /*: mixed | Array<mixed>*/
  13560. ) {
  13561. var _this3;
  13562. (0, _classCallCheck2.default)(this, AddOp);
  13563. _this3 = _super4.call(this);
  13564. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "_value", void 0);
  13565. _this3._value = (0, _isArray.default)(value) ? value : [value];
  13566. return _this3;
  13567. }
  13568. (0, _createClass2.default)(AddOp, [{
  13569. key: "applyTo",
  13570. value: function (value
  13571. /*: mixed*/
  13572. )
  13573. /*: Array<mixed>*/
  13574. {
  13575. if (value == null) {
  13576. return this._value;
  13577. }
  13578. if ((0, _isArray.default)(value)) {
  13579. return (0, _concat.default)(value).call(value, this._value);
  13580. }
  13581. throw new Error('Cannot add elements to a non-array value');
  13582. }
  13583. }, {
  13584. key: "mergeWith",
  13585. value: function (previous
  13586. /*: Op*/
  13587. )
  13588. /*: Op*/
  13589. {
  13590. if (!previous) {
  13591. return this;
  13592. }
  13593. if (previous instanceof SetOp) {
  13594. return new SetOp(this.applyTo(previous._value));
  13595. }
  13596. if (previous instanceof UnsetOp) {
  13597. return new SetOp(this._value);
  13598. }
  13599. if (previous instanceof AddOp) {
  13600. return new AddOp(this.applyTo(previous._value));
  13601. }
  13602. throw new Error('Cannot merge Add Op with the previous Op');
  13603. }
  13604. }, {
  13605. key: "toJSON",
  13606. value: function ()
  13607. /*: { __op: string, objects: mixed }*/
  13608. {
  13609. return {
  13610. __op: 'Add',
  13611. objects: (0, _encode.default)(this._value, false, true)
  13612. };
  13613. }
  13614. }]);
  13615. return AddOp;
  13616. }(Op);
  13617. exports.AddOp = AddOp;
  13618. var AddUniqueOp = /*#__PURE__*/function (_Op5) {
  13619. (0, _inherits2.default)(AddUniqueOp, _Op5);
  13620. var _super5 = _createSuper(AddUniqueOp);
  13621. function AddUniqueOp(value
  13622. /*: mixed | Array<mixed>*/
  13623. ) {
  13624. var _this4;
  13625. (0, _classCallCheck2.default)(this, AddUniqueOp);
  13626. _this4 = _super5.call(this);
  13627. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this4), "_value", void 0);
  13628. _this4._value = (0, _unique.default)((0, _isArray.default)(value) ? value : [value]);
  13629. return _this4;
  13630. }
  13631. (0, _createClass2.default)(AddUniqueOp, [{
  13632. key: "applyTo",
  13633. value: function (value
  13634. /*: mixed | Array<mixed>*/
  13635. )
  13636. /*: Array<mixed>*/
  13637. {
  13638. if (value == null) {
  13639. return this._value || [];
  13640. }
  13641. if ((0, _isArray.default)(value)) {
  13642. var _context;
  13643. var toAdd = [];
  13644. (0, _forEach.default)(_context = this._value).call(_context, function (v) {
  13645. if (v instanceof _ParseObject.default) {
  13646. if (!(0, _arrayContainsObject.default)(value, v)) {
  13647. toAdd.push(v);
  13648. }
  13649. } else {
  13650. if ((0, _indexOf.default)(value).call(value, v) < 0) {
  13651. toAdd.push(v);
  13652. }
  13653. }
  13654. });
  13655. return (0, _concat.default)(value).call(value, toAdd);
  13656. }
  13657. throw new Error('Cannot add elements to a non-array value');
  13658. }
  13659. }, {
  13660. key: "mergeWith",
  13661. value: function (previous
  13662. /*: Op*/
  13663. )
  13664. /*: Op*/
  13665. {
  13666. if (!previous) {
  13667. return this;
  13668. }
  13669. if (previous instanceof SetOp) {
  13670. return new SetOp(this.applyTo(previous._value));
  13671. }
  13672. if (previous instanceof UnsetOp) {
  13673. return new SetOp(this._value);
  13674. }
  13675. if (previous instanceof AddUniqueOp) {
  13676. return new AddUniqueOp(this.applyTo(previous._value));
  13677. }
  13678. throw new Error('Cannot merge AddUnique Op with the previous Op');
  13679. }
  13680. }, {
  13681. key: "toJSON",
  13682. value: function ()
  13683. /*: { __op: string, objects: mixed }*/
  13684. {
  13685. return {
  13686. __op: 'AddUnique',
  13687. objects: (0, _encode.default)(this._value, false, true)
  13688. };
  13689. }
  13690. }]);
  13691. return AddUniqueOp;
  13692. }(Op);
  13693. exports.AddUniqueOp = AddUniqueOp;
  13694. var RemoveOp = /*#__PURE__*/function (_Op6) {
  13695. (0, _inherits2.default)(RemoveOp, _Op6);
  13696. var _super6 = _createSuper(RemoveOp);
  13697. function RemoveOp(value
  13698. /*: mixed | Array<mixed>*/
  13699. ) {
  13700. var _this5;
  13701. (0, _classCallCheck2.default)(this, RemoveOp);
  13702. _this5 = _super6.call(this);
  13703. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this5), "_value", void 0);
  13704. _this5._value = (0, _unique.default)((0, _isArray.default)(value) ? value : [value]);
  13705. return _this5;
  13706. }
  13707. (0, _createClass2.default)(RemoveOp, [{
  13708. key: "applyTo",
  13709. value: function (value
  13710. /*: mixed | Array<mixed>*/
  13711. )
  13712. /*: Array<mixed>*/
  13713. {
  13714. if (value == null) {
  13715. return [];
  13716. }
  13717. if ((0, _isArray.default)(value)) {
  13718. // var i = value.indexOf(this._value);
  13719. var removed = (0, _concat.default)(value).call(value, []);
  13720. for (var i = 0; i < this._value.length; i++) {
  13721. var index = (0, _indexOf.default)(removed).call(removed, this._value[i]);
  13722. while (index > -1) {
  13723. (0, _splice.default)(removed).call(removed, index, 1);
  13724. index = (0, _indexOf.default)(removed).call(removed, this._value[i]);
  13725. }
  13726. if (this._value[i] instanceof _ParseObject.default && this._value[i].id) {
  13727. for (var j = 0; j < removed.length; j++) {
  13728. if (removed[j] instanceof _ParseObject.default && this._value[i].id === removed[j].id) {
  13729. (0, _splice.default)(removed).call(removed, j, 1);
  13730. j--;
  13731. }
  13732. }
  13733. }
  13734. }
  13735. return removed;
  13736. }
  13737. throw new Error('Cannot remove elements from a non-array value');
  13738. }
  13739. }, {
  13740. key: "mergeWith",
  13741. value: function (previous
  13742. /*: Op*/
  13743. )
  13744. /*: Op*/
  13745. {
  13746. if (!previous) {
  13747. return this;
  13748. }
  13749. if (previous instanceof SetOp) {
  13750. return new SetOp(this.applyTo(previous._value));
  13751. }
  13752. if (previous instanceof UnsetOp) {
  13753. return new UnsetOp();
  13754. }
  13755. if (previous instanceof RemoveOp) {
  13756. var _context2;
  13757. var uniques = (0, _concat.default)(_context2 = previous._value).call(_context2, []);
  13758. for (var i = 0; i < this._value.length; i++) {
  13759. if (this._value[i] instanceof _ParseObject.default) {
  13760. if (!(0, _arrayContainsObject.default)(uniques, this._value[i])) {
  13761. uniques.push(this._value[i]);
  13762. }
  13763. } else {
  13764. if ((0, _indexOf.default)(uniques).call(uniques, this._value[i]) < 0) {
  13765. uniques.push(this._value[i]);
  13766. }
  13767. }
  13768. }
  13769. return new RemoveOp(uniques);
  13770. }
  13771. throw new Error('Cannot merge Remove Op with the previous Op');
  13772. }
  13773. }, {
  13774. key: "toJSON",
  13775. value: function ()
  13776. /*: { __op: string, objects: mixed }*/
  13777. {
  13778. return {
  13779. __op: 'Remove',
  13780. objects: (0, _encode.default)(this._value, false, true)
  13781. };
  13782. }
  13783. }]);
  13784. return RemoveOp;
  13785. }(Op);
  13786. exports.RemoveOp = RemoveOp;
  13787. var RelationOp = /*#__PURE__*/function (_Op7) {
  13788. (0, _inherits2.default)(RelationOp, _Op7);
  13789. var _super7 = _createSuper(RelationOp);
  13790. function RelationOp(adds
  13791. /*: Array<ParseObject | string>*/
  13792. , removes
  13793. /*: Array<ParseObject | string>*/
  13794. ) {
  13795. var _this6;
  13796. (0, _classCallCheck2.default)(this, RelationOp);
  13797. _this6 = _super7.call(this);
  13798. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "_targetClassName", void 0);
  13799. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "relationsToAdd", void 0);
  13800. (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "relationsToRemove", void 0);
  13801. _this6._targetClassName = null;
  13802. if ((0, _isArray.default)(adds)) {
  13803. _this6.relationsToAdd = (0, _unique.default)((0, _map.default)(adds).call(adds, _this6._extractId, (0, _assertThisInitialized2.default)(_this6)));
  13804. }
  13805. if ((0, _isArray.default)(removes)) {
  13806. _this6.relationsToRemove = (0, _unique.default)((0, _map.default)(removes).call(removes, _this6._extractId, (0, _assertThisInitialized2.default)(_this6)));
  13807. }
  13808. return _this6;
  13809. }
  13810. (0, _createClass2.default)(RelationOp, [{
  13811. key: "_extractId",
  13812. value: function (obj
  13813. /*: string | ParseObject*/
  13814. )
  13815. /*: string*/
  13816. {
  13817. if (typeof obj === 'string') {
  13818. return obj;
  13819. }
  13820. if (!obj.id) {
  13821. throw new Error('You cannot add or remove an unsaved Parse Object from a relation');
  13822. }
  13823. if (!this._targetClassName) {
  13824. this._targetClassName = obj.className;
  13825. }
  13826. if (this._targetClassName !== obj.className) {
  13827. throw new Error('Tried to create a Relation with 2 different object types: ' + this._targetClassName + ' and ' + obj.className + '.');
  13828. }
  13829. return obj.id;
  13830. }
  13831. }, {
  13832. key: "applyTo",
  13833. value: function (value
  13834. /*: mixed*/
  13835. , object
  13836. /*:: ?: { className: string, id: ?string }*/
  13837. , key
  13838. /*:: ?: string*/
  13839. )
  13840. /*: ?ParseRelation*/
  13841. {
  13842. if (!value) {
  13843. var _context3;
  13844. if (!object || !key) {
  13845. throw new Error('Cannot apply a RelationOp without either a previous value, or an object and a key');
  13846. }
  13847. var parent = new _ParseObject.default(object.className);
  13848. if (object.id && (0, _indexOf.default)(_context3 = object.id).call(_context3, 'local') === 0) {
  13849. parent._localId = object.id;
  13850. } else if (object.id) {
  13851. parent.id = object.id;
  13852. }
  13853. var relation = new _ParseRelation.default(parent, key);
  13854. relation.targetClassName = this._targetClassName;
  13855. return relation;
  13856. }
  13857. if (value instanceof _ParseRelation.default) {
  13858. if (this._targetClassName) {
  13859. if (value.targetClassName) {
  13860. if (this._targetClassName !== value.targetClassName) {
  13861. throw new Error('Related object must be a ' + value.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
  13862. }
  13863. } else {
  13864. value.targetClassName = this._targetClassName;
  13865. }
  13866. }
  13867. return value;
  13868. } else {
  13869. throw new Error('Relation cannot be applied to a non-relation field');
  13870. }
  13871. }
  13872. }, {
  13873. key: "mergeWith",
  13874. value: function (previous
  13875. /*: Op*/
  13876. )
  13877. /*: Op*/
  13878. {
  13879. if (!previous) {
  13880. return this;
  13881. } else if (previous instanceof UnsetOp) {
  13882. throw new Error('You cannot modify a relation after deleting it.');
  13883. } else if (previous instanceof SetOp && previous._value instanceof _ParseRelation.default) {
  13884. return this;
  13885. } else if (previous instanceof RelationOp) {
  13886. var _context4, _context5, _context6, _context7, _context8, _context9;
  13887. if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
  13888. throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + (this._targetClassName || 'null') + ' was passed in.');
  13889. }
  13890. var newAdd = (0, _concat.default)(_context4 = previous.relationsToAdd).call(_context4, []);
  13891. (0, _forEach.default)(_context5 = this.relationsToRemove).call(_context5, function (r) {
  13892. var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
  13893. if (index > -1) {
  13894. (0, _splice.default)(newAdd).call(newAdd, index, 1);
  13895. }
  13896. });
  13897. (0, _forEach.default)(_context6 = this.relationsToAdd).call(_context6, function (r) {
  13898. var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
  13899. if (index < 0) {
  13900. newAdd.push(r);
  13901. }
  13902. });
  13903. var newRemove = (0, _concat.default)(_context7 = previous.relationsToRemove).call(_context7, []);
  13904. (0, _forEach.default)(_context8 = this.relationsToAdd).call(_context8, function (r) {
  13905. var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
  13906. if (index > -1) {
  13907. (0, _splice.default)(newRemove).call(newRemove, index, 1);
  13908. }
  13909. });
  13910. (0, _forEach.default)(_context9 = this.relationsToRemove).call(_context9, function (r) {
  13911. var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
  13912. if (index < 0) {
  13913. newRemove.push(r);
  13914. }
  13915. });
  13916. var newRelation = new RelationOp(newAdd, newRemove);
  13917. newRelation._targetClassName = this._targetClassName;
  13918. return newRelation;
  13919. }
  13920. throw new Error('Cannot merge Relation Op with the previous Op');
  13921. }
  13922. }, {
  13923. key: "toJSON",
  13924. value: function ()
  13925. /*: { __op?: string, objects?: mixed, ops?: mixed }*/
  13926. {
  13927. var _this7 = this;
  13928. var idToPointer = function (id) {
  13929. return {
  13930. __type: 'Pointer',
  13931. className: _this7._targetClassName,
  13932. objectId: id
  13933. };
  13934. };
  13935. var adds = null;
  13936. var removes = null;
  13937. var pointers = null;
  13938. if (this.relationsToAdd.length > 0) {
  13939. var _context10;
  13940. pointers = (0, _map.default)(_context10 = this.relationsToAdd).call(_context10, idToPointer);
  13941. adds = {
  13942. __op: 'AddRelation',
  13943. objects: pointers
  13944. };
  13945. }
  13946. if (this.relationsToRemove.length > 0) {
  13947. var _context11;
  13948. pointers = (0, _map.default)(_context11 = this.relationsToRemove).call(_context11, idToPointer);
  13949. removes = {
  13950. __op: 'RemoveRelation',
  13951. objects: pointers
  13952. };
  13953. }
  13954. if (adds && removes) {
  13955. return {
  13956. __op: 'Batch',
  13957. ops: [adds, removes]
  13958. };
  13959. }
  13960. return adds || removes || {};
  13961. }
  13962. }]);
  13963. return RelationOp;
  13964. }(Op);
  13965. exports.RelationOp = RelationOp;
  13966. },{"./ParseObject":26,"./ParseRelation":30,"./arrayContainsObject":44,"./decode":46,"./encode":47,"./unique":53,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/splice":74,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/assertThisInitialized":120,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136}],28:[function(_dereq_,module,exports){
  13967. "use strict";
  13968. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  13969. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  13970. _Object$defineProperty(exports, "__esModule", {
  13971. value: true
  13972. });
  13973. exports.default = void 0;
  13974. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  13975. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  13976. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  13977. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  13978. var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
  13979. /**
  13980. * Copyright (c) 2015-present, Parse, LLC.
  13981. * All rights reserved.
  13982. *
  13983. * This source code is licensed under the BSD-style license found in the
  13984. * LICENSE file in the root directory of this source tree. An additional grant
  13985. * of patent rights can be found in the PATENTS file in the same directory.
  13986. *
  13987. * @flow
  13988. */
  13989. /**
  13990. * Creates a new Polygon with any of the following forms:<br>
  13991. * <pre>
  13992. * new Polygon([[0,0],[0,1],[1,1],[1,0]])
  13993. * new Polygon([GeoPoint, GeoPoint, GeoPoint])
  13994. * </pre>
  13995. *
  13996. * <p>Represents a coordinates that may be associated
  13997. * with a key in a ParseObject or used as a reference point for geo queries.
  13998. * This allows proximity-based queries on the key.</p>
  13999. *
  14000. * <p>Example:<pre>
  14001. * var polygon = new Parse.Polygon([[0,0],[0,1],[1,1],[1,0]]);
  14002. * var object = new Parse.Object("PlaceObject");
  14003. * object.set("area", polygon);
  14004. * object.save();</pre></p>
  14005. *
  14006. * @alias Parse.Polygon
  14007. */
  14008. var ParsePolygon = /*#__PURE__*/function () {
  14009. /**
  14010. * @param {(number[][] | Parse.GeoPoint[])} coordinates An Array of coordinate pairs
  14011. */
  14012. function ParsePolygon(coordinates
  14013. /*: Array<Array<number>> | Array<ParseGeoPoint>*/
  14014. ) {
  14015. (0, _classCallCheck2.default)(this, ParsePolygon);
  14016. (0, _defineProperty2.default)(this, "_coordinates", void 0);
  14017. this._coordinates = ParsePolygon._validate(coordinates);
  14018. }
  14019. /**
  14020. * Coordinates value for this Polygon.
  14021. * Throws an exception if not valid type.
  14022. *
  14023. * @property {(number[][] | Parse.GeoPoint[])} coordinates list of coordinates
  14024. * @returns {number[][]}
  14025. */
  14026. (0, _createClass2.default)(ParsePolygon, [{
  14027. key: "coordinates",
  14028. get: function ()
  14029. /*: Array<Array<number>>*/
  14030. {
  14031. return this._coordinates;
  14032. },
  14033. set: function (coords
  14034. /*: Array<Array<number>> | Array<ParseGeoPoint>*/
  14035. ) {
  14036. this._coordinates = ParsePolygon._validate(coords);
  14037. }
  14038. /**
  14039. * Returns a JSON representation of the Polygon, suitable for Parse.
  14040. *
  14041. * @returns {object}
  14042. */
  14043. }, {
  14044. key: "toJSON",
  14045. value: function ()
  14046. /*: { __type: string, coordinates: Array<Array<number>> }*/
  14047. {
  14048. ParsePolygon._validate(this._coordinates);
  14049. return {
  14050. __type: 'Polygon',
  14051. coordinates: this._coordinates
  14052. };
  14053. }
  14054. /**
  14055. * Checks if two polygons are equal
  14056. *
  14057. * @param {(Parse.Polygon | object)} other
  14058. * @returns {boolean}
  14059. */
  14060. }, {
  14061. key: "equals",
  14062. value: function (other
  14063. /*: mixed*/
  14064. )
  14065. /*: boolean*/
  14066. {
  14067. if (!(other instanceof ParsePolygon) || this.coordinates.length !== other.coordinates.length) {
  14068. return false;
  14069. }
  14070. var isEqual = true;
  14071. for (var i = 1; i < this._coordinates.length; i += 1) {
  14072. if (this._coordinates[i][0] != other.coordinates[i][0] || this._coordinates[i][1] != other.coordinates[i][1]) {
  14073. isEqual = false;
  14074. break;
  14075. }
  14076. }
  14077. return isEqual;
  14078. }
  14079. /**
  14080. *
  14081. * @param {Parse.GeoPoint} point
  14082. * @returns {boolean} Returns if the point is contained in the polygon
  14083. */
  14084. }, {
  14085. key: "containsPoint",
  14086. value: function (point
  14087. /*: ParseGeoPoint*/
  14088. )
  14089. /*: boolean*/
  14090. {
  14091. var minX = this._coordinates[0][0];
  14092. var maxX = this._coordinates[0][0];
  14093. var minY = this._coordinates[0][1];
  14094. var maxY = this._coordinates[0][1];
  14095. for (var i = 1; i < this._coordinates.length; i += 1) {
  14096. var p = this._coordinates[i];
  14097. minX = Math.min(p[0], minX);
  14098. maxX = Math.max(p[0], maxX);
  14099. minY = Math.min(p[1], minY);
  14100. maxY = Math.max(p[1], maxY);
  14101. }
  14102. var outside = point.latitude < minX || point.latitude > maxX || point.longitude < minY || point.longitude > maxY;
  14103. if (outside) {
  14104. return false;
  14105. }
  14106. var inside = false;
  14107. for (var _i = 0, j = this._coordinates.length - 1; _i < this._coordinates.length; j = _i++) {
  14108. var startX = this._coordinates[_i][0];
  14109. var startY = this._coordinates[_i][1];
  14110. var endX = this._coordinates[j][0];
  14111. var endY = this._coordinates[j][1];
  14112. var intersect = startY > point.longitude != endY > point.longitude && point.latitude < (endX - startX) * (point.longitude - startY) / (endY - startY) + startX;
  14113. if (intersect) {
  14114. inside = !inside;
  14115. }
  14116. }
  14117. return inside;
  14118. }
  14119. /**
  14120. * Validates that the list of coordinates can form a valid polygon
  14121. *
  14122. * @param {Array} coords the list of coordinates to validate as a polygon
  14123. * @throws {TypeError}
  14124. * @returns {number[][]} Array of coordinates if validated.
  14125. */
  14126. }], [{
  14127. key: "_validate",
  14128. value: function (coords
  14129. /*: Array<Array<number>> | Array<ParseGeoPoint>*/
  14130. )
  14131. /*: Array<Array<number>>*/
  14132. {
  14133. if (!(0, _isArray.default)(coords)) {
  14134. throw new TypeError('Coordinates must be an Array');
  14135. }
  14136. if (coords.length < 3) {
  14137. throw new TypeError('Polygon must have at least 3 GeoPoints or Points');
  14138. }
  14139. var points = [];
  14140. for (var i = 0; i < coords.length; i += 1) {
  14141. var coord = coords[i];
  14142. var geoPoint = void 0;
  14143. if (coord instanceof _ParseGeoPoint.default) {
  14144. geoPoint = coord;
  14145. } else if ((0, _isArray.default)(coord) && coord.length === 2) {
  14146. geoPoint = new _ParseGeoPoint.default(coord[0], coord[1]);
  14147. } else {
  14148. throw new TypeError('Coordinates must be an Array of GeoPoints or Points');
  14149. }
  14150. points.push([geoPoint.latitude, geoPoint.longitude]);
  14151. }
  14152. return points;
  14153. }
  14154. }]);
  14155. return ParsePolygon;
  14156. }();
  14157. var _default = ParsePolygon;
  14158. exports.default = _default;
  14159. },{"./ParseGeoPoint":23,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],29:[function(_dereq_,module,exports){
  14160. "use strict";
  14161. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  14162. var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  14163. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  14164. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  14165. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  14166. var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  14167. var _forEachInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  14168. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  14169. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  14170. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  14171. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  14172. _Object$defineProperty(exports, "__esModule", {
  14173. value: true
  14174. });
  14175. exports.default = void 0;
  14176. var _entries = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/entries"));
  14177. var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
  14178. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  14179. var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
  14180. var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
  14181. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  14182. var _splice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/splice"));
  14183. var _sort = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/sort"));
  14184. var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  14185. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  14186. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
  14187. var _filter2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter"));
  14188. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  14189. var _map2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  14190. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  14191. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  14192. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  14193. var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
  14194. var _keys2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  14195. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  14196. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  14197. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  14198. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  14199. var _encode = _interopRequireDefault(_dereq_("./encode"));
  14200. var _promiseUtils = _dereq_("./promiseUtils");
  14201. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  14202. var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
  14203. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  14204. var _OfflineQuery = _interopRequireDefault(_dereq_("./OfflineQuery"));
  14205. var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
  14206. function _regeneratorRuntime() {
  14207. "use strict";
  14208. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  14209. _regeneratorRuntime = function () {
  14210. return exports;
  14211. };
  14212. var exports = {},
  14213. Op = Object.prototype,
  14214. hasOwn = Op.hasOwnProperty,
  14215. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  14216. iteratorSymbol = $Symbol.iterator || "@@iterator",
  14217. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  14218. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  14219. function define(obj, key, value) {
  14220. return _Object$defineProperty(obj, key, {
  14221. value: value,
  14222. enumerable: !0,
  14223. configurable: !0,
  14224. writable: !0
  14225. }), obj[key];
  14226. }
  14227. try {
  14228. define({}, "");
  14229. } catch (err) {
  14230. define = function (obj, key, value) {
  14231. return obj[key] = value;
  14232. };
  14233. }
  14234. function wrap(innerFn, outerFn, self, tryLocsList) {
  14235. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  14236. generator = _Object$create(protoGenerator.prototype),
  14237. context = new Context(tryLocsList || []);
  14238. return generator._invoke = function (innerFn, self, context) {
  14239. var state = "suspendedStart";
  14240. return function (method, arg) {
  14241. if ("executing" === state) throw new Error("Generator is already running");
  14242. if ("completed" === state) {
  14243. if ("throw" === method) throw arg;
  14244. return doneResult();
  14245. }
  14246. for (context.method = method, context.arg = arg;;) {
  14247. var delegate = context.delegate;
  14248. if (delegate) {
  14249. var delegateResult = maybeInvokeDelegate(delegate, context);
  14250. if (delegateResult) {
  14251. if (delegateResult === ContinueSentinel) continue;
  14252. return delegateResult;
  14253. }
  14254. }
  14255. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  14256. if ("suspendedStart" === state) throw state = "completed", context.arg;
  14257. context.dispatchException(context.arg);
  14258. } else "return" === context.method && context.abrupt("return", context.arg);
  14259. state = "executing";
  14260. var record = tryCatch(innerFn, self, context);
  14261. if ("normal" === record.type) {
  14262. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  14263. return {
  14264. value: record.arg,
  14265. done: context.done
  14266. };
  14267. }
  14268. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  14269. }
  14270. };
  14271. }(innerFn, self, context), generator;
  14272. }
  14273. function tryCatch(fn, obj, arg) {
  14274. try {
  14275. return {
  14276. type: "normal",
  14277. arg: fn.call(obj, arg)
  14278. };
  14279. } catch (err) {
  14280. return {
  14281. type: "throw",
  14282. arg: err
  14283. };
  14284. }
  14285. }
  14286. exports.wrap = wrap;
  14287. var ContinueSentinel = {};
  14288. function Generator() {}
  14289. function GeneratorFunction() {}
  14290. function GeneratorFunctionPrototype() {}
  14291. var IteratorPrototype = {};
  14292. define(IteratorPrototype, iteratorSymbol, function () {
  14293. return this;
  14294. });
  14295. var getProto = _Object$getPrototypeOf,
  14296. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  14297. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  14298. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  14299. function defineIteratorMethods(prototype) {
  14300. var _context23;
  14301. _forEachInstanceProperty2(_context23 = ["next", "throw", "return"]).call(_context23, function (method) {
  14302. define(prototype, method, function (arg) {
  14303. return this._invoke(method, arg);
  14304. });
  14305. });
  14306. }
  14307. function AsyncIterator(generator, PromiseImpl) {
  14308. function invoke(method, arg, resolve, reject) {
  14309. var record = tryCatch(generator[method], generator, arg);
  14310. if ("throw" !== record.type) {
  14311. var result = record.arg,
  14312. value = result.value;
  14313. return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  14314. invoke("next", value, resolve, reject);
  14315. }, function (err) {
  14316. invoke("throw", err, resolve, reject);
  14317. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  14318. result.value = unwrapped, resolve(result);
  14319. }, function (error) {
  14320. return invoke("throw", error, resolve, reject);
  14321. });
  14322. }
  14323. reject(record.arg);
  14324. }
  14325. var previousPromise;
  14326. this._invoke = function (method, arg) {
  14327. function callInvokeWithMethodAndArg() {
  14328. return new PromiseImpl(function (resolve, reject) {
  14329. invoke(method, arg, resolve, reject);
  14330. });
  14331. }
  14332. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  14333. };
  14334. }
  14335. function maybeInvokeDelegate(delegate, context) {
  14336. var method = delegate.iterator[context.method];
  14337. if (undefined === method) {
  14338. if (context.delegate = null, "throw" === context.method) {
  14339. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  14340. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  14341. }
  14342. return ContinueSentinel;
  14343. }
  14344. var record = tryCatch(method, delegate.iterator, context.arg);
  14345. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  14346. var info = record.arg;
  14347. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  14348. }
  14349. function pushTryEntry(locs) {
  14350. var entry = {
  14351. tryLoc: locs[0]
  14352. };
  14353. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  14354. }
  14355. function resetTryEntry(entry) {
  14356. var record = entry.completion || {};
  14357. record.type = "normal", delete record.arg, entry.completion = record;
  14358. }
  14359. function Context(tryLocsList) {
  14360. this.tryEntries = [{
  14361. tryLoc: "root"
  14362. }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  14363. }
  14364. function values(iterable) {
  14365. if (iterable) {
  14366. var iteratorMethod = iterable[iteratorSymbol];
  14367. if (iteratorMethod) return iteratorMethod.call(iterable);
  14368. if ("function" == typeof iterable.next) return iterable;
  14369. if (!isNaN(iterable.length)) {
  14370. var i = -1,
  14371. next = function next() {
  14372. for (; ++i < iterable.length;) {
  14373. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  14374. }
  14375. return next.value = undefined, next.done = !0, next;
  14376. };
  14377. return next.next = next;
  14378. }
  14379. }
  14380. return {
  14381. next: doneResult
  14382. };
  14383. }
  14384. function doneResult() {
  14385. return {
  14386. value: undefined,
  14387. done: !0
  14388. };
  14389. }
  14390. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  14391. var ctor = "function" == typeof genFun && genFun.constructor;
  14392. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  14393. }, exports.mark = function (genFun) {
  14394. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  14395. }, exports.awrap = function (arg) {
  14396. return {
  14397. __await: arg
  14398. };
  14399. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  14400. return this;
  14401. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  14402. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  14403. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  14404. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  14405. return result.done ? result.value : iter.next();
  14406. });
  14407. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  14408. return this;
  14409. }), define(Gp, "toString", function () {
  14410. return "[object Generator]";
  14411. }), exports.keys = function (object) {
  14412. var keys = [];
  14413. for (var key in object) {
  14414. keys.push(key);
  14415. }
  14416. return _reverseInstanceProperty(keys).call(keys), function next() {
  14417. for (; keys.length;) {
  14418. var key = keys.pop();
  14419. if (key in object) return next.value = key, next.done = !1, next;
  14420. }
  14421. return next.done = !0, next;
  14422. };
  14423. }, exports.values = values, Context.prototype = {
  14424. constructor: Context,
  14425. reset: function (skipTempReset) {
  14426. var _context24;
  14427. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context24 = this.tryEntries).call(_context24, resetTryEntry), !skipTempReset) for (var name in this) {
  14428. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty2(name).call(name, 1)) && (this[name] = undefined);
  14429. }
  14430. },
  14431. stop: function () {
  14432. this.done = !0;
  14433. var rootRecord = this.tryEntries[0].completion;
  14434. if ("throw" === rootRecord.type) throw rootRecord.arg;
  14435. return this.rval;
  14436. },
  14437. dispatchException: function (exception) {
  14438. if (this.done) throw exception;
  14439. var context = this;
  14440. function handle(loc, caught) {
  14441. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  14442. }
  14443. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  14444. var entry = this.tryEntries[i],
  14445. record = entry.completion;
  14446. if ("root" === entry.tryLoc) return handle("end");
  14447. if (entry.tryLoc <= this.prev) {
  14448. var hasCatch = hasOwn.call(entry, "catchLoc"),
  14449. hasFinally = hasOwn.call(entry, "finallyLoc");
  14450. if (hasCatch && hasFinally) {
  14451. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  14452. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  14453. } else if (hasCatch) {
  14454. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  14455. } else {
  14456. if (!hasFinally) throw new Error("try statement without catch or finally");
  14457. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  14458. }
  14459. }
  14460. }
  14461. },
  14462. abrupt: function (type, arg) {
  14463. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  14464. var entry = this.tryEntries[i];
  14465. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  14466. var finallyEntry = entry;
  14467. break;
  14468. }
  14469. }
  14470. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  14471. var record = finallyEntry ? finallyEntry.completion : {};
  14472. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  14473. },
  14474. complete: function (record, afterLoc) {
  14475. if ("throw" === record.type) throw record.arg;
  14476. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  14477. },
  14478. finish: function (finallyLoc) {
  14479. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  14480. var entry = this.tryEntries[i];
  14481. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  14482. }
  14483. },
  14484. catch: function (tryLoc) {
  14485. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  14486. var entry = this.tryEntries[i];
  14487. if (entry.tryLoc === tryLoc) {
  14488. var record = entry.completion;
  14489. if ("throw" === record.type) {
  14490. var thrown = record.arg;
  14491. resetTryEntry(entry);
  14492. }
  14493. return thrown;
  14494. }
  14495. }
  14496. throw new Error("illegal catch attempt");
  14497. },
  14498. delegateYield: function (iterable, resultName, nextLoc) {
  14499. return this.delegate = {
  14500. iterator: values(iterable),
  14501. resultName: resultName,
  14502. nextLoc: nextLoc
  14503. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  14504. }
  14505. }, exports;
  14506. }
  14507. /**
  14508. * Converts a string into a regex that matches it.
  14509. * Surrounding with \Q .. \E does this, we just need to escape any \E's in
  14510. * the text separately.
  14511. *
  14512. * @param s
  14513. * @private
  14514. * @returns {string}
  14515. */
  14516. function quote(s
  14517. /*: string*/
  14518. )
  14519. /*: string*/
  14520. {
  14521. return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
  14522. }
  14523. /**
  14524. * Extracts the class name from queries. If not all queries have the same
  14525. * class name an error will be thrown.
  14526. *
  14527. * @param queries
  14528. * @private
  14529. * @returns {string}
  14530. */
  14531. function _getClassNameFromQueries(queries
  14532. /*: Array<ParseQuery>*/
  14533. )
  14534. /*: ?string*/
  14535. {
  14536. var className = null;
  14537. (0, _forEach.default)(queries).call(queries, function (q) {
  14538. if (!className) {
  14539. className = q.className;
  14540. }
  14541. if (className !== q.className) {
  14542. throw new Error('All queries must be for the same class.');
  14543. }
  14544. });
  14545. return className;
  14546. }
  14547. /*
  14548. * Handles pre-populating the result data of a query with select fields,
  14549. * making sure that the data object contains keys for all objects that have
  14550. * been requested with a select, so that our cached state updates correctly.
  14551. */
  14552. function handleSelectResult(data
  14553. /*: any*/
  14554. , select
  14555. /*: Array<string>*/
  14556. ) {
  14557. var serverDataMask = {};
  14558. (0, _forEach.default)(select).call(select, function (field) {
  14559. var hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;
  14560. if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {
  14561. // this field was selected, but is missing from the retrieved data
  14562. data[field] = undefined;
  14563. } else if (hasSubObjectSelect) {
  14564. // this field references a sub-object,
  14565. // so we need to walk down the path components
  14566. var pathComponents = field.split('.');
  14567. var _obj = data;
  14568. var serverMask = serverDataMask;
  14569. (0, _forEach.default)(pathComponents).call(pathComponents, function (component, index, arr) {
  14570. // add keys if the expected data is missing
  14571. if (_obj && !_obj.hasOwnProperty(component)) {
  14572. _obj[component] = undefined;
  14573. }
  14574. if (_obj && (0, _typeof2.default)(_obj) === 'object') {
  14575. _obj = _obj[component];
  14576. } //add this path component to the server mask so we can fill it in later if needed
  14577. if (index < arr.length - 1) {
  14578. if (!serverMask[component]) {
  14579. serverMask[component] = {};
  14580. }
  14581. serverMask = serverMask[component];
  14582. }
  14583. });
  14584. }
  14585. });
  14586. if ((0, _keys2.default)(serverDataMask).length > 0) {
  14587. // When selecting from sub-objects, we don't want to blow away the missing
  14588. // information that we may have retrieved before. We've already added any
  14589. // missing selected keys to sub-objects, but we still need to add in the
  14590. // data for any previously retrieved sub-objects that were not selected.
  14591. var serverData = _CoreManager.default.getObjectStateController().getServerData({
  14592. id: data.objectId,
  14593. className: data.className
  14594. });
  14595. copyMissingDataWithMask(serverData, data, serverDataMask, false);
  14596. }
  14597. }
  14598. function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
  14599. //copy missing elements at this level
  14600. if (copyThisLevel) {
  14601. for (var _key in src) {
  14602. if (src.hasOwnProperty(_key) && !dest.hasOwnProperty(_key)) {
  14603. dest[_key] = src[_key];
  14604. }
  14605. }
  14606. }
  14607. for (var _key2 in mask) {
  14608. if (dest[_key2] !== undefined && dest[_key2] !== null && src !== undefined && src !== null) {
  14609. //traverse into objects as needed
  14610. copyMissingDataWithMask(src[_key2], dest[_key2], mask[_key2], true);
  14611. }
  14612. }
  14613. }
  14614. function handleOfflineSort(a, b, sorts) {
  14615. var order = sorts[0];
  14616. var operator = (0, _slice.default)(order).call(order, 0, 1);
  14617. var isDescending = operator === '-';
  14618. if (isDescending) {
  14619. order = order.substring(1);
  14620. }
  14621. if (order === '_created_at') {
  14622. order = 'createdAt';
  14623. }
  14624. if (order === '_updated_at') {
  14625. order = 'updatedAt';
  14626. }
  14627. if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {
  14628. throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, "Invalid Key: ".concat(order));
  14629. }
  14630. var field1 = a.get(order);
  14631. var field2 = b.get(order);
  14632. if (field1 < field2) {
  14633. return isDescending ? 1 : -1;
  14634. }
  14635. if (field1 > field2) {
  14636. return isDescending ? -1 : 1;
  14637. }
  14638. if (sorts.length > 1) {
  14639. var remainingSorts = (0, _slice.default)(sorts).call(sorts, 1);
  14640. return handleOfflineSort(a, b, remainingSorts);
  14641. }
  14642. return 0;
  14643. }
  14644. /**
  14645. * Creates a new parse Parse.Query for the given Parse.Object subclass.
  14646. *
  14647. * <p>Parse.Query defines a query that is used to fetch Parse.Objects. The
  14648. * most common use case is finding all objects that match a query through the
  14649. * <code>find</code> method. for example, this sample code fetches all objects
  14650. * of class <code>myclass</code>. it calls a different function depending on
  14651. * whether the fetch succeeded or not.
  14652. *
  14653. * <pre>
  14654. * var query = new Parse.Query(myclass);
  14655. * query.find().then((results) => {
  14656. * // results is an array of parse.object.
  14657. * }).catch((error) => {
  14658. * // error is an instance of parse.error.
  14659. * });</pre></p>
  14660. *
  14661. * <p>a Parse.Query can also be used to retrieve a single object whose id is
  14662. * known, through the get method. for example, this sample code fetches an
  14663. * object of class <code>myclass</code> and id <code>myid</code>. it calls a
  14664. * different function depending on whether the fetch succeeded or not.
  14665. *
  14666. * <pre>
  14667. * var query = new Parse.Query(myclass);
  14668. * query.get(myid).then((object) => {
  14669. * // object is an instance of parse.object.
  14670. * }).catch((error) => {
  14671. * // error is an instance of parse.error.
  14672. * });</pre></p>
  14673. *
  14674. * <p>a Parse.Query can also be used to count the number of objects that match
  14675. * the query without retrieving all of those objects. for example, this
  14676. * sample code counts the number of objects of the class <code>myclass</code>
  14677. * <pre>
  14678. * var query = new Parse.Query(myclass);
  14679. * query.count().then((number) => {
  14680. * // there are number instances of myclass.
  14681. * }).catch((error) => {
  14682. * // error is an instance of Parse.Error.
  14683. * });</pre></p>
  14684. *
  14685. * @alias Parse.Query
  14686. */
  14687. var ParseQuery = /*#__PURE__*/function () {
  14688. /**
  14689. * @property {string} className
  14690. */
  14691. /**
  14692. * @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
  14693. */
  14694. function ParseQuery(objectClass
  14695. /*: string | ParseObject*/
  14696. ) {
  14697. (0, _classCallCheck2.default)(this, ParseQuery);
  14698. (0, _defineProperty2.default)(this, "className", void 0);
  14699. (0, _defineProperty2.default)(this, "_where", void 0);
  14700. (0, _defineProperty2.default)(this, "_include", void 0);
  14701. (0, _defineProperty2.default)(this, "_exclude", void 0);
  14702. (0, _defineProperty2.default)(this, "_select", void 0);
  14703. (0, _defineProperty2.default)(this, "_limit", void 0);
  14704. (0, _defineProperty2.default)(this, "_skip", void 0);
  14705. (0, _defineProperty2.default)(this, "_count", void 0);
  14706. (0, _defineProperty2.default)(this, "_order", void 0);
  14707. (0, _defineProperty2.default)(this, "_readPreference", void 0);
  14708. (0, _defineProperty2.default)(this, "_includeReadPreference", void 0);
  14709. (0, _defineProperty2.default)(this, "_subqueryReadPreference", void 0);
  14710. (0, _defineProperty2.default)(this, "_queriesLocalDatastore", void 0);
  14711. (0, _defineProperty2.default)(this, "_localDatastorePinName", void 0);
  14712. (0, _defineProperty2.default)(this, "_extraOptions", void 0);
  14713. (0, _defineProperty2.default)(this, "_hint", void 0);
  14714. (0, _defineProperty2.default)(this, "_explain", void 0);
  14715. (0, _defineProperty2.default)(this, "_xhrRequest", void 0);
  14716. if (typeof objectClass === 'string') {
  14717. if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
  14718. this.className = '_User';
  14719. } else {
  14720. this.className = objectClass;
  14721. }
  14722. } else if (objectClass instanceof _ParseObject.default) {
  14723. this.className = objectClass.className;
  14724. } else if (typeof objectClass === 'function') {
  14725. if (typeof objectClass.className === 'string') {
  14726. this.className = objectClass.className;
  14727. } else {
  14728. var _obj2 = new objectClass();
  14729. this.className = _obj2.className;
  14730. }
  14731. } else {
  14732. throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
  14733. }
  14734. this._where = {};
  14735. this._include = [];
  14736. this._exclude = [];
  14737. this._count = false;
  14738. this._limit = -1; // negative limit is not sent in the server request
  14739. this._skip = 0;
  14740. this._readPreference = null;
  14741. this._includeReadPreference = null;
  14742. this._subqueryReadPreference = null;
  14743. this._queriesLocalDatastore = false;
  14744. this._localDatastorePinName = null;
  14745. this._extraOptions = {};
  14746. this._xhrRequest = {
  14747. task: null,
  14748. onchange: function () {}
  14749. };
  14750. }
  14751. /**
  14752. * Adds constraint that at least one of the passed in queries matches.
  14753. *
  14754. * @param {Array} queries
  14755. * @returns {Parse.Query} Returns the query, so you can chain this call.
  14756. */
  14757. (0, _createClass2.default)(ParseQuery, [{
  14758. key: "_orQuery",
  14759. value: function (queries
  14760. /*: Array<ParseQuery>*/
  14761. )
  14762. /*: ParseQuery*/
  14763. {
  14764. var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
  14765. return q.toJSON().where;
  14766. });
  14767. this._where.$or = queryJSON;
  14768. return this;
  14769. }
  14770. /**
  14771. * Adds constraint that all of the passed in queries match.
  14772. *
  14773. * @param {Array} queries
  14774. * @returns {Parse.Query} Returns the query, so you can chain this call.
  14775. */
  14776. }, {
  14777. key: "_andQuery",
  14778. value: function (queries
  14779. /*: Array<ParseQuery>*/
  14780. )
  14781. /*: ParseQuery*/
  14782. {
  14783. var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
  14784. return q.toJSON().where;
  14785. });
  14786. this._where.$and = queryJSON;
  14787. return this;
  14788. }
  14789. /**
  14790. * Adds constraint that none of the passed in queries match.
  14791. *
  14792. * @param {Array} queries
  14793. * @returns {Parse.Query} Returns the query, so you can chain this call.
  14794. */
  14795. }, {
  14796. key: "_norQuery",
  14797. value: function (queries
  14798. /*: Array<ParseQuery>*/
  14799. )
  14800. /*: ParseQuery*/
  14801. {
  14802. var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
  14803. return q.toJSON().where;
  14804. });
  14805. this._where.$nor = queryJSON;
  14806. return this;
  14807. }
  14808. /**
  14809. * Helper for condition queries
  14810. *
  14811. * @param key
  14812. * @param condition
  14813. * @param value
  14814. * @returns {Parse.Query}
  14815. */
  14816. }, {
  14817. key: "_addCondition",
  14818. value: function (key
  14819. /*: string*/
  14820. , condition
  14821. /*: string*/
  14822. , value
  14823. /*: mixed*/
  14824. )
  14825. /*: ParseQuery*/
  14826. {
  14827. if (!this._where[key] || typeof this._where[key] === 'string') {
  14828. this._where[key] = {};
  14829. }
  14830. this._where[key][condition] = (0, _encode.default)(value, false, true);
  14831. return this;
  14832. }
  14833. /**
  14834. * Converts string for regular expression at the beginning
  14835. *
  14836. * @param string
  14837. * @returns {string}
  14838. */
  14839. }, {
  14840. key: "_regexStartWith",
  14841. value: function (string
  14842. /*: string*/
  14843. )
  14844. /*: string*/
  14845. {
  14846. return '^' + quote(string);
  14847. }
  14848. }, {
  14849. key: "_handleOfflineQuery",
  14850. value: function () {
  14851. var _handleOfflineQuery2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params
  14852. /*: any*/
  14853. ) {
  14854. var _context,
  14855. _this2 = this;
  14856. var localDatastore, objects, results, keys, alwaysSelectedKeys, sorts, count, limit;
  14857. return _regeneratorRuntime().wrap(function (_context3) {
  14858. while (1) {
  14859. switch (_context3.prev = _context3.next) {
  14860. case 0:
  14861. _OfflineQuery.default.validateQuery(this);
  14862. localDatastore = _CoreManager.default.getLocalDatastore();
  14863. _context3.next = 4;
  14864. return localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);
  14865. case 4:
  14866. objects = _context3.sent;
  14867. results = (0, _filter2.default)(_context = (0, _map2.default)(objects).call(objects, function (json, index, arr) {
  14868. var object = _ParseObject.default.fromJSON(json, false);
  14869. if (json._localId && !json.objectId) {
  14870. object._localId = json._localId;
  14871. }
  14872. if (!_OfflineQuery.default.matchesQuery(_this2.className, object, arr, _this2)) {
  14873. return null;
  14874. }
  14875. return object;
  14876. })).call(_context, function (object) {
  14877. return object !== null;
  14878. });
  14879. if ((0, _keys.default)(params)) {
  14880. keys = (0, _keys.default)(params).split(',');
  14881. alwaysSelectedKeys = ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL'];
  14882. keys = (0, _concat.default)(keys).call(keys, alwaysSelectedKeys);
  14883. results = (0, _map2.default)(results).call(results, function (object) {
  14884. var _context2;
  14885. var json = object._toFullJSON();
  14886. (0, _forEach.default)(_context2 = (0, _keys2.default)(json)).call(_context2, function (key) {
  14887. if (!(0, _includes.default)(keys).call(keys, key)) {
  14888. delete json[key];
  14889. }
  14890. });
  14891. return _ParseObject.default.fromJSON(json, false);
  14892. });
  14893. }
  14894. if (params.order) {
  14895. sorts = params.order.split(',');
  14896. (0, _sort.default)(results).call(results, function (a, b) {
  14897. return handleOfflineSort(a, b, sorts);
  14898. });
  14899. } // count total before applying limit/skip
  14900. if (params.count) {
  14901. count = results.length; // total count from response
  14902. }
  14903. if (params.skip) {
  14904. if (params.skip >= results.length) {
  14905. results = [];
  14906. } else {
  14907. results = (0, _splice.default)(results).call(results, params.skip, results.length);
  14908. }
  14909. }
  14910. limit = results.length;
  14911. if (params.limit !== 0 && params.limit < results.length) {
  14912. limit = params.limit;
  14913. }
  14914. results = (0, _splice.default)(results).call(results, 0, limit);
  14915. if (!(typeof count === 'number')) {
  14916. _context3.next = 15;
  14917. break;
  14918. }
  14919. return _context3.abrupt("return", {
  14920. results: results,
  14921. count: count
  14922. });
  14923. case 15:
  14924. return _context3.abrupt("return", results);
  14925. case 16:
  14926. case "end":
  14927. return _context3.stop();
  14928. }
  14929. }
  14930. }, _callee, this);
  14931. }));
  14932. function _handleOfflineQuery() {
  14933. return _handleOfflineQuery2.apply(this, arguments);
  14934. }
  14935. return _handleOfflineQuery;
  14936. }()
  14937. /**
  14938. * Returns a JSON representation of this query.
  14939. *
  14940. * @returns {object} The JSON representation of the query.
  14941. */
  14942. }, {
  14943. key: "toJSON",
  14944. value: function ()
  14945. /*: QueryJSON*/
  14946. {
  14947. var params
  14948. /*: QueryJSON*/
  14949. = {
  14950. where: this._where
  14951. };
  14952. if (this._include.length) {
  14953. params.include = this._include.join(',');
  14954. }
  14955. if (this._exclude.length) {
  14956. params.excludeKeys = this._exclude.join(',');
  14957. }
  14958. if (this._select) {
  14959. params.keys = this._select.join(',');
  14960. }
  14961. if (this._count) {
  14962. params.count = 1;
  14963. }
  14964. if (this._limit >= 0) {
  14965. params.limit = this._limit;
  14966. }
  14967. if (this._skip > 0) {
  14968. params.skip = this._skip;
  14969. }
  14970. if (this._order) {
  14971. params.order = this._order.join(',');
  14972. }
  14973. if (this._readPreference) {
  14974. params.readPreference = this._readPreference;
  14975. }
  14976. if (this._includeReadPreference) {
  14977. params.includeReadPreference = this._includeReadPreference;
  14978. }
  14979. if (this._subqueryReadPreference) {
  14980. params.subqueryReadPreference = this._subqueryReadPreference;
  14981. }
  14982. if (this._hint) {
  14983. params.hint = this._hint;
  14984. }
  14985. if (this._explain) {
  14986. params.explain = true;
  14987. }
  14988. for (var _key3 in this._extraOptions) {
  14989. params[_key3] = this._extraOptions[_key3];
  14990. }
  14991. return params;
  14992. }
  14993. /**
  14994. * Return a query with conditions from json, can be useful to send query from server side to client
  14995. * Not static, all query conditions was set before calling this method will be deleted.
  14996. * For example on the server side we have
  14997. * var query = new Parse.Query("className");
  14998. * query.equalTo(key: value);
  14999. * query.limit(100);
  15000. * ... (others queries)
  15001. * Create JSON representation of Query Object
  15002. * var jsonFromServer = query.fromJSON();
  15003. *
  15004. * On client side getting query:
  15005. * var query = new Parse.Query("className");
  15006. * query.fromJSON(jsonFromServer);
  15007. *
  15008. * and continue to query...
  15009. * query.skip(100).find().then(...);
  15010. *
  15011. * @param {QueryJSON} json from Parse.Query.toJSON() method
  15012. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15013. */
  15014. }, {
  15015. key: "withJSON",
  15016. value: function (json
  15017. /*: QueryJSON*/
  15018. )
  15019. /*: ParseQuery*/
  15020. {
  15021. if (json.where) {
  15022. this._where = json.where;
  15023. }
  15024. if (json.include) {
  15025. this._include = json.include.split(',');
  15026. }
  15027. if ((0, _keys.default)(json)) {
  15028. this._select = (0, _keys.default)(json).split(',');
  15029. }
  15030. if (json.excludeKeys) {
  15031. this._exclude = json.excludeKeys.split(',');
  15032. }
  15033. if (json.count) {
  15034. this._count = json.count === 1;
  15035. }
  15036. if (json.limit) {
  15037. this._limit = json.limit;
  15038. }
  15039. if (json.skip) {
  15040. this._skip = json.skip;
  15041. }
  15042. if (json.order) {
  15043. this._order = json.order.split(',');
  15044. }
  15045. if (json.readPreference) {
  15046. this._readPreference = json.readPreference;
  15047. }
  15048. if (json.includeReadPreference) {
  15049. this._includeReadPreference = json.includeReadPreference;
  15050. }
  15051. if (json.subqueryReadPreference) {
  15052. this._subqueryReadPreference = json.subqueryReadPreference;
  15053. }
  15054. if (json.hint) {
  15055. this._hint = json.hint;
  15056. }
  15057. if (json.explain) {
  15058. this._explain = !!json.explain;
  15059. }
  15060. for (var _key4 in json) {
  15061. if (json.hasOwnProperty(_key4)) {
  15062. var _context4;
  15063. if ((0, _indexOf.default)(_context4 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain']).call(_context4, _key4) === -1) {
  15064. this._extraOptions[_key4] = json[_key4];
  15065. }
  15066. }
  15067. }
  15068. return this;
  15069. }
  15070. /**
  15071. * Static method to restore Parse.Query by json representation
  15072. * Internally calling Parse.Query.withJSON
  15073. *
  15074. * @param {string} className
  15075. * @param {QueryJSON} json from Parse.Query.toJSON() method
  15076. * @returns {Parse.Query} new created query
  15077. */
  15078. }, {
  15079. key: "get",
  15080. value:
  15081. /**
  15082. * Constructs a Parse.Object whose id is already known by fetching data from
  15083. * the server. Unlike the <code>first</code> method, it never returns undefined.
  15084. *
  15085. * @param {string} objectId The id of the object to be fetched.
  15086. * @param {object} options
  15087. * Valid options are:<ul>
  15088. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15089. * be used for this request.
  15090. * <li>sessionToken: A valid session token, used for making a request on
  15091. * behalf of a specific user.
  15092. * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
  15093. * <li>json: Return raw json without converting to Parse.Object
  15094. * </ul>
  15095. *
  15096. * @returns {Promise} A promise that is resolved with the result when
  15097. * the query completes.
  15098. */
  15099. function (objectId
  15100. /*: string*/
  15101. , options
  15102. /*:: ?: FullOptions*/
  15103. )
  15104. /*: Promise<ParseObject>*/
  15105. {
  15106. this.equalTo('objectId', objectId);
  15107. var firstOptions = {};
  15108. if (options && options.hasOwnProperty('useMasterKey')) {
  15109. firstOptions.useMasterKey = options.useMasterKey;
  15110. }
  15111. if (options && options.hasOwnProperty('sessionToken')) {
  15112. firstOptions.sessionToken = options.sessionToken;
  15113. }
  15114. if (options && options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  15115. firstOptions.context = options.context;
  15116. }
  15117. if (options && options.hasOwnProperty('json')) {
  15118. firstOptions.json = options.json;
  15119. }
  15120. return this.first(firstOptions).then(function (response) {
  15121. if (response) {
  15122. return response;
  15123. }
  15124. var errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');
  15125. return _promise.default.reject(errorObject);
  15126. });
  15127. }
  15128. /**
  15129. * Retrieves a list of ParseObjects that satisfy this query.
  15130. *
  15131. * @param {object} options Valid options
  15132. * are:<ul>
  15133. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15134. * be used for this request.
  15135. * <li>sessionToken: A valid session token, used for making a request on
  15136. * behalf of a specific user.
  15137. * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
  15138. * <li>json: Return raw json without converting to Parse.Object
  15139. * </ul>
  15140. *
  15141. * @returns {Promise} A promise that is resolved with the results when
  15142. * the query completes.
  15143. */
  15144. }, {
  15145. key: "find",
  15146. value: function (options
  15147. /*:: ?: FullOptions*/
  15148. )
  15149. /*: Promise<Array<ParseObject>>*/
  15150. {
  15151. var _this3 = this;
  15152. options = options || {};
  15153. var findOptions = {};
  15154. if (options.hasOwnProperty('useMasterKey')) {
  15155. findOptions.useMasterKey = options.useMasterKey;
  15156. }
  15157. if (options.hasOwnProperty('sessionToken')) {
  15158. findOptions.sessionToken = options.sessionToken;
  15159. }
  15160. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  15161. findOptions.context = options.context;
  15162. }
  15163. this._setRequestTask(findOptions);
  15164. var controller = _CoreManager.default.getQueryController();
  15165. var select = this._select;
  15166. if (this._queriesLocalDatastore) {
  15167. return this._handleOfflineQuery(this.toJSON());
  15168. }
  15169. return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(function (response) {
  15170. var _context5; // Return generic object when explain is used
  15171. if (_this3._explain) {
  15172. return response.results;
  15173. }
  15174. var results = (0, _map2.default)(_context5 = response.results).call(_context5, function (data) {
  15175. // In cases of relations, the server may send back a className
  15176. // on the top level of the payload
  15177. var override = response.className || _this3.className;
  15178. if (!data.className) {
  15179. data.className = override;
  15180. } // Make sure the data object contains keys for all objects that
  15181. // have been requested with a select, so that our cached state
  15182. // updates correctly.
  15183. if (select) {
  15184. handleSelectResult(data, select);
  15185. }
  15186. if (options.json) {
  15187. return data;
  15188. } else {
  15189. return _ParseObject.default.fromJSON(data, !select);
  15190. }
  15191. });
  15192. var count = response.count;
  15193. if (typeof count === 'number') {
  15194. return {
  15195. results: results,
  15196. count: count
  15197. };
  15198. } else {
  15199. return results;
  15200. }
  15201. });
  15202. }
  15203. /**
  15204. * Retrieves a complete list of ParseObjects that satisfy this query.
  15205. * Using `eachBatch` under the hood to fetch all the valid objects.
  15206. *
  15207. * @param {object} options Valid options are:<ul>
  15208. * <li>batchSize: How many objects to yield in each batch (default: 100)
  15209. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15210. * be used for this request.
  15211. * <li>sessionToken: A valid session token, used for making a request on
  15212. * behalf of a specific user.
  15213. * </ul>
  15214. * @returns {Promise} A promise that is resolved with the results when
  15215. * the query completes.
  15216. */
  15217. }, {
  15218. key: "findAll",
  15219. value: function () {
  15220. var _findAll = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options
  15221. /*:: ?: BatchOptions*/
  15222. ) {
  15223. var result;
  15224. return _regeneratorRuntime().wrap(function _callee2$(_context7) {
  15225. while (1) {
  15226. switch (_context7.prev = _context7.next) {
  15227. case 0:
  15228. result
  15229. /*: ParseObject[]*/
  15230. = [];
  15231. _context7.next = 3;
  15232. return this.eachBatch(function (objects
  15233. /*: ParseObject[]*/
  15234. ) {
  15235. var _context6;
  15236. result = (0, _concat.default)(_context6 = []).call(_context6, (0, _toConsumableArray2.default)(result), (0, _toConsumableArray2.default)(objects));
  15237. }, options);
  15238. case 3:
  15239. return _context7.abrupt("return", result);
  15240. case 4:
  15241. case "end":
  15242. return _context7.stop();
  15243. }
  15244. }
  15245. }, _callee2, this);
  15246. }));
  15247. function findAll(_x2) {
  15248. return _findAll.apply(this, arguments);
  15249. }
  15250. return findAll;
  15251. }()
  15252. /**
  15253. * Counts the number of objects that match this query.
  15254. *
  15255. * @param {object} options
  15256. * Valid options are:<ul>
  15257. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15258. * be used for this request.
  15259. * <li>sessionToken: A valid session token, used for making a request on
  15260. * behalf of a specific user.
  15261. * </ul>
  15262. *
  15263. * @returns {Promise} A promise that is resolved with the count when
  15264. * the query completes.
  15265. */
  15266. }, {
  15267. key: "count",
  15268. value: function count(options
  15269. /*:: ?: FullOptions*/
  15270. )
  15271. /*: Promise<number>*/
  15272. {
  15273. options = options || {};
  15274. var findOptions = {};
  15275. if (options.hasOwnProperty('useMasterKey')) {
  15276. findOptions.useMasterKey = options.useMasterKey;
  15277. }
  15278. if (options.hasOwnProperty('sessionToken')) {
  15279. findOptions.sessionToken = options.sessionToken;
  15280. }
  15281. this._setRequestTask(findOptions);
  15282. var controller = _CoreManager.default.getQueryController();
  15283. var params = this.toJSON();
  15284. params.limit = 0;
  15285. params.count = 1;
  15286. return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(function (result) {
  15287. return result.count;
  15288. });
  15289. }
  15290. /**
  15291. * Executes a distinct query and returns unique values
  15292. *
  15293. * @param {string} key A field to find distinct values
  15294. * @param {object} options
  15295. * Valid options are:<ul>
  15296. * <li>sessionToken: A valid session token, used for making a request on
  15297. * behalf of a specific user.
  15298. * </ul>
  15299. *
  15300. * @returns {Promise} A promise that is resolved with the query completes.
  15301. */
  15302. }, {
  15303. key: "distinct",
  15304. value: function distinct(key
  15305. /*: string*/
  15306. , options
  15307. /*:: ?: FullOptions*/
  15308. )
  15309. /*: Promise<Array<mixed>>*/
  15310. {
  15311. options = options || {};
  15312. var distinctOptions = {};
  15313. distinctOptions.useMasterKey = true;
  15314. if (options.hasOwnProperty('sessionToken')) {
  15315. distinctOptions.sessionToken = options.sessionToken;
  15316. }
  15317. this._setRequestTask(distinctOptions);
  15318. var controller = _CoreManager.default.getQueryController();
  15319. var params = {
  15320. distinct: key,
  15321. where: this._where,
  15322. hint: this._hint
  15323. };
  15324. return controller.aggregate(this.className, params, distinctOptions).then(function (results) {
  15325. return results.results;
  15326. });
  15327. }
  15328. /**
  15329. * Executes an aggregate query and returns aggregate results
  15330. *
  15331. * @param {(Array|object)} pipeline Array or Object of stages to process query
  15332. * @param {object} options Valid options are:<ul>
  15333. * <li>sessionToken: A valid session token, used for making a request on
  15334. * behalf of a specific user.
  15335. * </ul>
  15336. *
  15337. * @returns {Promise} A promise that is resolved with the query completes.
  15338. */
  15339. }, {
  15340. key: "aggregate",
  15341. value: function aggregate(pipeline
  15342. /*: mixed*/
  15343. , options
  15344. /*:: ?: FullOptions*/
  15345. )
  15346. /*: Promise<Array<mixed>>*/
  15347. {
  15348. options = options || {};
  15349. var aggregateOptions = {};
  15350. aggregateOptions.useMasterKey = true;
  15351. if (options.hasOwnProperty('sessionToken')) {
  15352. aggregateOptions.sessionToken = options.sessionToken;
  15353. }
  15354. this._setRequestTask(aggregateOptions);
  15355. var controller = _CoreManager.default.getQueryController();
  15356. if (!(0, _isArray.default)(pipeline) && (0, _typeof2.default)(pipeline) !== 'object') {
  15357. throw new Error('Invalid pipeline must be Array or Object');
  15358. }
  15359. if ((0, _keys2.default)(this._where || {}).length) {
  15360. if (!(0, _isArray.default)(pipeline)) {
  15361. pipeline = [pipeline];
  15362. }
  15363. pipeline.unshift({
  15364. match: this._where
  15365. });
  15366. }
  15367. var params = {
  15368. pipeline: pipeline,
  15369. hint: this._hint,
  15370. explain: this._explain,
  15371. readPreference: this._readPreference
  15372. };
  15373. return controller.aggregate(this.className, params, aggregateOptions).then(function (results) {
  15374. return results.results;
  15375. });
  15376. }
  15377. /**
  15378. * Retrieves at most one Parse.Object that satisfies this query.
  15379. *
  15380. * Returns the object if there is one, otherwise undefined.
  15381. *
  15382. * @param {object} options Valid options are:<ul>
  15383. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15384. * be used for this request.
  15385. * <li>sessionToken: A valid session token, used for making a request on
  15386. * behalf of a specific user.
  15387. * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
  15388. * <li>json: Return raw json without converting to Parse.Object
  15389. * </ul>
  15390. *
  15391. * @returns {Promise} A promise that is resolved with the object when
  15392. * the query completes.
  15393. */
  15394. }, {
  15395. key: "first",
  15396. value: function first(options
  15397. /*:: ?: FullOptions*/
  15398. )
  15399. /*: Promise<ParseObject | void>*/
  15400. {
  15401. var _this4 = this;
  15402. options = options || {};
  15403. var findOptions = {};
  15404. if (options.hasOwnProperty('useMasterKey')) {
  15405. findOptions.useMasterKey = options.useMasterKey;
  15406. }
  15407. if (options.hasOwnProperty('sessionToken')) {
  15408. findOptions.sessionToken = options.sessionToken;
  15409. }
  15410. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  15411. findOptions.context = options.context;
  15412. }
  15413. this._setRequestTask(findOptions);
  15414. var controller = _CoreManager.default.getQueryController();
  15415. var params = this.toJSON();
  15416. params.limit = 1;
  15417. var select = this._select;
  15418. if (this._queriesLocalDatastore) {
  15419. return this._handleOfflineQuery(params).then(function (objects) {
  15420. if (!objects[0]) {
  15421. return undefined;
  15422. }
  15423. return objects[0];
  15424. });
  15425. }
  15426. return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(function (response) {
  15427. var objects = response.results;
  15428. if (!objects[0]) {
  15429. return undefined;
  15430. }
  15431. if (!objects[0].className) {
  15432. objects[0].className = _this4.className;
  15433. } // Make sure the data object contains keys for all objects that
  15434. // have been requested with a select, so that our cached state
  15435. // updates correctly.
  15436. if (select) {
  15437. handleSelectResult(objects[0], select);
  15438. }
  15439. if (options.json) {
  15440. return objects[0];
  15441. } else {
  15442. return _ParseObject.default.fromJSON(objects[0], !select);
  15443. }
  15444. });
  15445. }
  15446. /**
  15447. * Iterates over objects matching a query, calling a callback for each batch.
  15448. * If the callback returns a promise, the iteration will not continue until
  15449. * that promise has been fulfilled. If the callback returns a rejected
  15450. * promise, then iteration will stop with that error. The items are processed
  15451. * in an unspecified order. The query may not have any sort order, and may
  15452. * not use limit or skip.
  15453. *
  15454. * @param {Function} callback Callback that will be called with each result
  15455. * of the query.
  15456. * @param {object} options Valid options are:<ul>
  15457. * <li>batchSize: How many objects to yield in each batch (default: 100)
  15458. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15459. * be used for this request.
  15460. * <li>sessionToken: A valid session token, used for making a request on
  15461. * behalf of a specific user.
  15462. * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
  15463. * </ul>
  15464. * @returns {Promise} A promise that will be fulfilled once the
  15465. * iteration has completed.
  15466. */
  15467. }, {
  15468. key: "eachBatch",
  15469. value: function eachBatch(callback
  15470. /*: (objs: Array<ParseObject>) => Promise<*>*/
  15471. , options
  15472. /*:: ?: BatchOptions*/
  15473. )
  15474. /*: Promise<void>*/
  15475. {
  15476. var _context8;
  15477. options = options || {};
  15478. if (this._order || this._skip || this._limit >= 0) {
  15479. var error = 'Cannot iterate on a query with sort, skip, or limit.';
  15480. return _promise.default.reject(error);
  15481. }
  15482. var query = new ParseQuery(this.className);
  15483. query._limit = options.batchSize || 100;
  15484. query._include = (0, _map2.default)(_context8 = this._include).call(_context8, function (i) {
  15485. return i;
  15486. });
  15487. if (this._select) {
  15488. var _context9;
  15489. query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
  15490. return s;
  15491. });
  15492. }
  15493. query._hint = this._hint;
  15494. query._where = {};
  15495. for (var _attr in this._where) {
  15496. var val = this._where[_attr];
  15497. if ((0, _isArray.default)(val)) {
  15498. query._where[_attr] = (0, _map2.default)(val).call(val, function (v) {
  15499. return v;
  15500. });
  15501. } else if (val && (0, _typeof2.default)(val) === 'object') {
  15502. var conditionMap = {};
  15503. query._where[_attr] = conditionMap;
  15504. for (var cond in val) {
  15505. conditionMap[cond] = val[cond];
  15506. }
  15507. } else {
  15508. query._where[_attr] = val;
  15509. }
  15510. }
  15511. query.ascending('objectId');
  15512. var findOptions = {};
  15513. if (options.hasOwnProperty('useMasterKey')) {
  15514. findOptions.useMasterKey = options.useMasterKey;
  15515. }
  15516. if (options.hasOwnProperty('sessionToken')) {
  15517. findOptions.sessionToken = options.sessionToken;
  15518. }
  15519. if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
  15520. findOptions.context = options.context;
  15521. }
  15522. if (options.hasOwnProperty('json')) {
  15523. findOptions.json = options.json;
  15524. }
  15525. var finished = false;
  15526. var previousResults = [];
  15527. return (0, _promiseUtils.continueWhile)(function () {
  15528. return !finished;
  15529. }, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  15530. var _yield$Promise$all, _yield$Promise$all2, results;
  15531. return _regeneratorRuntime().wrap(function _callee3$(_context10) {
  15532. while (1) {
  15533. switch (_context10.prev = _context10.next) {
  15534. case 0:
  15535. _context10.next = 2;
  15536. return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
  15537. case 2:
  15538. _yield$Promise$all = _context10.sent;
  15539. _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
  15540. results = _yield$Promise$all2[0];
  15541. if (!(results.length >= query._limit)) {
  15542. _context10.next = 10;
  15543. break;
  15544. }
  15545. query.greaterThan('objectId', results[results.length - 1].id);
  15546. previousResults = results;
  15547. _context10.next = 17;
  15548. break;
  15549. case 10:
  15550. if (!(results.length > 0)) {
  15551. _context10.next = 16;
  15552. break;
  15553. }
  15554. _context10.next = 13;
  15555. return _promise.default.resolve(callback(results));
  15556. case 13:
  15557. finished = true;
  15558. _context10.next = 17;
  15559. break;
  15560. case 16:
  15561. finished = true;
  15562. case 17:
  15563. case "end":
  15564. return _context10.stop();
  15565. }
  15566. }
  15567. }, _callee3);
  15568. })));
  15569. }
  15570. /**
  15571. * Iterates over each result of a query, calling a callback for each one. If
  15572. * the callback returns a promise, the iteration will not continue until
  15573. * that promise has been fulfilled. If the callback returns a rejected
  15574. * promise, then iteration will stop with that error. The items are
  15575. * processed in an unspecified order. The query may not have any sort order,
  15576. * and may not use limit or skip.
  15577. *
  15578. * @param {Function} callback Callback that will be called with each result
  15579. * of the query.
  15580. * @param {object} options Valid options are:<ul>
  15581. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15582. * be used for this request.
  15583. * <li>sessionToken: A valid session token, used for making a request on
  15584. * behalf of a specific user.
  15585. * <li>json: Return raw json without converting to Parse.Object
  15586. * </ul>
  15587. * @returns {Promise} A promise that will be fulfilled once the
  15588. * iteration has completed.
  15589. */
  15590. }, {
  15591. key: "each",
  15592. value: function each(callback
  15593. /*: (obj: ParseObject) => any*/
  15594. , options
  15595. /*:: ?: BatchOptions*/
  15596. )
  15597. /*: Promise<void>*/
  15598. {
  15599. return this.eachBatch(function (results) {
  15600. var callbacksDone = _promise.default.resolve();
  15601. (0, _forEach.default)(results).call(results, function (result) {
  15602. callbacksDone = callbacksDone.then(function () {
  15603. return callback(result);
  15604. });
  15605. });
  15606. return callbacksDone;
  15607. }, options);
  15608. }
  15609. /**
  15610. * Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)
  15611. *
  15612. * @param {(string|object)} value String or Object of index that should be used when executing query
  15613. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15614. */
  15615. }, {
  15616. key: "hint",
  15617. value: function hint(value
  15618. /*: mixed*/
  15619. )
  15620. /*: ParseQuery*/
  15621. {
  15622. if (typeof value === 'undefined') {
  15623. delete this._hint;
  15624. }
  15625. this._hint = value;
  15626. return this;
  15627. }
  15628. /**
  15629. * Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)
  15630. *
  15631. * @param {boolean} explain Used to toggle the information on the query plan.
  15632. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15633. */
  15634. }, {
  15635. key: "explain",
  15636. value: function explain()
  15637. /*: ParseQuery*/
  15638. {
  15639. var _explain
  15640. /*: boolean*/
  15641. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  15642. if (typeof _explain !== 'boolean') {
  15643. throw new Error('You can only set explain to a boolean value');
  15644. }
  15645. this._explain = _explain;
  15646. return this;
  15647. }
  15648. /**
  15649. * Iterates over each result of a query, calling a callback for each one. If
  15650. * the callback returns a promise, the iteration will not continue until
  15651. * that promise has been fulfilled. If the callback returns a rejected
  15652. * promise, then iteration will stop with that error. The items are
  15653. * processed in an unspecified order. The query may not have any sort order,
  15654. * and may not use limit or skip.
  15655. *
  15656. * @param {Function} callback Callback <ul>
  15657. * <li>currentObject: The current Parse.Object being processed in the array.</li>
  15658. * <li>index: The index of the current Parse.Object being processed in the array.</li>
  15659. * <li>query: The query map was called upon.</li>
  15660. * </ul>
  15661. *
  15662. * @param {object} options Valid options are:<ul>
  15663. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15664. * be used for this request.
  15665. * <li>sessionToken: A valid session token, used for making a request on
  15666. * behalf of a specific user.
  15667. * </ul>
  15668. * @returns {Promise} A promise that will be fulfilled once the
  15669. * iteration has completed.
  15670. */
  15671. }, {
  15672. key: "map",
  15673. value: function () {
  15674. var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(callback
  15675. /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/
  15676. , options
  15677. /*:: ?: BatchOptions*/
  15678. ) {
  15679. var _this5 = this;
  15680. var array, index;
  15681. return _regeneratorRuntime().wrap(function _callee4$(_context11) {
  15682. while (1) {
  15683. switch (_context11.prev = _context11.next) {
  15684. case 0:
  15685. array = [];
  15686. index = 0;
  15687. _context11.next = 4;
  15688. return this.each(function (object) {
  15689. return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
  15690. array.push(result);
  15691. index += 1;
  15692. });
  15693. }, options);
  15694. case 4:
  15695. return _context11.abrupt("return", array);
  15696. case 5:
  15697. case "end":
  15698. return _context11.stop();
  15699. }
  15700. }
  15701. }, _callee4, this);
  15702. }));
  15703. function map(_x3, _x4) {
  15704. return _map.apply(this, arguments);
  15705. }
  15706. return map;
  15707. }()
  15708. /**
  15709. * Iterates over each result of a query, calling a callback for each one. If
  15710. * the callback returns a promise, the iteration will not continue until
  15711. * that promise has been fulfilled. If the callback returns a rejected
  15712. * promise, then iteration will stop with that error. The items are
  15713. * processed in an unspecified order. The query may not have any sort order,
  15714. * and may not use limit or skip.
  15715. *
  15716. * @param {Function} callback Callback <ul>
  15717. * <li>accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.</li>
  15718. * <li>currentObject: The current Parse.Object being processed in the array.</li>
  15719. * <li>index: The index of the current Parse.Object being processed in the array.</li>
  15720. * </ul>
  15721. * @param {*} initialValue A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.
  15722. * @param {object} options Valid options are:<ul>
  15723. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15724. * be used for this request.
  15725. * <li>sessionToken: A valid session token, used for making a request on
  15726. * behalf of a specific user.
  15727. * </ul>
  15728. * @returns {Promise} A promise that will be fulfilled once the
  15729. * iteration has completed.
  15730. */
  15731. }, {
  15732. key: "reduce",
  15733. value: function () {
  15734. var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(callback
  15735. /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/
  15736. , initialValue
  15737. /*: any*/
  15738. , options
  15739. /*:: ?: BatchOptions*/
  15740. ) {
  15741. var accumulator, index;
  15742. return _regeneratorRuntime().wrap(function _callee5$(_context12) {
  15743. while (1) {
  15744. switch (_context12.prev = _context12.next) {
  15745. case 0:
  15746. accumulator = initialValue;
  15747. index = 0;
  15748. _context12.next = 4;
  15749. return this.each(function (object) {
  15750. // If no initial value was given, we take the first object from the query
  15751. // as the initial value and don't call the callback with it.
  15752. if (index === 0 && initialValue === undefined) {
  15753. accumulator = object;
  15754. index += 1;
  15755. return;
  15756. }
  15757. return _promise.default.resolve(callback(accumulator, object, index)).then(function (result) {
  15758. accumulator = result;
  15759. index += 1;
  15760. });
  15761. }, options);
  15762. case 4:
  15763. if (!(index === 0 && initialValue === undefined)) {
  15764. _context12.next = 6;
  15765. break;
  15766. }
  15767. throw new TypeError('Reducing empty query result set with no initial value');
  15768. case 6:
  15769. return _context12.abrupt("return", accumulator);
  15770. case 7:
  15771. case "end":
  15772. return _context12.stop();
  15773. }
  15774. }
  15775. }, _callee5, this);
  15776. }));
  15777. function reduce(_x5, _x6, _x7) {
  15778. return _reduce.apply(this, arguments);
  15779. }
  15780. return reduce;
  15781. }()
  15782. /**
  15783. * Iterates over each result of a query, calling a callback for each one. If
  15784. * the callback returns a promise, the iteration will not continue until
  15785. * that promise has been fulfilled. If the callback returns a rejected
  15786. * promise, then iteration will stop with that error. The items are
  15787. * processed in an unspecified order. The query may not have any sort order,
  15788. * and may not use limit or skip.
  15789. *
  15790. * @param {Function} callback Callback <ul>
  15791. * <li>currentObject: The current Parse.Object being processed in the array.</li>
  15792. * <li>index: The index of the current Parse.Object being processed in the array.</li>
  15793. * <li>query: The query filter was called upon.</li>
  15794. * </ul>
  15795. *
  15796. * @param {object} options Valid options are:<ul>
  15797. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  15798. * be used for this request.
  15799. * <li>sessionToken: A valid session token, used for making a request on
  15800. * behalf of a specific user.
  15801. * </ul>
  15802. * @returns {Promise} A promise that will be fulfilled once the
  15803. * iteration has completed.
  15804. */
  15805. }, {
  15806. key: "filter",
  15807. value: function () {
  15808. var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(callback
  15809. /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/
  15810. , options
  15811. /*:: ?: BatchOptions*/
  15812. ) {
  15813. var _this6 = this;
  15814. var array, index;
  15815. return _regeneratorRuntime().wrap(function _callee6$(_context13) {
  15816. while (1) {
  15817. switch (_context13.prev = _context13.next) {
  15818. case 0:
  15819. array = [];
  15820. index = 0;
  15821. _context13.next = 4;
  15822. return this.each(function (object) {
  15823. return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
  15824. if (flag) {
  15825. array.push(object);
  15826. }
  15827. index += 1;
  15828. });
  15829. }, options);
  15830. case 4:
  15831. return _context13.abrupt("return", array);
  15832. case 5:
  15833. case "end":
  15834. return _context13.stop();
  15835. }
  15836. }
  15837. }, _callee6, this);
  15838. }));
  15839. function filter(_x8, _x9) {
  15840. return _filter.apply(this, arguments);
  15841. }
  15842. return filter;
  15843. }()
  15844. /** Query Conditions **/
  15845. /**
  15846. * Adds a constraint to the query that requires a particular key's value to
  15847. * be equal to the provided value.
  15848. *
  15849. * @param {string} key The key to check.
  15850. * @param value The value that the Parse.Object must contain.
  15851. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15852. */
  15853. }, {
  15854. key: "equalTo",
  15855. value: function equalTo(key
  15856. /*: string | { [key: string]: any }*/
  15857. , value
  15858. /*: ?mixed*/
  15859. )
  15860. /*: ParseQuery*/
  15861. {
  15862. var _this7 = this;
  15863. if (key && (0, _typeof2.default)(key) === 'object') {
  15864. var _context14;
  15865. (0, _forEach.default)(_context14 = (0, _entries.default)(key)).call(_context14, function (_ref2) {
  15866. var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
  15867. k = _ref3[0],
  15868. val = _ref3[1];
  15869. return _this7.equalTo(k, val);
  15870. });
  15871. return this;
  15872. }
  15873. if (typeof value === 'undefined') {
  15874. return this.doesNotExist(key);
  15875. }
  15876. this._where[key] = (0, _encode.default)(value, false, true);
  15877. return this;
  15878. }
  15879. /**
  15880. * Adds a constraint to the query that requires a particular key's value to
  15881. * be not equal to the provided value.
  15882. *
  15883. * @param {string} key The key to check.
  15884. * @param value The value that must not be equalled.
  15885. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15886. */
  15887. }, {
  15888. key: "notEqualTo",
  15889. value: function notEqualTo(key
  15890. /*: string | { [key: string]: any }*/
  15891. , value
  15892. /*: ?mixed*/
  15893. )
  15894. /*: ParseQuery*/
  15895. {
  15896. var _this8 = this;
  15897. if (key && (0, _typeof2.default)(key) === 'object') {
  15898. var _context15;
  15899. (0, _forEach.default)(_context15 = (0, _entries.default)(key)).call(_context15, function (_ref4) {
  15900. var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
  15901. k = _ref5[0],
  15902. val = _ref5[1];
  15903. return _this8.notEqualTo(k, val);
  15904. });
  15905. return this;
  15906. }
  15907. return this._addCondition(key, '$ne', value);
  15908. }
  15909. /**
  15910. * Adds a constraint to the query that requires a particular key's value to
  15911. * be less than the provided value.
  15912. *
  15913. * @param {string} key The key to check.
  15914. * @param value The value that provides an upper bound.
  15915. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15916. */
  15917. }, {
  15918. key: "lessThan",
  15919. value: function lessThan(key
  15920. /*: string*/
  15921. , value
  15922. /*: mixed*/
  15923. )
  15924. /*: ParseQuery*/
  15925. {
  15926. return this._addCondition(key, '$lt', value);
  15927. }
  15928. /**
  15929. * Adds a constraint to the query that requires a particular key's value to
  15930. * be greater than the provided value.
  15931. *
  15932. * @param {string} key The key to check.
  15933. * @param value The value that provides an lower bound.
  15934. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15935. */
  15936. }, {
  15937. key: "greaterThan",
  15938. value: function greaterThan(key
  15939. /*: string*/
  15940. , value
  15941. /*: mixed*/
  15942. )
  15943. /*: ParseQuery*/
  15944. {
  15945. return this._addCondition(key, '$gt', value);
  15946. }
  15947. /**
  15948. * Adds a constraint to the query that requires a particular key's value to
  15949. * be less than or equal to the provided value.
  15950. *
  15951. * @param {string} key The key to check.
  15952. * @param value The value that provides an upper bound.
  15953. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15954. */
  15955. }, {
  15956. key: "lessThanOrEqualTo",
  15957. value: function lessThanOrEqualTo(key
  15958. /*: string*/
  15959. , value
  15960. /*: mixed*/
  15961. )
  15962. /*: ParseQuery*/
  15963. {
  15964. return this._addCondition(key, '$lte', value);
  15965. }
  15966. /**
  15967. * Adds a constraint to the query that requires a particular key's value to
  15968. * be greater than or equal to the provided value.
  15969. *
  15970. * @param {string} key The key to check.
  15971. * @param {*} value The value that provides an lower bound.
  15972. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15973. */
  15974. }, {
  15975. key: "greaterThanOrEqualTo",
  15976. value: function greaterThanOrEqualTo(key
  15977. /*: string*/
  15978. , value
  15979. /*: mixed*/
  15980. )
  15981. /*: ParseQuery*/
  15982. {
  15983. return this._addCondition(key, '$gte', value);
  15984. }
  15985. /**
  15986. * Adds a constraint to the query that requires a particular key's value to
  15987. * be contained in the provided list of values.
  15988. *
  15989. * @param {string} key The key to check.
  15990. * @param {*} value The values that will match.
  15991. * @returns {Parse.Query} Returns the query, so you can chain this call.
  15992. */
  15993. }, {
  15994. key: "containedIn",
  15995. value: function containedIn(key
  15996. /*: string*/
  15997. , value
  15998. /*: mixed*/
  15999. )
  16000. /*: ParseQuery*/
  16001. {
  16002. return this._addCondition(key, '$in', value);
  16003. }
  16004. /**
  16005. * Adds a constraint to the query that requires a particular key's value to
  16006. * not be contained in the provided list of values.
  16007. *
  16008. * @param {string} key The key to check.
  16009. * @param {*} value The values that will not match.
  16010. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16011. */
  16012. }, {
  16013. key: "notContainedIn",
  16014. value: function notContainedIn(key
  16015. /*: string*/
  16016. , value
  16017. /*: mixed*/
  16018. )
  16019. /*: ParseQuery*/
  16020. {
  16021. return this._addCondition(key, '$nin', value);
  16022. }
  16023. /**
  16024. * Adds a constraint to the query that requires a particular key's value to
  16025. * be contained by the provided list of values. Get objects where all array elements match.
  16026. *
  16027. * @param {string} key The key to check.
  16028. * @param {Array} values The values that will match.
  16029. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16030. */
  16031. }, {
  16032. key: "containedBy",
  16033. value: function containedBy(key
  16034. /*: string*/
  16035. , values
  16036. /*: Array<mixed>*/
  16037. )
  16038. /*: ParseQuery*/
  16039. {
  16040. return this._addCondition(key, '$containedBy', values);
  16041. }
  16042. /**
  16043. * Adds a constraint to the query that requires a particular key's value to
  16044. * contain each one of the provided list of values.
  16045. *
  16046. * @param {string} key The key to check. This key's value must be an array.
  16047. * @param {Array} values The values that will match.
  16048. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16049. */
  16050. }, {
  16051. key: "containsAll",
  16052. value: function containsAll(key
  16053. /*: string*/
  16054. , values
  16055. /*: Array<mixed>*/
  16056. )
  16057. /*: ParseQuery*/
  16058. {
  16059. return this._addCondition(key, '$all', values);
  16060. }
  16061. /**
  16062. * Adds a constraint to the query that requires a particular key's value to
  16063. * contain each one of the provided list of values starting with given strings.
  16064. *
  16065. * @param {string} key The key to check. This key's value must be an array.
  16066. * @param {Array<string>} values The string values that will match as starting string.
  16067. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16068. */
  16069. }, {
  16070. key: "containsAllStartingWith",
  16071. value: function containsAllStartingWith(key
  16072. /*: string*/
  16073. , values
  16074. /*: Array<string>*/
  16075. )
  16076. /*: ParseQuery*/
  16077. {
  16078. var _this = this;
  16079. if (!(0, _isArray.default)(values)) {
  16080. values = [values];
  16081. }
  16082. var regexObject = (0, _map2.default)(values).call(values, function (value) {
  16083. return {
  16084. $regex: _this._regexStartWith(value)
  16085. };
  16086. });
  16087. return this.containsAll(key, regexObject);
  16088. }
  16089. /**
  16090. * Adds a constraint for finding objects that contain the given key.
  16091. *
  16092. * @param {string} key The key that should exist.
  16093. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16094. */
  16095. }, {
  16096. key: "exists",
  16097. value: function exists(key
  16098. /*: string*/
  16099. )
  16100. /*: ParseQuery*/
  16101. {
  16102. return this._addCondition(key, '$exists', true);
  16103. }
  16104. /**
  16105. * Adds a constraint for finding objects that do not contain a given key.
  16106. *
  16107. * @param {string} key The key that should not exist
  16108. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16109. */
  16110. }, {
  16111. key: "doesNotExist",
  16112. value: function doesNotExist(key
  16113. /*: string*/
  16114. )
  16115. /*: ParseQuery*/
  16116. {
  16117. return this._addCondition(key, '$exists', false);
  16118. }
  16119. /**
  16120. * Adds a regular expression constraint for finding string values that match
  16121. * the provided regular expression.
  16122. * This may be slow for large datasets.
  16123. *
  16124. * @param {string} key The key that the string to match is stored in.
  16125. * @param {RegExp} regex The regular expression pattern to match.
  16126. * @param {string} modifiers The regular expression mode.
  16127. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16128. */
  16129. }, {
  16130. key: "matches",
  16131. value: function matches(key
  16132. /*: string*/
  16133. , regex
  16134. /*: RegExp*/
  16135. , modifiers
  16136. /*: string*/
  16137. )
  16138. /*: ParseQuery*/
  16139. {
  16140. this._addCondition(key, '$regex', regex);
  16141. if (!modifiers) {
  16142. modifiers = '';
  16143. }
  16144. if (regex.ignoreCase) {
  16145. modifiers += 'i';
  16146. }
  16147. if (regex.multiline) {
  16148. modifiers += 'm';
  16149. }
  16150. if (modifiers.length) {
  16151. this._addCondition(key, '$options', modifiers);
  16152. }
  16153. return this;
  16154. }
  16155. /**
  16156. * Adds a constraint that requires that a key's value matches a Parse.Query
  16157. * constraint.
  16158. *
  16159. * @param {string} key The key that the contains the object to match the
  16160. * query.
  16161. * @param {Parse.Query} query The query that should match.
  16162. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16163. */
  16164. }, {
  16165. key: "matchesQuery",
  16166. value: function matchesQuery(key
  16167. /*: string*/
  16168. , query
  16169. /*: ParseQuery*/
  16170. )
  16171. /*: ParseQuery*/
  16172. {
  16173. var queryJSON = query.toJSON();
  16174. queryJSON.className = query.className;
  16175. return this._addCondition(key, '$inQuery', queryJSON);
  16176. }
  16177. /**
  16178. * Adds a constraint that requires that a key's value not matches a
  16179. * Parse.Query constraint.
  16180. *
  16181. * @param {string} key The key that the contains the object to match the
  16182. * query.
  16183. * @param {Parse.Query} query The query that should not match.
  16184. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16185. */
  16186. }, {
  16187. key: "doesNotMatchQuery",
  16188. value: function doesNotMatchQuery(key
  16189. /*: string*/
  16190. , query
  16191. /*: ParseQuery*/
  16192. )
  16193. /*: ParseQuery*/
  16194. {
  16195. var queryJSON = query.toJSON();
  16196. queryJSON.className = query.className;
  16197. return this._addCondition(key, '$notInQuery', queryJSON);
  16198. }
  16199. /**
  16200. * Adds a constraint that requires that a key's value matches a value in
  16201. * an object returned by a different Parse.Query.
  16202. *
  16203. * @param {string} key The key that contains the value that is being
  16204. * matched.
  16205. * @param {string} queryKey The key in the objects returned by the query to
  16206. * match against.
  16207. * @param {Parse.Query} query The query to run.
  16208. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16209. */
  16210. }, {
  16211. key: "matchesKeyInQuery",
  16212. value: function matchesKeyInQuery(key
  16213. /*: string*/
  16214. , queryKey
  16215. /*: string*/
  16216. , query
  16217. /*: ParseQuery*/
  16218. )
  16219. /*: ParseQuery*/
  16220. {
  16221. var queryJSON = query.toJSON();
  16222. queryJSON.className = query.className;
  16223. return this._addCondition(key, '$select', {
  16224. key: queryKey,
  16225. query: queryJSON
  16226. });
  16227. }
  16228. /**
  16229. * Adds a constraint that requires that a key's value not match a value in
  16230. * an object returned by a different Parse.Query.
  16231. *
  16232. * @param {string} key The key that contains the value that is being
  16233. * excluded.
  16234. * @param {string} queryKey The key in the objects returned by the query to
  16235. * match against.
  16236. * @param {Parse.Query} query The query to run.
  16237. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16238. */
  16239. }, {
  16240. key: "doesNotMatchKeyInQuery",
  16241. value: function doesNotMatchKeyInQuery(key
  16242. /*: string*/
  16243. , queryKey
  16244. /*: string*/
  16245. , query
  16246. /*: ParseQuery*/
  16247. )
  16248. /*: ParseQuery*/
  16249. {
  16250. var queryJSON = query.toJSON();
  16251. queryJSON.className = query.className;
  16252. return this._addCondition(key, '$dontSelect', {
  16253. key: queryKey,
  16254. query: queryJSON
  16255. });
  16256. }
  16257. /**
  16258. * Adds a constraint for finding string values that contain a provided
  16259. * string. This may be slow for large datasets.
  16260. *
  16261. * @param {string} key The key that the string to match is stored in.
  16262. * @param {string} substring The substring that the value must contain.
  16263. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16264. */
  16265. }, {
  16266. key: "contains",
  16267. value: function contains(key
  16268. /*: string*/
  16269. , substring
  16270. /*: string*/
  16271. )
  16272. /*: ParseQuery*/
  16273. {
  16274. if (typeof substring !== 'string') {
  16275. throw new Error('The value being searched for must be a string.');
  16276. }
  16277. return this._addCondition(key, '$regex', quote(substring));
  16278. }
  16279. /**
  16280. * Adds a constraint for finding string values that contain a provided
  16281. * string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
  16282. *
  16283. * In order to sort you must use select and ascending ($score is required)
  16284. * <pre>
  16285. * query.fullText('field', 'term');
  16286. * query.ascending('$score');
  16287. * query.select('$score');
  16288. * </pre>
  16289. *
  16290. * To retrieve the weight / rank
  16291. * <pre>
  16292. * object->get('score');
  16293. * </pre>
  16294. *
  16295. * You can define optionals by providing an object as a third parameter
  16296. * <pre>
  16297. * query.fullText('field', 'term', { language: 'es', diacriticSensitive: true });
  16298. * </pre>
  16299. *
  16300. * @param {string} key The key that the string to match is stored in.
  16301. * @param {string} value The string to search
  16302. * @param {object} options (Optional)
  16303. * @param {string} options.language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.
  16304. * @param {boolean} options.caseSensitive A boolean flag to enable or disable case sensitive search.
  16305. * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
  16306. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16307. */
  16308. }, {
  16309. key: "fullText",
  16310. value: function fullText(key
  16311. /*: string*/
  16312. , value
  16313. /*: string*/
  16314. , options
  16315. /*: ?Object*/
  16316. )
  16317. /*: ParseQuery*/
  16318. {
  16319. options = options || {};
  16320. if (!key) {
  16321. throw new Error('A key is required.');
  16322. }
  16323. if (!value) {
  16324. throw new Error('A search term is required');
  16325. }
  16326. if (typeof value !== 'string') {
  16327. throw new Error('The value being searched for must be a string.');
  16328. }
  16329. var fullOptions = {};
  16330. fullOptions.$term = value;
  16331. for (var option in options) {
  16332. switch (option) {
  16333. case 'language':
  16334. fullOptions.$language = options[option];
  16335. break;
  16336. case 'caseSensitive':
  16337. fullOptions.$caseSensitive = options[option];
  16338. break;
  16339. case 'diacriticSensitive':
  16340. fullOptions.$diacriticSensitive = options[option];
  16341. break;
  16342. default:
  16343. throw new Error("Unknown option: ".concat(option));
  16344. }
  16345. }
  16346. return this._addCondition(key, '$text', {
  16347. $search: fullOptions
  16348. });
  16349. }
  16350. /**
  16351. * Method to sort the full text search by text score
  16352. *
  16353. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16354. */
  16355. }, {
  16356. key: "sortByTextScore",
  16357. value: function sortByTextScore() {
  16358. this.ascending('$score');
  16359. this.select(['$score']);
  16360. return this;
  16361. }
  16362. /**
  16363. * Adds a constraint for finding string values that start with a provided
  16364. * string. This query will use the backend index, so it will be fast even
  16365. * for large datasets.
  16366. *
  16367. * @param {string} key The key that the string to match is stored in.
  16368. * @param {string} prefix The substring that the value must start with.
  16369. * @param {string} modifiers The regular expression mode.
  16370. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16371. */
  16372. }, {
  16373. key: "startsWith",
  16374. value: function startsWith(key
  16375. /*: string*/
  16376. , prefix
  16377. /*: string*/
  16378. , modifiers
  16379. /*: string*/
  16380. )
  16381. /*: ParseQuery*/
  16382. {
  16383. if (typeof prefix !== 'string') {
  16384. throw new Error('The value being searched for must be a string.');
  16385. }
  16386. return this.matches(key, this._regexStartWith(prefix), modifiers);
  16387. }
  16388. /**
  16389. * Adds a constraint for finding string values that end with a provided
  16390. * string. This will be slow for large datasets.
  16391. *
  16392. * @param {string} key The key that the string to match is stored in.
  16393. * @param {string} suffix The substring that the value must end with.
  16394. * @param {string} modifiers The regular expression mode.
  16395. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16396. */
  16397. }, {
  16398. key: "endsWith",
  16399. value: function endsWith(key
  16400. /*: string*/
  16401. , suffix
  16402. /*: string*/
  16403. , modifiers
  16404. /*: string*/
  16405. )
  16406. /*: ParseQuery*/
  16407. {
  16408. if (typeof suffix !== 'string') {
  16409. throw new Error('The value being searched for must be a string.');
  16410. }
  16411. return this.matches(key, quote(suffix) + '$', modifiers);
  16412. }
  16413. /**
  16414. * Adds a proximity based constraint for finding objects with key point
  16415. * values near the point given.
  16416. *
  16417. * @param {string} key The key that the Parse.GeoPoint is stored in.
  16418. * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
  16419. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16420. */
  16421. }, {
  16422. key: "near",
  16423. value: function near(key
  16424. /*: string*/
  16425. , point
  16426. /*: ParseGeoPoint*/
  16427. )
  16428. /*: ParseQuery*/
  16429. {
  16430. if (!(point instanceof _ParseGeoPoint.default)) {
  16431. // Try to cast it as a GeoPoint
  16432. point = new _ParseGeoPoint.default(point);
  16433. }
  16434. return this._addCondition(key, '$nearSphere', point);
  16435. }
  16436. /**
  16437. * Adds a proximity based constraint for finding objects with key point
  16438. * values near the point given and within the maximum distance given.
  16439. *
  16440. * @param {string} key The key that the Parse.GeoPoint is stored in.
  16441. * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
  16442. * @param {number} maxDistance Maximum distance (in radians) of results to return.
  16443. * @param {boolean} sorted A Bool value that is true if results should be
  16444. * sorted by distance ascending, false is no sorting is required,
  16445. * defaults to true.
  16446. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16447. */
  16448. }, {
  16449. key: "withinRadians",
  16450. value: function withinRadians(key
  16451. /*: string*/
  16452. , point
  16453. /*: ParseGeoPoint*/
  16454. , maxDistance
  16455. /*: number*/
  16456. , sorted
  16457. /*: boolean*/
  16458. )
  16459. /*: ParseQuery*/
  16460. {
  16461. if (sorted || sorted === undefined) {
  16462. this.near(key, point);
  16463. return this._addCondition(key, '$maxDistance', maxDistance);
  16464. } else {
  16465. return this._addCondition(key, '$geoWithin', {
  16466. $centerSphere: [[point.longitude, point.latitude], maxDistance]
  16467. });
  16468. }
  16469. }
  16470. /**
  16471. * Adds a proximity based constraint for finding objects with key point
  16472. * values near the point given and within the maximum distance given.
  16473. * Radius of earth used is 3958.8 miles.
  16474. *
  16475. * @param {string} key The key that the Parse.GeoPoint is stored in.
  16476. * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
  16477. * @param {number} maxDistance Maximum distance (in miles) of results to return.
  16478. * @param {boolean} sorted A Bool value that is true if results should be
  16479. * sorted by distance ascending, false is no sorting is required,
  16480. * defaults to true.
  16481. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16482. */
  16483. }, {
  16484. key: "withinMiles",
  16485. value: function withinMiles(key
  16486. /*: string*/
  16487. , point
  16488. /*: ParseGeoPoint*/
  16489. , maxDistance
  16490. /*: number*/
  16491. , sorted
  16492. /*: boolean*/
  16493. )
  16494. /*: ParseQuery*/
  16495. {
  16496. return this.withinRadians(key, point, maxDistance / 3958.8, sorted);
  16497. }
  16498. /**
  16499. * Adds a proximity based constraint for finding objects with key point
  16500. * values near the point given and within the maximum distance given.
  16501. * Radius of earth used is 6371.0 kilometers.
  16502. *
  16503. * @param {string} key The key that the Parse.GeoPoint is stored in.
  16504. * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
  16505. * @param {number} maxDistance Maximum distance (in kilometers) of results to return.
  16506. * @param {boolean} sorted A Bool value that is true if results should be
  16507. * sorted by distance ascending, false is no sorting is required,
  16508. * defaults to true.
  16509. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16510. */
  16511. }, {
  16512. key: "withinKilometers",
  16513. value: function withinKilometers(key
  16514. /*: string*/
  16515. , point
  16516. /*: ParseGeoPoint*/
  16517. , maxDistance
  16518. /*: number*/
  16519. , sorted
  16520. /*: boolean*/
  16521. )
  16522. /*: ParseQuery*/
  16523. {
  16524. return this.withinRadians(key, point, maxDistance / 6371.0, sorted);
  16525. }
  16526. /**
  16527. * Adds a constraint to the query that requires a particular key's
  16528. * coordinates be contained within a given rectangular geographic bounding
  16529. * box.
  16530. *
  16531. * @param {string} key The key to be constrained.
  16532. * @param {Parse.GeoPoint} southwest
  16533. * The lower-left inclusive corner of the box.
  16534. * @param {Parse.GeoPoint} northeast
  16535. * The upper-right inclusive corner of the box.
  16536. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16537. */
  16538. }, {
  16539. key: "withinGeoBox",
  16540. value: function withinGeoBox(key
  16541. /*: string*/
  16542. , southwest
  16543. /*: ParseGeoPoint*/
  16544. , northeast
  16545. /*: ParseGeoPoint*/
  16546. )
  16547. /*: ParseQuery*/
  16548. {
  16549. if (!(southwest instanceof _ParseGeoPoint.default)) {
  16550. southwest = new _ParseGeoPoint.default(southwest);
  16551. }
  16552. if (!(northeast instanceof _ParseGeoPoint.default)) {
  16553. northeast = new _ParseGeoPoint.default(northeast);
  16554. }
  16555. this._addCondition(key, '$within', {
  16556. $box: [southwest, northeast]
  16557. });
  16558. return this;
  16559. }
  16560. /**
  16561. * Adds a constraint to the query that requires a particular key's
  16562. * coordinates be contained within and on the bounds of a given polygon.
  16563. * Supports closed and open (last point is connected to first) paths
  16564. *
  16565. * Polygon must have at least 3 points
  16566. *
  16567. * @param {string} key The key to be constrained.
  16568. * @param {Array} points Array of Coordinates / GeoPoints
  16569. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16570. */
  16571. }, {
  16572. key: "withinPolygon",
  16573. value: function withinPolygon(key
  16574. /*: string*/
  16575. , points
  16576. /*: Array<Array<number>>*/
  16577. )
  16578. /*: ParseQuery*/
  16579. {
  16580. return this._addCondition(key, '$geoWithin', {
  16581. $polygon: points
  16582. });
  16583. }
  16584. /**
  16585. * Add a constraint to the query that requires a particular key's
  16586. * coordinates that contains a ParseGeoPoint
  16587. *
  16588. * @param {string} key The key to be constrained.
  16589. * @param {Parse.GeoPoint} point
  16590. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16591. */
  16592. }, {
  16593. key: "polygonContains",
  16594. value: function polygonContains(key
  16595. /*: string*/
  16596. , point
  16597. /*: ParseGeoPoint*/
  16598. )
  16599. /*: ParseQuery*/
  16600. {
  16601. return this._addCondition(key, '$geoIntersects', {
  16602. $point: point
  16603. });
  16604. }
  16605. /** Query Orderings **/
  16606. /**
  16607. * Sorts the results in ascending order by the given key.
  16608. *
  16609. * @param {(string|string[])} keys The key to order by, which is a
  16610. * string of comma separated values, or an Array of keys, or multiple keys.
  16611. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16612. */
  16613. }, {
  16614. key: "ascending",
  16615. value: function ascending()
  16616. /*: ParseQuery*/
  16617. {
  16618. this._order = [];
  16619. for (var _len = arguments.length, keys = new Array(_len), _key5 = 0; _key5 < _len; _key5++) {
  16620. keys[_key5] = arguments[_key5];
  16621. }
  16622. return this.addAscending.apply(this, keys);
  16623. }
  16624. /**
  16625. * Sorts the results in ascending order by the given key,
  16626. * but can also add secondary sort descriptors without overwriting _order.
  16627. *
  16628. * @param {(string|string[])} keys The key to order by, which is a
  16629. * string of comma separated values, or an Array of keys, or multiple keys.
  16630. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16631. */
  16632. }, {
  16633. key: "addAscending",
  16634. value: function addAscending()
  16635. /*: ParseQuery*/
  16636. {
  16637. var _this9 = this;
  16638. if (!this._order) {
  16639. this._order = [];
  16640. }
  16641. for (var _len2 = arguments.length, keys = new Array(_len2), _key6 = 0; _key6 < _len2; _key6++) {
  16642. keys[_key6] = arguments[_key6];
  16643. }
  16644. (0, _forEach.default)(keys).call(keys, function (key) {
  16645. var _context16;
  16646. if ((0, _isArray.default)(key)) {
  16647. key = key.join();
  16648. }
  16649. _this9._order = (0, _concat.default)(_context16 = _this9._order).call(_context16, key.replace(/\s/g, '').split(','));
  16650. });
  16651. return this;
  16652. }
  16653. /**
  16654. * Sorts the results in descending order by the given key.
  16655. *
  16656. * @param {(string|string[])} keys The key to order by, which is a
  16657. * string of comma separated values, or an Array of keys, or multiple keys.
  16658. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16659. */
  16660. }, {
  16661. key: "descending",
  16662. value: function descending()
  16663. /*: ParseQuery*/
  16664. {
  16665. this._order = [];
  16666. for (var _len3 = arguments.length, keys = new Array(_len3), _key7 = 0; _key7 < _len3; _key7++) {
  16667. keys[_key7] = arguments[_key7];
  16668. }
  16669. return this.addDescending.apply(this, keys);
  16670. }
  16671. /**
  16672. * Sorts the results in descending order by the given key,
  16673. * but can also add secondary sort descriptors without overwriting _order.
  16674. *
  16675. * @param {(string|string[])} keys The key to order by, which is a
  16676. * string of comma separated values, or an Array of keys, or multiple keys.
  16677. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16678. */
  16679. }, {
  16680. key: "addDescending",
  16681. value: function addDescending()
  16682. /*: ParseQuery*/
  16683. {
  16684. var _this10 = this;
  16685. if (!this._order) {
  16686. this._order = [];
  16687. }
  16688. for (var _len4 = arguments.length, keys = new Array(_len4), _key8 = 0; _key8 < _len4; _key8++) {
  16689. keys[_key8] = arguments[_key8];
  16690. }
  16691. (0, _forEach.default)(keys).call(keys, function (key) {
  16692. var _context17, _context18;
  16693. if ((0, _isArray.default)(key)) {
  16694. key = key.join();
  16695. }
  16696. _this10._order = (0, _concat.default)(_context17 = _this10._order).call(_context17, (0, _map2.default)(_context18 = key.replace(/\s/g, '').split(',')).call(_context18, function (k) {
  16697. return '-' + k;
  16698. }));
  16699. });
  16700. return this;
  16701. }
  16702. /** Query Options **/
  16703. /**
  16704. * Sets the number of results to skip before returning any results.
  16705. * This is useful for pagination.
  16706. * Default is to skip zero results.
  16707. *
  16708. * @param {number} n the number of results to skip.
  16709. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16710. */
  16711. }, {
  16712. key: "skip",
  16713. value: function skip(n
  16714. /*: number*/
  16715. )
  16716. /*: ParseQuery*/
  16717. {
  16718. if (typeof n !== 'number' || n < 0) {
  16719. throw new Error('You can only skip by a positive number');
  16720. }
  16721. this._skip = n;
  16722. return this;
  16723. }
  16724. /**
  16725. * Sets the limit of the number of results to return. The default limit is 100.
  16726. *
  16727. * @param {number} n the number of results to limit to.
  16728. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16729. */
  16730. }, {
  16731. key: "limit",
  16732. value: function limit(n
  16733. /*: number*/
  16734. )
  16735. /*: ParseQuery*/
  16736. {
  16737. if (typeof n !== 'number') {
  16738. throw new Error('You can only set the limit to a numeric value');
  16739. }
  16740. this._limit = n;
  16741. return this;
  16742. }
  16743. /**
  16744. * Sets the flag to include with response the total number of objects satisfying this query,
  16745. * despite limits/skip. Might be useful for pagination.
  16746. * Note that result of this query will be wrapped as an object with
  16747. * `results`: holding {ParseObject} array and `count`: integer holding total number
  16748. *
  16749. * @param {boolean} includeCount false - disable, true - enable.
  16750. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16751. */
  16752. }, {
  16753. key: "withCount",
  16754. value: function withCount()
  16755. /*: ParseQuery*/
  16756. {
  16757. var includeCount
  16758. /*: boolean*/
  16759. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  16760. if (typeof includeCount !== 'boolean') {
  16761. throw new Error('You can only set withCount to a boolean value');
  16762. }
  16763. this._count = includeCount;
  16764. return this;
  16765. }
  16766. /**
  16767. * Includes nested Parse.Objects for the provided key. You can use dot
  16768. * notation to specify which fields in the included object are also fetched.
  16769. *
  16770. * You can include all nested Parse.Objects by passing in '*'.
  16771. * Requires Parse Server 3.0.0+
  16772. * <pre>query.include('*');</pre>
  16773. *
  16774. * @param {...string|Array<string>} keys The name(s) of the key(s) to include.
  16775. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16776. */
  16777. }, {
  16778. key: "include",
  16779. value: function include()
  16780. /*: ParseQuery*/
  16781. {
  16782. var _this11 = this;
  16783. for (var _len5 = arguments.length, keys = new Array(_len5), _key9 = 0; _key9 < _len5; _key9++) {
  16784. keys[_key9] = arguments[_key9];
  16785. }
  16786. (0, _forEach.default)(keys).call(keys, function (key) {
  16787. if ((0, _isArray.default)(key)) {
  16788. var _context19;
  16789. _this11._include = (0, _concat.default)(_context19 = _this11._include).call(_context19, key);
  16790. } else {
  16791. _this11._include.push(key);
  16792. }
  16793. });
  16794. return this;
  16795. }
  16796. /**
  16797. * Includes all nested Parse.Objects one level deep.
  16798. *
  16799. * Requires Parse Server 3.0.0+
  16800. *
  16801. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16802. */
  16803. }, {
  16804. key: "includeAll",
  16805. value: function includeAll()
  16806. /*: ParseQuery*/
  16807. {
  16808. return this.include('*');
  16809. }
  16810. /**
  16811. * Restricts the fields of the returned Parse.Objects to include only the
  16812. * provided keys. If this is called multiple times, then all of the keys
  16813. * specified in each of the calls will be included.
  16814. *
  16815. * @param {...string|Array<string>} keys The name(s) of the key(s) to include.
  16816. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16817. */
  16818. }, {
  16819. key: "select",
  16820. value: function select()
  16821. /*: ParseQuery*/
  16822. {
  16823. var _this12 = this;
  16824. if (!this._select) {
  16825. this._select = [];
  16826. }
  16827. for (var _len6 = arguments.length, keys = new Array(_len6), _key10 = 0; _key10 < _len6; _key10++) {
  16828. keys[_key10] = arguments[_key10];
  16829. }
  16830. (0, _forEach.default)(keys).call(keys, function (key) {
  16831. if ((0, _isArray.default)(key)) {
  16832. var _context20;
  16833. _this12._select = (0, _concat.default)(_context20 = _this12._select).call(_context20, key);
  16834. } else {
  16835. _this12._select.push(key);
  16836. }
  16837. });
  16838. return this;
  16839. }
  16840. /**
  16841. * Restricts the fields of the returned Parse.Objects to all keys except the
  16842. * provided keys. Exclude takes precedence over select and include.
  16843. *
  16844. * Requires Parse Server 3.6.0+
  16845. *
  16846. * @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.
  16847. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16848. */
  16849. }, {
  16850. key: "exclude",
  16851. value: function exclude()
  16852. /*: ParseQuery*/
  16853. {
  16854. var _this13 = this;
  16855. for (var _len7 = arguments.length, keys = new Array(_len7), _key11 = 0; _key11 < _len7; _key11++) {
  16856. keys[_key11] = arguments[_key11];
  16857. }
  16858. (0, _forEach.default)(keys).call(keys, function (key) {
  16859. if ((0, _isArray.default)(key)) {
  16860. var _context21;
  16861. _this13._exclude = (0, _concat.default)(_context21 = _this13._exclude).call(_context21, key);
  16862. } else {
  16863. _this13._exclude.push(key);
  16864. }
  16865. });
  16866. return this;
  16867. }
  16868. /**
  16869. * Changes the read preference that the backend will use when performing the query to the database.
  16870. *
  16871. * @param {string} readPreference The read preference for the main query.
  16872. * @param {string} includeReadPreference The read preference for the queries to include pointers.
  16873. * @param {string} subqueryReadPreference The read preference for the sub queries.
  16874. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16875. */
  16876. }, {
  16877. key: "readPreference",
  16878. value: function readPreference(_readPreference
  16879. /*: string*/
  16880. , includeReadPreference
  16881. /*:: ?: string*/
  16882. , subqueryReadPreference
  16883. /*:: ?: string*/
  16884. )
  16885. /*: ParseQuery*/
  16886. {
  16887. this._readPreference = _readPreference;
  16888. this._includeReadPreference = includeReadPreference;
  16889. this._subqueryReadPreference = subqueryReadPreference;
  16890. return this;
  16891. }
  16892. /**
  16893. * Subscribe this query to get liveQuery updates
  16894. *
  16895. * @param {string} sessionToken (optional) Defaults to the currentUser
  16896. * @returns {Promise<LiveQuerySubscription>} Returns the liveQuerySubscription, it's an event emitter
  16897. * which can be used to get liveQuery updates.
  16898. */
  16899. }, {
  16900. key: "subscribe",
  16901. value: function () {
  16902. var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(sessionToken
  16903. /*:: ?: string*/
  16904. ) {
  16905. var currentUser, liveQueryClient, subscription;
  16906. return _regeneratorRuntime().wrap(function _callee7$(_context22) {
  16907. while (1) {
  16908. switch (_context22.prev = _context22.next) {
  16909. case 0:
  16910. _context22.next = 2;
  16911. return _CoreManager.default.getUserController().currentUserAsync();
  16912. case 2:
  16913. currentUser = _context22.sent;
  16914. if (!sessionToken) {
  16915. sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
  16916. }
  16917. _context22.next = 6;
  16918. return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
  16919. case 6:
  16920. liveQueryClient = _context22.sent;
  16921. if (liveQueryClient.shouldOpen()) {
  16922. liveQueryClient.open();
  16923. }
  16924. subscription = liveQueryClient.subscribe(this, sessionToken);
  16925. return _context22.abrupt("return", subscription.subscribePromise.then(function () {
  16926. return subscription;
  16927. }));
  16928. case 10:
  16929. case "end":
  16930. return _context22.stop();
  16931. }
  16932. }
  16933. }, _callee7, this);
  16934. }));
  16935. function subscribe(_x10) {
  16936. return _subscribe.apply(this, arguments);
  16937. }
  16938. return subscribe;
  16939. }()
  16940. /**
  16941. * Constructs a Parse.Query that is the OR of the passed in queries. For
  16942. * example:
  16943. * <pre>var compoundQuery = Parse.Query.or(query1, query2, query3);</pre>
  16944. *
  16945. * will create a compoundQuery that is an or of the query1, query2, and
  16946. * query3.
  16947. *
  16948. * @param {...Parse.Query} queries The list of queries to OR.
  16949. * @static
  16950. * @returns {Parse.Query} The query that is the OR of the passed in queries.
  16951. */
  16952. }, {
  16953. key: "fromNetwork",
  16954. value:
  16955. /**
  16956. * Change the source of this query to the server.
  16957. *
  16958. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16959. */
  16960. function fromNetwork()
  16961. /*: ParseQuery*/
  16962. {
  16963. this._queriesLocalDatastore = false;
  16964. this._localDatastorePinName = null;
  16965. return this;
  16966. }
  16967. /**
  16968. * Changes the source of this query to all pinned objects.
  16969. *
  16970. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16971. */
  16972. }, {
  16973. key: "fromLocalDatastore",
  16974. value: function fromLocalDatastore()
  16975. /*: ParseQuery*/
  16976. {
  16977. return this.fromPinWithName(null);
  16978. }
  16979. /**
  16980. * Changes the source of this query to the default group of pinned objects.
  16981. *
  16982. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16983. */
  16984. }, {
  16985. key: "fromPin",
  16986. value: function fromPin()
  16987. /*: ParseQuery*/
  16988. {
  16989. return this.fromPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
  16990. }
  16991. /**
  16992. * Changes the source of this query to a specific group of pinned objects.
  16993. *
  16994. * @param {string} name The name of query source.
  16995. * @returns {Parse.Query} Returns the query, so you can chain this call.
  16996. */
  16997. }, {
  16998. key: "fromPinWithName",
  16999. value: function fromPinWithName(name
  17000. /*:: ?: string*/
  17001. )
  17002. /*: ParseQuery*/
  17003. {
  17004. var localDatastore = _CoreManager.default.getLocalDatastore();
  17005. if (localDatastore.checkIfEnabled()) {
  17006. this._queriesLocalDatastore = true;
  17007. this._localDatastorePinName = name;
  17008. }
  17009. return this;
  17010. }
  17011. /**
  17012. * Cancels the current network request (if any is running).
  17013. *
  17014. * @returns {Parse.Query} Returns the query, so you can chain this call.
  17015. */
  17016. }, {
  17017. key: "cancel",
  17018. value: function cancel()
  17019. /*: ParseQuery*/
  17020. {
  17021. var _this14 = this;
  17022. if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
  17023. this._xhrRequest.task._aborted = true;
  17024. this._xhrRequest.task.abort();
  17025. this._xhrRequest.task = null;
  17026. this._xhrRequest.onchange = function () {};
  17027. return this;
  17028. }
  17029. return this._xhrRequest.onchange = function () {
  17030. return _this14.cancel();
  17031. };
  17032. }
  17033. }, {
  17034. key: "_setRequestTask",
  17035. value: function _setRequestTask(options) {
  17036. var _this15 = this;
  17037. options.requestTask = function (task) {
  17038. _this15._xhrRequest.task = task;
  17039. _this15._xhrRequest.onchange();
  17040. };
  17041. }
  17042. }], [{
  17043. key: "fromJSON",
  17044. value: function fromJSON(className
  17045. /*: string*/
  17046. , json
  17047. /*: QueryJSON*/
  17048. )
  17049. /*: ParseQuery*/
  17050. {
  17051. var query = new ParseQuery(className);
  17052. return query.withJSON(json);
  17053. }
  17054. }, {
  17055. key: "or",
  17056. value: function or()
  17057. /*: ParseQuery*/
  17058. {
  17059. for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
  17060. queries[_key12] = arguments[_key12];
  17061. }
  17062. var className = _getClassNameFromQueries(queries);
  17063. var query = new ParseQuery(className);
  17064. query._orQuery(queries);
  17065. return query;
  17066. }
  17067. /**
  17068. * Constructs a Parse.Query that is the AND of the passed in queries. For
  17069. * example:
  17070. * <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>
  17071. *
  17072. * will create a compoundQuery that is an and of the query1, query2, and
  17073. * query3.
  17074. *
  17075. * @param {...Parse.Query} queries The list of queries to AND.
  17076. * @static
  17077. * @returns {Parse.Query} The query that is the AND of the passed in queries.
  17078. */
  17079. }, {
  17080. key: "and",
  17081. value: function and()
  17082. /*: ParseQuery*/
  17083. {
  17084. for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
  17085. queries[_key13] = arguments[_key13];
  17086. }
  17087. var className = _getClassNameFromQueries(queries);
  17088. var query = new ParseQuery(className);
  17089. query._andQuery(queries);
  17090. return query;
  17091. }
  17092. /**
  17093. * Constructs a Parse.Query that is the NOR of the passed in queries. For
  17094. * example:
  17095. * <pre>const compoundQuery = Parse.Query.nor(query1, query2, query3);</pre>
  17096. *
  17097. * will create a compoundQuery that is a nor of the query1, query2, and
  17098. * query3.
  17099. *
  17100. * @param {...Parse.Query} queries The list of queries to NOR.
  17101. * @static
  17102. * @returns {Parse.Query} The query that is the NOR of the passed in queries.
  17103. */
  17104. }, {
  17105. key: "nor",
  17106. value: function nor()
  17107. /*: ParseQuery*/
  17108. {
  17109. for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
  17110. queries[_key14] = arguments[_key14];
  17111. }
  17112. var className = _getClassNameFromQueries(queries);
  17113. var query = new ParseQuery(className);
  17114. query._norQuery(queries);
  17115. return query;
  17116. }
  17117. }]);
  17118. return ParseQuery;
  17119. }();
  17120. var DefaultController = {
  17121. find: function find(className
  17122. /*: string*/
  17123. , params
  17124. /*: QueryJSON*/
  17125. , options
  17126. /*: RequestOptions*/
  17127. )
  17128. /*: Promise<Array<ParseObject>>*/
  17129. {
  17130. var RESTController = _CoreManager.default.getRESTController();
  17131. return RESTController.request('GET', 'classes/' + className, params, options);
  17132. },
  17133. aggregate: function aggregate(className
  17134. /*: string*/
  17135. , params
  17136. /*: any*/
  17137. , options
  17138. /*: RequestOptions*/
  17139. )
  17140. /*: Promise<Array<mixed>>*/
  17141. {
  17142. var RESTController = _CoreManager.default.getRESTController();
  17143. return RESTController.request('GET', 'aggregate/' + className, params, options);
  17144. }
  17145. };
  17146. _CoreManager.default.setQueryController(DefaultController);
  17147. var _default = ParseQuery;
  17148. exports.default = _default;
  17149. },{"./CoreManager":4,"./LocalDatastoreUtils":14,"./OfflineQuery":16,"./ParseError":21,"./ParseGeoPoint":23,"./ParseObject":26,"./encode":47,"./promiseUtils":52,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/find":64,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/includes":66,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/keys":68,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/instance/sort":73,"@babel/runtime-corejs3/core-js-stable/instance/splice":74,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/entries":84,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/slicedToArray":138,"@babel/runtime-corejs3/helpers/toConsumableArray":140,"@babel/runtime-corejs3/helpers/typeof":141}],30:[function(_dereq_,module,exports){
  17150. "use strict";
  17151. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  17152. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  17153. _Object$defineProperty(exports, "__esModule", {
  17154. value: true
  17155. });
  17156. exports.default = void 0;
  17157. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  17158. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  17159. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  17160. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  17161. var _ParseOp = _dereq_("./ParseOp");
  17162. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  17163. var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
  17164. /**
  17165. * Copyright (c) 2015-present, Parse, LLC.
  17166. * All rights reserved.
  17167. *
  17168. * This source code is licensed under the BSD-style license found in the
  17169. * LICENSE file in the root directory of this source tree. An additional grant
  17170. * of patent rights can be found in the PATENTS file in the same directory.
  17171. *
  17172. * @flow
  17173. */
  17174. /**
  17175. * Creates a new Relation for the given parent object and key. This
  17176. * constructor should rarely be used directly, but rather created by
  17177. * Parse.Object.relation.
  17178. *
  17179. * <p>
  17180. * A class that is used to access all of the children of a many-to-many
  17181. * relationship. Each instance of Parse.Relation is associated with a
  17182. * particular parent object and key.
  17183. * </p>
  17184. *
  17185. * @alias Parse.Relation
  17186. */
  17187. var ParseRelation = /*#__PURE__*/function () {
  17188. /**
  17189. * @param {Parse.Object} parent The parent of this relation.
  17190. * @param {string} key The key for this relation on the parent.
  17191. */
  17192. function ParseRelation(parent
  17193. /*: ?ParseObject*/
  17194. , key
  17195. /*: ?string*/
  17196. ) {
  17197. (0, _classCallCheck2.default)(this, ParseRelation);
  17198. (0, _defineProperty2.default)(this, "parent", void 0);
  17199. (0, _defineProperty2.default)(this, "key", void 0);
  17200. (0, _defineProperty2.default)(this, "targetClassName", void 0);
  17201. this.parent = parent;
  17202. this.key = key;
  17203. this.targetClassName = null;
  17204. }
  17205. /*
  17206. * Makes sure that this relation has the right parent and key.
  17207. */
  17208. (0, _createClass2.default)(ParseRelation, [{
  17209. key: "_ensureParentAndKey",
  17210. value: function (parent
  17211. /*: ParseObject*/
  17212. , key
  17213. /*: string*/
  17214. ) {
  17215. this.key = this.key || key;
  17216. if (this.key !== key) {
  17217. throw new Error('Internal Error. Relation retrieved from two different keys.');
  17218. }
  17219. if (this.parent) {
  17220. if (this.parent.className !== parent.className) {
  17221. throw new Error('Internal Error. Relation retrieved from two different Objects.');
  17222. }
  17223. if (this.parent.id) {
  17224. if (this.parent.id !== parent.id) {
  17225. throw new Error('Internal Error. Relation retrieved from two different Objects.');
  17226. }
  17227. } else if (parent.id) {
  17228. this.parent = parent;
  17229. }
  17230. } else {
  17231. this.parent = parent;
  17232. }
  17233. }
  17234. /**
  17235. * Adds a Parse.Object or an array of Parse.Objects to the relation.
  17236. *
  17237. * @param {(Parse.Object|Array)} objects The item or items to add.
  17238. * @returns {Parse.Object} The parent of the relation.
  17239. */
  17240. }, {
  17241. key: "add",
  17242. value: function (objects
  17243. /*: ParseObject | Array<ParseObject | string>*/
  17244. )
  17245. /*: ParseObject*/
  17246. {
  17247. if (!(0, _isArray.default)(objects)) {
  17248. objects = [objects];
  17249. }
  17250. var change = new _ParseOp.RelationOp(objects, []);
  17251. var parent = this.parent;
  17252. if (!parent) {
  17253. throw new Error('Cannot add to a Relation without a parent');
  17254. }
  17255. if (objects.length === 0) {
  17256. return parent;
  17257. }
  17258. parent.set(this.key, change);
  17259. this.targetClassName = change._targetClassName;
  17260. return parent;
  17261. }
  17262. /**
  17263. * Removes a Parse.Object or an array of Parse.Objects from this relation.
  17264. *
  17265. * @param {(Parse.Object|Array)} objects The item or items to remove.
  17266. */
  17267. }, {
  17268. key: "remove",
  17269. value: function (objects
  17270. /*: ParseObject | Array<ParseObject | string>*/
  17271. ) {
  17272. if (!(0, _isArray.default)(objects)) {
  17273. objects = [objects];
  17274. }
  17275. var change = new _ParseOp.RelationOp([], objects);
  17276. if (!this.parent) {
  17277. throw new Error('Cannot remove from a Relation without a parent');
  17278. }
  17279. if (objects.length === 0) {
  17280. return;
  17281. }
  17282. this.parent.set(this.key, change);
  17283. this.targetClassName = change._targetClassName;
  17284. }
  17285. /**
  17286. * Returns a JSON version of the object suitable for saving to disk.
  17287. *
  17288. * @returns {object} JSON representation of Relation
  17289. */
  17290. }, {
  17291. key: "toJSON",
  17292. value: function ()
  17293. /*: { __type: 'Relation', className: ?string }*/
  17294. {
  17295. return {
  17296. __type: 'Relation',
  17297. className: this.targetClassName
  17298. };
  17299. }
  17300. /**
  17301. * Returns a Parse.Query that is limited to objects in this
  17302. * relation.
  17303. *
  17304. * @returns {Parse.Query} Relation Query
  17305. */
  17306. }, {
  17307. key: "query",
  17308. value: function query()
  17309. /*: ParseQuery*/
  17310. {
  17311. var query;
  17312. var parent = this.parent;
  17313. if (!parent) {
  17314. throw new Error('Cannot construct a query for a Relation without a parent');
  17315. }
  17316. if (!this.targetClassName) {
  17317. query = new _ParseQuery.default(parent.className);
  17318. query._extraOptions.redirectClassNameForKey = this.key;
  17319. } else {
  17320. query = new _ParseQuery.default(this.targetClassName);
  17321. }
  17322. query._addCondition('$relatedTo', 'object', {
  17323. __type: 'Pointer',
  17324. className: parent.className,
  17325. objectId: parent.id
  17326. });
  17327. query._addCondition('$relatedTo', 'key', this.key);
  17328. return query;
  17329. }
  17330. }]);
  17331. return ParseRelation;
  17332. }();
  17333. var _default = ParseRelation;
  17334. exports.default = _default;
  17335. },{"./ParseObject":26,"./ParseOp":27,"./ParseQuery":29,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],31:[function(_dereq_,module,exports){
  17336. "use strict";
  17337. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  17338. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  17339. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  17340. _Object$defineProperty(exports, "__esModule", {
  17341. value: true
  17342. });
  17343. exports.default = void 0;
  17344. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  17345. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  17346. var _get2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/get"));
  17347. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  17348. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  17349. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  17350. var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
  17351. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  17352. var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
  17353. function _createSuper(Derived) {
  17354. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  17355. return function () {
  17356. var Super = (0, _getPrototypeOf2.default)(Derived),
  17357. result;
  17358. if (hasNativeReflectConstruct) {
  17359. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  17360. result = _Reflect$construct(Super, arguments, NewTarget);
  17361. } else {
  17362. result = Super.apply(this, arguments);
  17363. }
  17364. return (0, _possibleConstructorReturn2.default)(this, result);
  17365. };
  17366. }
  17367. function _isNativeReflectConstruct() {
  17368. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  17369. if (_Reflect$construct.sham) return false;
  17370. if (typeof Proxy === "function") return true;
  17371. try {
  17372. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  17373. return true;
  17374. } catch (e) {
  17375. return false;
  17376. }
  17377. }
  17378. /**
  17379. * Represents a Role on the Parse server. Roles represent groupings of
  17380. * Users for the purposes of granting permissions (e.g. specifying an ACL
  17381. * for an Object). Roles are specified by their sets of child users and
  17382. * child roles, all of which are granted any permissions that the parent
  17383. * role has.
  17384. *
  17385. * <p>Roles must have a name (which cannot be changed after creation of the
  17386. * role), and must specify an ACL.</p>
  17387. *
  17388. * @alias Parse.Role
  17389. * @augments Parse.Object
  17390. */
  17391. var ParseRole = /*#__PURE__*/function (_ParseObject) {
  17392. (0, _inherits2.default)(ParseRole, _ParseObject);
  17393. var _super = _createSuper(ParseRole);
  17394. /**
  17395. * @param {string} name The name of the Role to create.
  17396. * @param {Parse.ACL} acl The ACL for this role. Roles must have an ACL.
  17397. * A Parse.Role is a local representation of a role persisted to the Parse
  17398. * cloud.
  17399. */
  17400. function ParseRole(name
  17401. /*: string*/
  17402. , acl
  17403. /*: ParseACL*/
  17404. ) {
  17405. var _this;
  17406. (0, _classCallCheck2.default)(this, ParseRole);
  17407. _this = _super.call(this, '_Role');
  17408. if (typeof name === 'string' && acl instanceof _ParseACL.default) {
  17409. _this.setName(name);
  17410. _this.setACL(acl);
  17411. }
  17412. return _this;
  17413. }
  17414. /**
  17415. * Gets the name of the role. You can alternatively call role.get("name")
  17416. *
  17417. * @returns {string} the name of the role.
  17418. */
  17419. (0, _createClass2.default)(ParseRole, [{
  17420. key: "getName",
  17421. value: function ()
  17422. /*: ?string*/
  17423. {
  17424. var name = this.get('name');
  17425. if (name == null || typeof name === 'string') {
  17426. return name;
  17427. }
  17428. return '';
  17429. }
  17430. /**
  17431. * Sets the name for a role. This value must be set before the role has
  17432. * been saved to the server, and cannot be set once the role has been
  17433. * saved.
  17434. *
  17435. * <p>
  17436. * A role's name can only contain alphanumeric characters, _, -, and
  17437. * spaces.
  17438. * </p>
  17439. *
  17440. * <p>This is equivalent to calling role.set("name", name)</p>
  17441. *
  17442. * @param {string} name The name of the role.
  17443. * @param {object} options Standard options object with success and error
  17444. * callbacks.
  17445. * @returns {(ParseObject|boolean)} true if the set succeeded.
  17446. */
  17447. }, {
  17448. key: "setName",
  17449. value: function (name
  17450. /*: string*/
  17451. , options
  17452. /*:: ?: mixed*/
  17453. )
  17454. /*: ParseObject | boolean*/
  17455. {
  17456. this._validateName(name);
  17457. return this.set('name', name, options);
  17458. }
  17459. /**
  17460. * Gets the Parse.Relation for the Parse.Users that are direct
  17461. * children of this role. These users are granted any privileges that this
  17462. * role has been granted (e.g. read or write access through ACLs). You can
  17463. * add or remove users from the role through this relation.
  17464. *
  17465. * <p>This is equivalent to calling role.relation("users")</p>
  17466. *
  17467. * @returns {Parse.Relation} the relation for the users belonging to this
  17468. * role.
  17469. */
  17470. }, {
  17471. key: "getUsers",
  17472. value: function ()
  17473. /*: ParseRelation*/
  17474. {
  17475. return this.relation('users');
  17476. }
  17477. /**
  17478. * Gets the Parse.Relation for the Parse.Roles that are direct
  17479. * children of this role. These roles' users are granted any privileges that
  17480. * this role has been granted (e.g. read or write access through ACLs). You
  17481. * can add or remove child roles from this role through this relation.
  17482. *
  17483. * <p>This is equivalent to calling role.relation("roles")</p>
  17484. *
  17485. * @returns {Parse.Relation} the relation for the roles belonging to this
  17486. * role.
  17487. */
  17488. }, {
  17489. key: "getRoles",
  17490. value: function ()
  17491. /*: ParseRelation*/
  17492. {
  17493. return this.relation('roles');
  17494. }
  17495. }, {
  17496. key: "_validateName",
  17497. value: function (newName) {
  17498. if (typeof newName !== 'string') {
  17499. throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name must be a String.");
  17500. }
  17501. if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
  17502. throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.');
  17503. }
  17504. }
  17505. }, {
  17506. key: "validate",
  17507. value: function (attrs
  17508. /*: AttributeMap*/
  17509. , options
  17510. /*:: ?: mixed*/
  17511. )
  17512. /*: ParseError | boolean*/
  17513. {
  17514. var isInvalid = (0, _get2.default)((0, _getPrototypeOf2.default)(ParseRole.prototype), "validate", this).call(this, attrs, options);
  17515. if (isInvalid) {
  17516. return isInvalid;
  17517. }
  17518. if ('name' in attrs && attrs.name !== this.getName()) {
  17519. var newName = attrs.name;
  17520. if (this.id && this.id !== attrs.objectId) {
  17521. // Check to see if the objectId being set matches this.id
  17522. // This happens during a fetch -- the id is set before calling fetch
  17523. // Let the name be set in this case
  17524. return new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
  17525. }
  17526. try {
  17527. this._validateName(newName);
  17528. } catch (e) {
  17529. return e;
  17530. }
  17531. }
  17532. return false;
  17533. }
  17534. }]);
  17535. return ParseRole;
  17536. }(_ParseObject2.default);
  17537. _ParseObject2.default.registerSubclass('_Role', ParseRole);
  17538. var _default = ParseRole;
  17539. exports.default = _default;
  17540. },{"./ParseACL":18,"./ParseError":21,"./ParseObject":26,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/get":126,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136}],32:[function(_dereq_,module,exports){
  17541. "use strict";
  17542. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  17543. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  17544. _Object$defineProperty(exports, "__esModule", {
  17545. value: true
  17546. });
  17547. exports.default = void 0;
  17548. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  17549. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  17550. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  17551. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  17552. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  17553. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  17554. var _ParseCLP = _interopRequireDefault(_dereq_("./ParseCLP"));
  17555. /**
  17556. * Copyright (c) 2015-present, Parse, LLC.
  17557. * All rights reserved.
  17558. *
  17559. * This source code is licensed under the BSD-style license found in the
  17560. * LICENSE file in the root directory of this source tree. An additional grant
  17561. * of patent rights can be found in the PATENTS file in the same directory.
  17562. *
  17563. * @flow
  17564. */
  17565. var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
  17566. /*:: type FieldOptions = {
  17567. required: boolean,
  17568. defaultValue: mixed,
  17569. };*/
  17570. /**
  17571. * A Parse.Schema object is for handling schema data from Parse.
  17572. * <p>All the schemas methods require MasterKey.
  17573. *
  17574. * When adding fields, you may set required and default values. (Requires Parse Server 3.7.0+)
  17575. *
  17576. * <pre>
  17577. * const options = { required: true, defaultValue: 'hello world' };
  17578. * const schema = new Parse.Schema('MyClass');
  17579. * schema.addString('field', options);
  17580. * schema.addIndex('index_name', { 'field': 1 });
  17581. * schema.save();
  17582. * </pre>
  17583. * </p>
  17584. *
  17585. * @alias Parse.Schema
  17586. */
  17587. var ParseSchema = /*#__PURE__*/function () {
  17588. /**
  17589. * @param {string} className Parse Class string.
  17590. */
  17591. function ParseSchema(className
  17592. /*: string*/
  17593. ) {
  17594. (0, _classCallCheck2.default)(this, ParseSchema);
  17595. (0, _defineProperty2.default)(this, "className", void 0);
  17596. (0, _defineProperty2.default)(this, "_fields", void 0);
  17597. (0, _defineProperty2.default)(this, "_indexes", void 0);
  17598. (0, _defineProperty2.default)(this, "_clp", void 0);
  17599. if (typeof className === 'string') {
  17600. if (className === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
  17601. this.className = '_User';
  17602. } else {
  17603. this.className = className;
  17604. }
  17605. }
  17606. this._fields = {};
  17607. this._indexes = {};
  17608. }
  17609. /**
  17610. * Static method to get all schemas
  17611. *
  17612. * @returns {Promise} A promise that is resolved with the result when
  17613. * the query completes.
  17614. */
  17615. (0, _createClass2.default)(ParseSchema, [{
  17616. key: "get",
  17617. value:
  17618. /**
  17619. * Get the Schema from Parse
  17620. *
  17621. * @returns {Promise} A promise that is resolved with the result when
  17622. * the query completes.
  17623. */
  17624. function () {
  17625. this.assertClassName();
  17626. var controller = _CoreManager.default.getSchemaController();
  17627. return controller.get(this.className).then(function (response) {
  17628. if (!response) {
  17629. throw new Error('Schema not found.');
  17630. }
  17631. return response;
  17632. });
  17633. }
  17634. /**
  17635. * Create a new Schema on Parse
  17636. *
  17637. * @returns {Promise} A promise that is resolved with the result when
  17638. * the query completes.
  17639. */
  17640. }, {
  17641. key: "save",
  17642. value: function () {
  17643. this.assertClassName();
  17644. var controller = _CoreManager.default.getSchemaController();
  17645. var params = {
  17646. className: this.className,
  17647. fields: this._fields,
  17648. indexes: this._indexes,
  17649. classLevelPermissions: this._clp
  17650. };
  17651. return controller.create(this.className, params);
  17652. }
  17653. /**
  17654. * Update a Schema on Parse
  17655. *
  17656. * @returns {Promise} A promise that is resolved with the result when
  17657. * the query completes.
  17658. */
  17659. }, {
  17660. key: "update",
  17661. value: function () {
  17662. this.assertClassName();
  17663. var controller = _CoreManager.default.getSchemaController();
  17664. var params = {
  17665. className: this.className,
  17666. fields: this._fields,
  17667. indexes: this._indexes,
  17668. classLevelPermissions: this._clp
  17669. };
  17670. this._fields = {};
  17671. this._indexes = {};
  17672. return controller.update(this.className, params);
  17673. }
  17674. /**
  17675. * Removing a Schema from Parse
  17676. * Can only be used on Schema without objects
  17677. *
  17678. * @returns {Promise} A promise that is resolved with the result when
  17679. * the query completes.
  17680. */
  17681. }, {
  17682. key: "delete",
  17683. value: function () {
  17684. this.assertClassName();
  17685. var controller = _CoreManager.default.getSchemaController();
  17686. return controller.delete(this.className);
  17687. }
  17688. /**
  17689. * Removes all objects from a Schema (class) in Parse.
  17690. * EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
  17691. *
  17692. * @returns {Promise} A promise that is resolved with the result when
  17693. * the query completes.
  17694. */
  17695. }, {
  17696. key: "purge",
  17697. value: function () {
  17698. this.assertClassName();
  17699. var controller = _CoreManager.default.getSchemaController();
  17700. return controller.purge(this.className);
  17701. }
  17702. /**
  17703. * Assert if ClassName has been filled
  17704. *
  17705. * @private
  17706. */
  17707. }, {
  17708. key: "assertClassName",
  17709. value: function () {
  17710. if (!this.className) {
  17711. throw new Error('You must set a Class Name before making any request.');
  17712. }
  17713. }
  17714. /**
  17715. * Sets Class Level Permissions when creating / updating a Schema.
  17716. * EXERCISE CAUTION, running this may override CLP for this schema and cannot be reversed
  17717. *
  17718. * @param {object | Parse.CLP} clp Class Level Permissions
  17719. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17720. */
  17721. }, {
  17722. key: "setCLP",
  17723. value: function (clp
  17724. /*: PermissionsMap | ParseCLP*/
  17725. ) {
  17726. if (clp instanceof _ParseCLP.default) {
  17727. this._clp = clp.toJSON();
  17728. } else {
  17729. this._clp = clp;
  17730. }
  17731. return this;
  17732. }
  17733. /**
  17734. * Adding a Field to Create / Update a Schema
  17735. *
  17736. * @param {string} name Name of the field that will be created on Parse
  17737. * @param {string} type Can be a (String|Number|Boolean|Date|Parse.File|Parse.GeoPoint|Array|Object|Pointer|Parse.Relation)
  17738. * @param {object} options
  17739. * Valid options are:<ul>
  17740. * <li>required: If field is not set, save operation fails (Requires Parse Server 3.7.0+)
  17741. * <li>defaultValue: If field is not set, a default value is selected (Requires Parse Server 3.7.0+)
  17742. * <li>targetClass: Required if type is Pointer or Parse.Relation
  17743. * </ul>
  17744. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17745. */
  17746. }, {
  17747. key: "addField",
  17748. value: function (name
  17749. /*: string*/
  17750. , type
  17751. /*: string*/
  17752. ) {
  17753. var options
  17754. /*: FieldOptions*/
  17755. = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  17756. type = type || 'String';
  17757. if (!name) {
  17758. throw new Error('field name may not be null.');
  17759. }
  17760. if ((0, _indexOf.default)(FIELD_TYPES).call(FIELD_TYPES, type) === -1) {
  17761. throw new Error("".concat(type, " is not a valid type."));
  17762. }
  17763. if (type === 'Pointer') {
  17764. return this.addPointer(name, options.targetClass, options);
  17765. }
  17766. if (type === 'Relation') {
  17767. return this.addRelation(name, options.targetClass, options);
  17768. }
  17769. var fieldOptions = {
  17770. type: type
  17771. };
  17772. if (typeof options.required === 'boolean') {
  17773. fieldOptions.required = options.required;
  17774. }
  17775. if (options.defaultValue !== undefined) {
  17776. fieldOptions.defaultValue = options.defaultValue;
  17777. }
  17778. if (type === 'Date') {
  17779. if (options && options.defaultValue) {
  17780. fieldOptions.defaultValue = {
  17781. __type: 'Date',
  17782. iso: new Date(options.defaultValue)
  17783. };
  17784. }
  17785. }
  17786. this._fields[name] = fieldOptions;
  17787. return this;
  17788. }
  17789. /**
  17790. * Adding an Index to Create / Update a Schema
  17791. *
  17792. * @param {string} name Name of the index
  17793. * @param {object} index { field: value }
  17794. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17795. *
  17796. * <pre>
  17797. * schema.addIndex('index_name', { 'field': 1 });
  17798. * </pre>
  17799. */
  17800. }, {
  17801. key: "addIndex",
  17802. value: function (name
  17803. /*: string*/
  17804. , index
  17805. /*: any*/
  17806. ) {
  17807. if (!name) {
  17808. throw new Error('index name may not be null.');
  17809. }
  17810. if (!index) {
  17811. throw new Error('index may not be null.');
  17812. }
  17813. this._indexes[name] = index;
  17814. return this;
  17815. }
  17816. /**
  17817. * Adding String Field
  17818. *
  17819. * @param {string} name Name of the field that will be created on Parse
  17820. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17821. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17822. */
  17823. }, {
  17824. key: "addString",
  17825. value: function (name
  17826. /*: string*/
  17827. , options
  17828. /*: FieldOptions*/
  17829. ) {
  17830. return this.addField(name, 'String', options);
  17831. }
  17832. /**
  17833. * Adding Number Field
  17834. *
  17835. * @param {string} name Name of the field that will be created on Parse
  17836. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17837. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17838. */
  17839. }, {
  17840. key: "addNumber",
  17841. value: function (name
  17842. /*: string*/
  17843. , options
  17844. /*: FieldOptions*/
  17845. ) {
  17846. return this.addField(name, 'Number', options);
  17847. }
  17848. /**
  17849. * Adding Boolean Field
  17850. *
  17851. * @param {string} name Name of the field that will be created on Parse
  17852. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17853. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17854. */
  17855. }, {
  17856. key: "addBoolean",
  17857. value: function (name
  17858. /*: string*/
  17859. , options
  17860. /*: FieldOptions*/
  17861. ) {
  17862. return this.addField(name, 'Boolean', options);
  17863. }
  17864. /**
  17865. * Adding Date Field
  17866. *
  17867. * @param {string} name Name of the field that will be created on Parse
  17868. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17869. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17870. */
  17871. }, {
  17872. key: "addDate",
  17873. value: function (name
  17874. /*: string*/
  17875. , options
  17876. /*: FieldOptions*/
  17877. ) {
  17878. return this.addField(name, 'Date', options);
  17879. }
  17880. /**
  17881. * Adding File Field
  17882. *
  17883. * @param {string} name Name of the field that will be created on Parse
  17884. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17885. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17886. */
  17887. }, {
  17888. key: "addFile",
  17889. value: function (name
  17890. /*: string*/
  17891. , options
  17892. /*: FieldOptions*/
  17893. ) {
  17894. return this.addField(name, 'File', options);
  17895. }
  17896. /**
  17897. * Adding GeoPoint Field
  17898. *
  17899. * @param {string} name Name of the field that will be created on Parse
  17900. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17901. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17902. */
  17903. }, {
  17904. key: "addGeoPoint",
  17905. value: function (name
  17906. /*: string*/
  17907. , options
  17908. /*: FieldOptions*/
  17909. ) {
  17910. return this.addField(name, 'GeoPoint', options);
  17911. }
  17912. /**
  17913. * Adding Polygon Field
  17914. *
  17915. * @param {string} name Name of the field that will be created on Parse
  17916. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17917. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17918. */
  17919. }, {
  17920. key: "addPolygon",
  17921. value: function (name
  17922. /*: string*/
  17923. , options
  17924. /*: FieldOptions*/
  17925. ) {
  17926. return this.addField(name, 'Polygon', options);
  17927. }
  17928. /**
  17929. * Adding Array Field
  17930. *
  17931. * @param {string} name Name of the field that will be created on Parse
  17932. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17933. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17934. */
  17935. }, {
  17936. key: "addArray",
  17937. value: function (name
  17938. /*: string*/
  17939. , options
  17940. /*: FieldOptions*/
  17941. ) {
  17942. return this.addField(name, 'Array', options);
  17943. }
  17944. /**
  17945. * Adding Object Field
  17946. *
  17947. * @param {string} name Name of the field that will be created on Parse
  17948. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17949. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17950. */
  17951. }, {
  17952. key: "addObject",
  17953. value: function (name
  17954. /*: string*/
  17955. , options
  17956. /*: FieldOptions*/
  17957. ) {
  17958. return this.addField(name, 'Object', options);
  17959. }
  17960. /**
  17961. * Adding Pointer Field
  17962. *
  17963. * @param {string} name Name of the field that will be created on Parse
  17964. * @param {string} targetClass Name of the target Pointer Class
  17965. * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
  17966. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  17967. */
  17968. }, {
  17969. key: "addPointer",
  17970. value: function (name
  17971. /*: string*/
  17972. , targetClass
  17973. /*: string*/
  17974. ) {
  17975. var options
  17976. /*: FieldOptions*/
  17977. = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  17978. if (!name) {
  17979. throw new Error('field name may not be null.');
  17980. }
  17981. if (!targetClass) {
  17982. throw new Error('You need to set the targetClass of the Pointer.');
  17983. }
  17984. var fieldOptions = {
  17985. type: 'Pointer',
  17986. targetClass: targetClass
  17987. };
  17988. if (typeof options.required === 'boolean') {
  17989. fieldOptions.required = options.required;
  17990. }
  17991. if (options.defaultValue !== undefined) {
  17992. fieldOptions.defaultValue = options.defaultValue;
  17993. if (options.defaultValue instanceof _ParseObject.default) {
  17994. fieldOptions.defaultValue = options.defaultValue.toPointer();
  17995. }
  17996. }
  17997. this._fields[name] = fieldOptions;
  17998. return this;
  17999. }
  18000. /**
  18001. * Adding Relation Field
  18002. *
  18003. * @param {string} name Name of the field that will be created on Parse
  18004. * @param {string} targetClass Name of the target Pointer Class
  18005. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  18006. */
  18007. }, {
  18008. key: "addRelation",
  18009. value: function (name
  18010. /*: string*/
  18011. , targetClass
  18012. /*: string*/
  18013. ) {
  18014. if (!name) {
  18015. throw new Error('field name may not be null.');
  18016. }
  18017. if (!targetClass) {
  18018. throw new Error('You need to set the targetClass of the Relation.');
  18019. }
  18020. this._fields[name] = {
  18021. type: 'Relation',
  18022. targetClass: targetClass
  18023. };
  18024. return this;
  18025. }
  18026. /**
  18027. * Deleting a Field to Update on a Schema
  18028. *
  18029. * @param {string} name Name of the field
  18030. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  18031. */
  18032. }, {
  18033. key: "deleteField",
  18034. value: function (name
  18035. /*: string*/
  18036. ) {
  18037. this._fields[name] = {
  18038. __op: 'Delete'
  18039. };
  18040. return this;
  18041. }
  18042. /**
  18043. * Deleting an Index to Update on a Schema
  18044. *
  18045. * @param {string} name Name of the field
  18046. * @returns {Parse.Schema} Returns the schema, so you can chain this call.
  18047. */
  18048. }, {
  18049. key: "deleteIndex",
  18050. value: function (name
  18051. /*: string*/
  18052. ) {
  18053. this._indexes[name] = {
  18054. __op: 'Delete'
  18055. };
  18056. return this;
  18057. }
  18058. }], [{
  18059. key: "all",
  18060. value: function () {
  18061. var controller = _CoreManager.default.getSchemaController();
  18062. return controller.get('').then(function (response) {
  18063. if (response.results.length === 0) {
  18064. throw new Error('Schema not found.');
  18065. }
  18066. return response.results;
  18067. });
  18068. }
  18069. }]);
  18070. return ParseSchema;
  18071. }();
  18072. var DefaultController = {
  18073. send: function (className
  18074. /*: string*/
  18075. , method
  18076. /*: string*/
  18077. )
  18078. /*: Promise*/
  18079. {
  18080. var params
  18081. /*: any*/
  18082. = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  18083. var RESTController = _CoreManager.default.getRESTController();
  18084. return RESTController.request(method, "schemas/".concat(className), params, {
  18085. useMasterKey: true
  18086. });
  18087. },
  18088. get: function (className
  18089. /*: string*/
  18090. )
  18091. /*: Promise*/
  18092. {
  18093. return this.send(className, 'GET');
  18094. },
  18095. create: function (className
  18096. /*: string*/
  18097. , params
  18098. /*: any*/
  18099. )
  18100. /*: Promise*/
  18101. {
  18102. return this.send(className, 'POST', params);
  18103. },
  18104. update: function (className
  18105. /*: string*/
  18106. , params
  18107. /*: any*/
  18108. )
  18109. /*: Promise*/
  18110. {
  18111. return this.send(className, 'PUT', params);
  18112. },
  18113. delete: function (className
  18114. /*: string*/
  18115. )
  18116. /*: Promise*/
  18117. {
  18118. return this.send(className, 'DELETE');
  18119. },
  18120. purge: function (className
  18121. /*: string*/
  18122. )
  18123. /*: Promise*/
  18124. {
  18125. var RESTController = _CoreManager.default.getRESTController();
  18126. return RESTController.request('DELETE', "purge/".concat(className), {}, {
  18127. useMasterKey: true
  18128. });
  18129. }
  18130. };
  18131. _CoreManager.default.setSchemaController(DefaultController);
  18132. var _default = ParseSchema;
  18133. exports.default = _default;
  18134. },{"./CoreManager":4,"./ParseCLP":19,"./ParseObject":26,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],33:[function(_dereq_,module,exports){
  18135. "use strict";
  18136. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  18137. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  18138. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  18139. _Object$defineProperty(exports, "__esModule", {
  18140. value: true
  18141. });
  18142. exports.default = void 0;
  18143. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  18144. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  18145. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  18146. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  18147. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  18148. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  18149. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  18150. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  18151. var _isRevocableSession = _interopRequireDefault(_dereq_("./isRevocableSession"));
  18152. var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
  18153. var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
  18154. function _createSuper(Derived) {
  18155. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  18156. return function () {
  18157. var Super = (0, _getPrototypeOf2.default)(Derived),
  18158. result;
  18159. if (hasNativeReflectConstruct) {
  18160. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  18161. result = _Reflect$construct(Super, arguments, NewTarget);
  18162. } else {
  18163. result = Super.apply(this, arguments);
  18164. }
  18165. return (0, _possibleConstructorReturn2.default)(this, result);
  18166. };
  18167. }
  18168. function _isNativeReflectConstruct() {
  18169. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  18170. if (_Reflect$construct.sham) return false;
  18171. if (typeof Proxy === "function") return true;
  18172. try {
  18173. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  18174. return true;
  18175. } catch (e) {
  18176. return false;
  18177. }
  18178. }
  18179. /**
  18180. * <p>A Parse.Session object is a local representation of a revocable session.
  18181. * This class is a subclass of a Parse.Object, and retains the same
  18182. * functionality of a Parse.Object.</p>
  18183. *
  18184. * @alias Parse.Session
  18185. * @augments Parse.Object
  18186. */
  18187. var ParseSession = /*#__PURE__*/function (_ParseObject) {
  18188. (0, _inherits2.default)(ParseSession, _ParseObject);
  18189. var _super = _createSuper(ParseSession);
  18190. /**
  18191. * @param {object} attributes The initial set of data to store in the user.
  18192. */
  18193. function ParseSession(attributes
  18194. /*: ?AttributeMap*/
  18195. ) {
  18196. var _this;
  18197. (0, _classCallCheck2.default)(this, ParseSession);
  18198. _this = _super.call(this, '_Session');
  18199. if (attributes && (0, _typeof2.default)(attributes) === 'object') {
  18200. if (!_this.set(attributes || {})) {
  18201. throw new Error("Can't create an invalid Session");
  18202. }
  18203. }
  18204. return _this;
  18205. }
  18206. /**
  18207. * Returns the session token string.
  18208. *
  18209. * @returns {string}
  18210. */
  18211. (0, _createClass2.default)(ParseSession, [{
  18212. key: "getSessionToken",
  18213. value: function ()
  18214. /*: string*/
  18215. {
  18216. var token = this.get('sessionToken');
  18217. if (typeof token === 'string') {
  18218. return token;
  18219. }
  18220. return '';
  18221. }
  18222. }], [{
  18223. key: "readOnlyAttributes",
  18224. value: function () {
  18225. return ['createdWith', 'expiresAt', 'installationId', 'restricted', 'sessionToken', 'user'];
  18226. }
  18227. /**
  18228. * Retrieves the Session object for the currently logged in session.
  18229. *
  18230. * @param {object} options useMasterKey
  18231. * @static
  18232. * @returns {Promise} A promise that is resolved with the Parse.Session
  18233. * object after it has been fetched. If there is no current user, the
  18234. * promise will be rejected.
  18235. */
  18236. }, {
  18237. key: "current",
  18238. value: function (options
  18239. /*: FullOptions*/
  18240. ) {
  18241. options = options || {};
  18242. var controller = _CoreManager.default.getSessionController();
  18243. var sessionOptions = {};
  18244. if (options.hasOwnProperty('useMasterKey')) {
  18245. sessionOptions.useMasterKey = options.useMasterKey;
  18246. }
  18247. return _ParseUser.default.currentAsync().then(function (user) {
  18248. if (!user) {
  18249. return _promise.default.reject('There is no current user.');
  18250. }
  18251. sessionOptions.sessionToken = user.getSessionToken();
  18252. return controller.getSession(sessionOptions);
  18253. });
  18254. }
  18255. /**
  18256. * Determines whether the current session token is revocable.
  18257. * This method is useful for migrating Express.js or Node.js web apps to
  18258. * use revocable sessions. If you are migrating an app that uses the Parse
  18259. * SDK in the browser only, please use Parse.User.enableRevocableSession()
  18260. * instead, so that sessions can be automatically upgraded.
  18261. *
  18262. * @static
  18263. * @returns {boolean}
  18264. */
  18265. }, {
  18266. key: "isCurrentSessionRevocable",
  18267. value: function ()
  18268. /*: boolean*/
  18269. {
  18270. var currentUser = _ParseUser.default.current();
  18271. if (currentUser) {
  18272. return (0, _isRevocableSession.default)(currentUser.getSessionToken() || '');
  18273. }
  18274. return false;
  18275. }
  18276. }]);
  18277. return ParseSession;
  18278. }(_ParseObject2.default);
  18279. _ParseObject2.default.registerSubclass('_Session', ParseSession);
  18280. var DefaultController = {
  18281. getSession: function (options
  18282. /*: RequestOptions*/
  18283. )
  18284. /*: Promise<ParseSession>*/
  18285. {
  18286. var RESTController = _CoreManager.default.getRESTController();
  18287. var session = new ParseSession();
  18288. return RESTController.request('GET', 'sessions/me', {}, options).then(function (sessionData) {
  18289. session._finishFetch(sessionData);
  18290. session._setExisted(true);
  18291. return session;
  18292. });
  18293. }
  18294. };
  18295. _CoreManager.default.setSessionController(DefaultController);
  18296. var _default = ParseSession;
  18297. exports.default = _default;
  18298. },{"./CoreManager":4,"./ParseObject":26,"./ParseUser":34,"./isRevocableSession":50,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/typeof":141}],34:[function(_dereq_,module,exports){
  18299. "use strict";
  18300. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  18301. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
  18302. var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
  18303. var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
  18304. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
  18305. var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  18306. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  18307. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
  18308. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
  18309. var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  18310. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
  18311. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
  18312. _Object$defineProperty2(exports, "__esModule", {
  18313. value: true
  18314. });
  18315. exports.default = void 0;
  18316. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  18317. var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
  18318. var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  18319. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  18320. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  18321. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  18322. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  18323. var _get2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/get"));
  18324. var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
  18325. var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
  18326. var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
  18327. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  18328. var _isRevocableSession = _interopRequireDefault(_dereq_("./isRevocableSession"));
  18329. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  18330. var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
  18331. var _ParseSession = _interopRequireDefault(_dereq_("./ParseSession"));
  18332. var _Storage = _interopRequireDefault(_dereq_("./Storage"));
  18333. function _regeneratorRuntime() {
  18334. "use strict";
  18335. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  18336. _regeneratorRuntime = function () {
  18337. return exports;
  18338. };
  18339. var exports = {},
  18340. Op = Object.prototype,
  18341. hasOwn = Op.hasOwnProperty,
  18342. $Symbol = "function" == typeof _Symbol ? _Symbol : {},
  18343. iteratorSymbol = $Symbol.iterator || "@@iterator",
  18344. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  18345. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  18346. function define(obj, key, value) {
  18347. return _Object$defineProperty2(obj, key, {
  18348. value: value,
  18349. enumerable: !0,
  18350. configurable: !0,
  18351. writable: !0
  18352. }), obj[key];
  18353. }
  18354. try {
  18355. define({}, "");
  18356. } catch (err) {
  18357. define = function (obj, key, value) {
  18358. return obj[key] = value;
  18359. };
  18360. }
  18361. function wrap(innerFn, outerFn, self, tryLocsList) {
  18362. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  18363. generator = _Object$create(protoGenerator.prototype),
  18364. context = new Context(tryLocsList || []);
  18365. return generator._invoke = function (innerFn, self, context) {
  18366. var state = "suspendedStart";
  18367. return function (method, arg) {
  18368. if ("executing" === state) throw new Error("Generator is already running");
  18369. if ("completed" === state) {
  18370. if ("throw" === method) throw arg;
  18371. return doneResult();
  18372. }
  18373. for (context.method = method, context.arg = arg;;) {
  18374. var delegate = context.delegate;
  18375. if (delegate) {
  18376. var delegateResult = maybeInvokeDelegate(delegate, context);
  18377. if (delegateResult) {
  18378. if (delegateResult === ContinueSentinel) continue;
  18379. return delegateResult;
  18380. }
  18381. }
  18382. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  18383. if ("suspendedStart" === state) throw state = "completed", context.arg;
  18384. context.dispatchException(context.arg);
  18385. } else "return" === context.method && context.abrupt("return", context.arg);
  18386. state = "executing";
  18387. var record = tryCatch(innerFn, self, context);
  18388. if ("normal" === record.type) {
  18389. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  18390. return {
  18391. value: record.arg,
  18392. done: context.done
  18393. };
  18394. }
  18395. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  18396. }
  18397. };
  18398. }(innerFn, self, context), generator;
  18399. }
  18400. function tryCatch(fn, obj, arg) {
  18401. try {
  18402. return {
  18403. type: "normal",
  18404. arg: fn.call(obj, arg)
  18405. };
  18406. } catch (err) {
  18407. return {
  18408. type: "throw",
  18409. arg: err
  18410. };
  18411. }
  18412. }
  18413. exports.wrap = wrap;
  18414. var ContinueSentinel = {};
  18415. function Generator() {}
  18416. function GeneratorFunction() {}
  18417. function GeneratorFunctionPrototype() {}
  18418. var IteratorPrototype = {};
  18419. define(IteratorPrototype, iteratorSymbol, function () {
  18420. return this;
  18421. });
  18422. var getProto = _Object$getPrototypeOf,
  18423. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  18424. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  18425. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
  18426. function defineIteratorMethods(prototype) {
  18427. var _context7;
  18428. _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, function (method) {
  18429. define(prototype, method, function (arg) {
  18430. return this._invoke(method, arg);
  18431. });
  18432. });
  18433. }
  18434. function AsyncIterator(generator, PromiseImpl) {
  18435. function invoke(method, arg, resolve, reject) {
  18436. var record = tryCatch(generator[method], generator, arg);
  18437. if ("throw" !== record.type) {
  18438. var result = record.arg,
  18439. value = result.value;
  18440. return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  18441. invoke("next", value, resolve, reject);
  18442. }, function (err) {
  18443. invoke("throw", err, resolve, reject);
  18444. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  18445. result.value = unwrapped, resolve(result);
  18446. }, function (error) {
  18447. return invoke("throw", error, resolve, reject);
  18448. });
  18449. }
  18450. reject(record.arg);
  18451. }
  18452. var previousPromise;
  18453. this._invoke = function (method, arg) {
  18454. function callInvokeWithMethodAndArg() {
  18455. return new PromiseImpl(function (resolve, reject) {
  18456. invoke(method, arg, resolve, reject);
  18457. });
  18458. }
  18459. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  18460. };
  18461. }
  18462. function maybeInvokeDelegate(delegate, context) {
  18463. var method = delegate.iterator[context.method];
  18464. if (undefined === method) {
  18465. if (context.delegate = null, "throw" === context.method) {
  18466. if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
  18467. context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
  18468. }
  18469. return ContinueSentinel;
  18470. }
  18471. var record = tryCatch(method, delegate.iterator, context.arg);
  18472. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  18473. var info = record.arg;
  18474. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  18475. }
  18476. function pushTryEntry(locs) {
  18477. var entry = {
  18478. tryLoc: locs[0]
  18479. };
  18480. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  18481. }
  18482. function resetTryEntry(entry) {
  18483. var record = entry.completion || {};
  18484. record.type = "normal", delete record.arg, entry.completion = record;
  18485. }
  18486. function Context(tryLocsList) {
  18487. this.tryEntries = [{
  18488. tryLoc: "root"
  18489. }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
  18490. }
  18491. function values(iterable) {
  18492. if (iterable) {
  18493. var iteratorMethod = iterable[iteratorSymbol];
  18494. if (iteratorMethod) return iteratorMethod.call(iterable);
  18495. if ("function" == typeof iterable.next) return iterable;
  18496. if (!isNaN(iterable.length)) {
  18497. var i = -1,
  18498. next = function next() {
  18499. for (; ++i < iterable.length;) {
  18500. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  18501. }
  18502. return next.value = undefined, next.done = !0, next;
  18503. };
  18504. return next.next = next;
  18505. }
  18506. }
  18507. return {
  18508. next: doneResult
  18509. };
  18510. }
  18511. function doneResult() {
  18512. return {
  18513. value: undefined,
  18514. done: !0
  18515. };
  18516. }
  18517. return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  18518. var ctor = "function" == typeof genFun && genFun.constructor;
  18519. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  18520. }, exports.mark = function (genFun) {
  18521. return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
  18522. }, exports.awrap = function (arg) {
  18523. return {
  18524. __await: arg
  18525. };
  18526. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  18527. return this;
  18528. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  18529. void 0 === PromiseImpl && (PromiseImpl = _Promise2);
  18530. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  18531. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  18532. return result.done ? result.value : iter.next();
  18533. });
  18534. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  18535. return this;
  18536. }), define(Gp, "toString", function () {
  18537. return "[object Generator]";
  18538. }), exports.keys = function (object) {
  18539. var keys = [];
  18540. for (var key in object) {
  18541. keys.push(key);
  18542. }
  18543. return _reverseInstanceProperty(keys).call(keys), function next() {
  18544. for (; keys.length;) {
  18545. var key = keys.pop();
  18546. if (key in object) return next.value = key, next.done = !1, next;
  18547. }
  18548. return next.done = !0, next;
  18549. };
  18550. }, exports.values = values, Context.prototype = {
  18551. constructor: Context,
  18552. reset: function (skipTempReset) {
  18553. var _context8;
  18554. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) {
  18555. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
  18556. }
  18557. },
  18558. stop: function () {
  18559. this.done = !0;
  18560. var rootRecord = this.tryEntries[0].completion;
  18561. if ("throw" === rootRecord.type) throw rootRecord.arg;
  18562. return this.rval;
  18563. },
  18564. dispatchException: function (exception) {
  18565. if (this.done) throw exception;
  18566. var context = this;
  18567. function handle(loc, caught) {
  18568. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  18569. }
  18570. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  18571. var entry = this.tryEntries[i],
  18572. record = entry.completion;
  18573. if ("root" === entry.tryLoc) return handle("end");
  18574. if (entry.tryLoc <= this.prev) {
  18575. var hasCatch = hasOwn.call(entry, "catchLoc"),
  18576. hasFinally = hasOwn.call(entry, "finallyLoc");
  18577. if (hasCatch && hasFinally) {
  18578. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  18579. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  18580. } else if (hasCatch) {
  18581. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  18582. } else {
  18583. if (!hasFinally) throw new Error("try statement without catch or finally");
  18584. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  18585. }
  18586. }
  18587. }
  18588. },
  18589. abrupt: function (type, arg) {
  18590. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  18591. var entry = this.tryEntries[i];
  18592. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  18593. var finallyEntry = entry;
  18594. break;
  18595. }
  18596. }
  18597. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  18598. var record = finallyEntry ? finallyEntry.completion : {};
  18599. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  18600. },
  18601. complete: function (record, afterLoc) {
  18602. if ("throw" === record.type) throw record.arg;
  18603. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  18604. },
  18605. finish: function (finallyLoc) {
  18606. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  18607. var entry = this.tryEntries[i];
  18608. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  18609. }
  18610. },
  18611. catch: function (tryLoc) {
  18612. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  18613. var entry = this.tryEntries[i];
  18614. if (entry.tryLoc === tryLoc) {
  18615. var record = entry.completion;
  18616. if ("throw" === record.type) {
  18617. var thrown = record.arg;
  18618. resetTryEntry(entry);
  18619. }
  18620. return thrown;
  18621. }
  18622. }
  18623. throw new Error("illegal catch attempt");
  18624. },
  18625. delegateYield: function (iterable, resultName, nextLoc) {
  18626. return this.delegate = {
  18627. iterator: values(iterable),
  18628. resultName: resultName,
  18629. nextLoc: nextLoc
  18630. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  18631. }
  18632. }, exports;
  18633. }
  18634. function _createSuper(Derived) {
  18635. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  18636. return function () {
  18637. var Super = (0, _getPrototypeOf2.default)(Derived),
  18638. result;
  18639. if (hasNativeReflectConstruct) {
  18640. var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
  18641. result = _Reflect$construct(Super, arguments, NewTarget);
  18642. } else {
  18643. result = Super.apply(this, arguments);
  18644. }
  18645. return (0, _possibleConstructorReturn2.default)(this, result);
  18646. };
  18647. }
  18648. function _isNativeReflectConstruct() {
  18649. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  18650. if (_Reflect$construct.sham) return false;
  18651. if (typeof Proxy === "function") return true;
  18652. try {
  18653. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  18654. return true;
  18655. } catch (e) {
  18656. return false;
  18657. }
  18658. }
  18659. var CURRENT_USER_KEY = 'currentUser';
  18660. var canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
  18661. var currentUserCacheMatchesDisk = false;
  18662. var currentUserCache = null;
  18663. var authProviders = {};
  18664. /**
  18665. * <p>A Parse.User object is a local representation of a user persisted to the
  18666. * Parse cloud. This class is a subclass of a Parse.Object, and retains the
  18667. * same functionality of a Parse.Object, but also extends it with various
  18668. * user specific methods, like authentication, signing up, and validation of
  18669. * uniqueness.</p>
  18670. *
  18671. * @alias Parse.User
  18672. * @augments Parse.Object
  18673. */
  18674. var ParseUser = /*#__PURE__*/function (_ParseObject) {
  18675. (0, _inherits2.default)(ParseUser, _ParseObject);
  18676. var _super = _createSuper(ParseUser);
  18677. /**
  18678. * @param {object} attributes The initial set of data to store in the user.
  18679. */
  18680. function ParseUser(attributes
  18681. /*: ?AttributeMap*/
  18682. ) {
  18683. var _this;
  18684. (0, _classCallCheck2.default)(this, ParseUser);
  18685. _this = _super.call(this, '_User');
  18686. if (attributes && (0, _typeof2.default)(attributes) === 'object') {
  18687. if (!_this.set(attributes || {})) {
  18688. throw new Error("Can't create an invalid Parse User");
  18689. }
  18690. }
  18691. return _this;
  18692. }
  18693. /**
  18694. * Request a revocable session token to replace the older style of token.
  18695. *
  18696. * @param {object} options
  18697. * @returns {Promise} A promise that is resolved when the replacement
  18698. * token has been fetched.
  18699. */
  18700. (0, _createClass2.default)(ParseUser, [{
  18701. key: "_upgradeToRevocableSession",
  18702. value: function (options
  18703. /*: RequestOptions*/
  18704. )
  18705. /*: Promise<void>*/
  18706. {
  18707. options = options || {};
  18708. var upgradeOptions = {};
  18709. if (options.hasOwnProperty('useMasterKey')) {
  18710. upgradeOptions.useMasterKey = options.useMasterKey;
  18711. }
  18712. var controller = _CoreManager.default.getUserController();
  18713. return controller.upgradeToRevocableSession(this, upgradeOptions);
  18714. }
  18715. /**
  18716. * Parse allows you to link your users with {@link https://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication 3rd party authentication}, enabling
  18717. * your users to sign up or log into your application using their existing identities.
  18718. * Since 2.9.0
  18719. *
  18720. * @see {@link https://docs.parseplatform.org/js/guide/#linking-users Linking Users}
  18721. * @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
  18722. * @param {object} options
  18723. * <ul>
  18724. * <li>If provider is string, options is {@link http://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications authData}
  18725. * <li>If provider is AuthProvider, options is saveOpts
  18726. * </ul>
  18727. * @param {object} saveOpts useMasterKey / sessionToken
  18728. * @returns {Promise} A promise that is fulfilled with the user is linked
  18729. */
  18730. }, {
  18731. key: "linkWith",
  18732. value: function (provider
  18733. /*: any*/
  18734. , options
  18735. /*: { authData?: AuthData }*/
  18736. )
  18737. /*: Promise<ParseUser>*/
  18738. {
  18739. var _this2 = this;
  18740. var saveOpts
  18741. /*:: ?: FullOptions*/
  18742. = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  18743. saveOpts.sessionToken = saveOpts.sessionToken || this.getSessionToken() || '';
  18744. var authType;
  18745. if (typeof provider === 'string') {
  18746. authType = provider;
  18747. if (authProviders[provider]) {
  18748. provider = authProviders[provider];
  18749. } else {
  18750. var authProvider = {
  18751. restoreAuthentication: function () {
  18752. return true;
  18753. },
  18754. getAuthType: function () {
  18755. return authType;
  18756. }
  18757. };
  18758. authProviders[authProvider.getAuthType()] = authProvider;
  18759. provider = authProvider;
  18760. }
  18761. } else {
  18762. authType = provider.getAuthType();
  18763. }
  18764. if (options && options.hasOwnProperty('authData')) {
  18765. var authData = this.get('authData') || {};
  18766. if ((0, _typeof2.default)(authData) !== 'object') {
  18767. throw new Error('Invalid type: authData field should be an object');
  18768. }
  18769. authData[authType] = options.authData;
  18770. var controller = _CoreManager.default.getUserController();
  18771. return controller.linkWith(this, authData, saveOpts);
  18772. } else {
  18773. return new _promise.default(function (resolve, reject) {
  18774. provider.authenticate({
  18775. success: function (provider, result) {
  18776. var opts = {};
  18777. opts.authData = result;
  18778. _this2.linkWith(provider, opts, saveOpts).then(function () {
  18779. resolve(_this2);
  18780. }, function (error) {
  18781. reject(error);
  18782. });
  18783. },
  18784. error: function (provider, _error) {
  18785. reject(_error);
  18786. }
  18787. });
  18788. });
  18789. }
  18790. }
  18791. /**
  18792. * @param provider
  18793. * @param options
  18794. * @param saveOpts
  18795. * @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
  18796. * @returns {Promise}
  18797. */
  18798. }, {
  18799. key: "_linkWith",
  18800. value: function (provider
  18801. /*: any*/
  18802. , options
  18803. /*: { authData?: AuthData }*/
  18804. )
  18805. /*: Promise<ParseUser>*/
  18806. {
  18807. var saveOpts
  18808. /*:: ?: FullOptions*/
  18809. = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  18810. return this.linkWith(provider, options, saveOpts);
  18811. }
  18812. /**
  18813. * Synchronizes auth data for a provider (e.g. puts the access token in the
  18814. * right place to be used by the Facebook SDK).
  18815. *
  18816. * @param provider
  18817. */
  18818. }, {
  18819. key: "_synchronizeAuthData",
  18820. value: function (provider
  18821. /*: string*/
  18822. ) {
  18823. if (!this.isCurrent() || !provider) {
  18824. return;
  18825. }
  18826. var authType;
  18827. if (typeof provider === 'string') {
  18828. authType = provider;
  18829. provider = authProviders[authType];
  18830. } else {
  18831. authType = provider.getAuthType();
  18832. }
  18833. var authData = this.get('authData');
  18834. if (!provider || !authData || (0, _typeof2.default)(authData) !== 'object') {
  18835. return;
  18836. }
  18837. var success = provider.restoreAuthentication(authData[authType]);
  18838. if (!success) {
  18839. this._unlinkFrom(provider);
  18840. }
  18841. }
  18842. /**
  18843. * Synchronizes authData for all providers.
  18844. */
  18845. }, {
  18846. key: "_synchronizeAllAuthData",
  18847. value: function () {
  18848. var authData = this.get('authData');
  18849. if ((0, _typeof2.default)(authData) !== 'object') {
  18850. return;
  18851. }
  18852. for (var _key in authData) {
  18853. this._synchronizeAuthData(_key);
  18854. }
  18855. }
  18856. /**
  18857. * Removes null values from authData (which exist temporarily for unlinking)
  18858. */
  18859. }, {
  18860. key: "_cleanupAuthData",
  18861. value: function () {
  18862. if (!this.isCurrent()) {
  18863. return;
  18864. }
  18865. var authData = this.get('authData');
  18866. if ((0, _typeof2.default)(authData) !== 'object') {
  18867. return;
  18868. }
  18869. for (var _key2 in authData) {
  18870. if (!authData[_key2]) {
  18871. delete authData[_key2];
  18872. }
  18873. }
  18874. }
  18875. /**
  18876. * Unlinks a user from a service.
  18877. *
  18878. * @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
  18879. * @param {object} options MasterKey / SessionToken
  18880. * @returns {Promise} A promise that is fulfilled when the unlinking
  18881. * finishes.
  18882. */
  18883. }, {
  18884. key: "_unlinkFrom",
  18885. value: function (provider
  18886. /*: any*/
  18887. , options
  18888. /*:: ?: FullOptions*/
  18889. )
  18890. /*: Promise<ParseUser>*/
  18891. {
  18892. var _this3 = this;
  18893. return this.linkWith(provider, {
  18894. authData: null
  18895. }, options).then(function () {
  18896. _this3._synchronizeAuthData(provider);
  18897. return _promise.default.resolve(_this3);
  18898. });
  18899. }
  18900. /**
  18901. * Checks whether a user is linked to a service.
  18902. *
  18903. * @param {object} provider service to link to
  18904. * @returns {boolean} true if link was successful
  18905. */
  18906. }, {
  18907. key: "_isLinked",
  18908. value: function (provider
  18909. /*: any*/
  18910. )
  18911. /*: boolean*/
  18912. {
  18913. var authType;
  18914. if (typeof provider === 'string') {
  18915. authType = provider;
  18916. } else {
  18917. authType = provider.getAuthType();
  18918. }
  18919. var authData = this.get('authData') || {};
  18920. if ((0, _typeof2.default)(authData) !== 'object') {
  18921. return false;
  18922. }
  18923. return !!authData[authType];
  18924. }
  18925. /**
  18926. * Deauthenticates all providers.
  18927. */
  18928. }, {
  18929. key: "_logOutWithAll",
  18930. value: function () {
  18931. var authData = this.get('authData');
  18932. if ((0, _typeof2.default)(authData) !== 'object') {
  18933. return;
  18934. }
  18935. for (var _key3 in authData) {
  18936. this._logOutWith(_key3);
  18937. }
  18938. }
  18939. /**
  18940. * Deauthenticates a single provider (e.g. removing access tokens from the
  18941. * Facebook SDK).
  18942. *
  18943. * @param {object} provider service to logout of
  18944. */
  18945. }, {
  18946. key: "_logOutWith",
  18947. value: function (provider
  18948. /*: any*/
  18949. ) {
  18950. if (!this.isCurrent()) {
  18951. return;
  18952. }
  18953. if (typeof provider === 'string') {
  18954. provider = authProviders[provider];
  18955. }
  18956. if (provider && provider.deauthenticate) {
  18957. provider.deauthenticate();
  18958. }
  18959. }
  18960. /**
  18961. * Class instance method used to maintain specific keys when a fetch occurs.
  18962. * Used to ensure that the session token is not lost.
  18963. *
  18964. * @returns {object} sessionToken
  18965. */
  18966. }, {
  18967. key: "_preserveFieldsOnFetch",
  18968. value: function ()
  18969. /*: AttributeMap*/
  18970. {
  18971. return {
  18972. sessionToken: this.get('sessionToken')
  18973. };
  18974. }
  18975. /**
  18976. * Returns true if <code>current</code> would return this user.
  18977. *
  18978. * @returns {boolean} true if user is cached on disk
  18979. */
  18980. }, {
  18981. key: "isCurrent",
  18982. value: function ()
  18983. /*: boolean*/
  18984. {
  18985. var current = ParseUser.current();
  18986. return !!current && current.id === this.id;
  18987. }
  18988. /**
  18989. * Returns true if <code>current</code> would return this user.
  18990. *
  18991. * @returns {Promise<boolean>} true if user is cached on disk
  18992. */
  18993. }, {
  18994. key: "isCurrentAsync",
  18995. value: function () {
  18996. var _isCurrentAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  18997. var current;
  18998. return _regeneratorRuntime().wrap(function _callee$(_context) {
  18999. while (1) {
  19000. switch (_context.prev = _context.next) {
  19001. case 0:
  19002. _context.next = 2;
  19003. return ParseUser.currentAsync();
  19004. case 2:
  19005. current = _context.sent;
  19006. return _context.abrupt("return", !!current && current.id === this.id);
  19007. case 4:
  19008. case "end":
  19009. return _context.stop();
  19010. }
  19011. }
  19012. }, _callee, this);
  19013. }));
  19014. function isCurrentAsync() {
  19015. return _isCurrentAsync.apply(this, arguments);
  19016. }
  19017. return isCurrentAsync;
  19018. }()
  19019. /**
  19020. * Returns get("username").
  19021. *
  19022. * @returns {string}
  19023. */
  19024. }, {
  19025. key: "getUsername",
  19026. value: function getUsername()
  19027. /*: ?string*/
  19028. {
  19029. var username = this.get('username');
  19030. if (username == null || typeof username === 'string') {
  19031. return username;
  19032. }
  19033. return '';
  19034. }
  19035. /**
  19036. * Calls set("username", username, options) and returns the result.
  19037. *
  19038. * @param {string} username
  19039. */
  19040. }, {
  19041. key: "setUsername",
  19042. value: function setUsername(username
  19043. /*: string*/
  19044. ) {
  19045. // Strip anonymity
  19046. var authData = this.get('authData');
  19047. if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
  19048. // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
  19049. authData.anonymous = null;
  19050. }
  19051. this.set('username', username);
  19052. }
  19053. /**
  19054. * Calls set("password", password, options) and returns the result.
  19055. *
  19056. * @param {string} password User's Password
  19057. */
  19058. }, {
  19059. key: "setPassword",
  19060. value: function setPassword(password
  19061. /*: string*/
  19062. ) {
  19063. this.set('password', password);
  19064. }
  19065. /**
  19066. * Returns get("email").
  19067. *
  19068. * @returns {string} User's Email
  19069. */
  19070. }, {
  19071. key: "getEmail",
  19072. value: function getEmail()
  19073. /*: ?string*/
  19074. {
  19075. var email = this.get('email');
  19076. if (email == null || typeof email === 'string') {
  19077. return email;
  19078. }
  19079. return '';
  19080. }
  19081. /**
  19082. * Calls set("email", email) and returns the result.
  19083. *
  19084. * @param {string} email
  19085. * @returns {boolean}
  19086. */
  19087. }, {
  19088. key: "setEmail",
  19089. value: function setEmail(email
  19090. /*: string*/
  19091. ) {
  19092. return this.set('email', email);
  19093. }
  19094. /**
  19095. * Returns the session token for this user, if the user has been logged in,
  19096. * or if it is the result of a query with the master key. Otherwise, returns
  19097. * undefined.
  19098. *
  19099. * @returns {string} the session token, or undefined
  19100. */
  19101. }, {
  19102. key: "getSessionToken",
  19103. value: function getSessionToken()
  19104. /*: ?string*/
  19105. {
  19106. var token = this.get('sessionToken');
  19107. if (token == null || typeof token === 'string') {
  19108. return token;
  19109. }
  19110. return '';
  19111. }
  19112. /**
  19113. * Checks whether this user is the current user and has been authenticated.
  19114. *
  19115. * @returns {boolean} whether this user is the current user and is logged in.
  19116. */
  19117. }, {
  19118. key: "authenticated",
  19119. value: function authenticated()
  19120. /*: boolean*/
  19121. {
  19122. var current = ParseUser.current();
  19123. return !!this.get('sessionToken') && !!current && current.id === this.id;
  19124. }
  19125. /**
  19126. * Signs up a new user. You should call this instead of save for
  19127. * new Parse.Users. This will create a new Parse.User on the server, and
  19128. * also persist the session on disk so that you can access the user using
  19129. * <code>current</code>.
  19130. *
  19131. * <p>A username and password must be set before calling signUp.</p>
  19132. *
  19133. * @param {object} attrs Extra fields to set on the new user, or null.
  19134. * @param {object} options
  19135. * @returns {Promise} A promise that is fulfilled when the signup
  19136. * finishes.
  19137. */
  19138. }, {
  19139. key: "signUp",
  19140. value: function signUp(attrs
  19141. /*: AttributeMap*/
  19142. , options
  19143. /*:: ?: FullOptions*/
  19144. )
  19145. /*: Promise<ParseUser>*/
  19146. {
  19147. options = options || {};
  19148. var signupOptions = {};
  19149. if (options.hasOwnProperty('useMasterKey')) {
  19150. signupOptions.useMasterKey = options.useMasterKey;
  19151. }
  19152. if (options.hasOwnProperty('installationId')) {
  19153. signupOptions.installationId = options.installationId;
  19154. }
  19155. if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
  19156. signupOptions.context = options.context;
  19157. }
  19158. var controller = _CoreManager.default.getUserController();
  19159. return controller.signUp(this, attrs, signupOptions);
  19160. }
  19161. /**
  19162. * Logs in a Parse.User. On success, this saves the session to disk,
  19163. * so you can retrieve the currently logged in user using
  19164. * <code>current</code>.
  19165. *
  19166. * <p>A username and password must be set before calling logIn.</p>
  19167. *
  19168. * @param {object} options
  19169. * @returns {Promise} A promise that is fulfilled with the user when
  19170. * the login is complete.
  19171. */
  19172. }, {
  19173. key: "logIn",
  19174. value: function logIn(options
  19175. /*:: ?: FullOptions*/
  19176. )
  19177. /*: Promise<ParseUser>*/
  19178. {
  19179. options = options || {};
  19180. var loginOptions = {
  19181. usePost: true
  19182. };
  19183. if (options.hasOwnProperty('useMasterKey')) {
  19184. loginOptions.useMasterKey = options.useMasterKey;
  19185. }
  19186. if (options.hasOwnProperty('installationId')) {
  19187. loginOptions.installationId = options.installationId;
  19188. }
  19189. if (options.hasOwnProperty('usePost')) {
  19190. loginOptions.usePost = options.usePost;
  19191. }
  19192. var controller = _CoreManager.default.getUserController();
  19193. return controller.logIn(this, loginOptions);
  19194. }
  19195. /**
  19196. * Wrap the default save behavior with functionality to save to local
  19197. * storage if this is current user.
  19198. *
  19199. * @param {...any} args
  19200. * @returns {Promise}
  19201. */
  19202. }, {
  19203. key: "save",
  19204. value: function () {
  19205. var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
  19206. var _len,
  19207. args,
  19208. _key4,
  19209. current,
  19210. _args2 = arguments;
  19211. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  19212. while (1) {
  19213. switch (_context2.prev = _context2.next) {
  19214. case 0:
  19215. for (_len = _args2.length, args = new Array(_len), _key4 = 0; _key4 < _len; _key4++) {
  19216. args[_key4] = _args2[_key4];
  19217. }
  19218. _context2.next = 3;
  19219. return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "save", this).apply(this, args);
  19220. case 3:
  19221. _context2.next = 5;
  19222. return this.isCurrentAsync();
  19223. case 5:
  19224. current = _context2.sent;
  19225. if (!current) {
  19226. _context2.next = 8;
  19227. break;
  19228. }
  19229. return _context2.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
  19230. case 8:
  19231. return _context2.abrupt("return", this);
  19232. case 9:
  19233. case "end":
  19234. return _context2.stop();
  19235. }
  19236. }
  19237. }, _callee2, this);
  19238. }));
  19239. function save() {
  19240. return _save.apply(this, arguments);
  19241. }
  19242. return save;
  19243. }()
  19244. /**
  19245. * Wrap the default destroy behavior with functionality that logs out
  19246. * the current user when it is destroyed
  19247. *
  19248. * @param {...any} args
  19249. * @returns {Parse.User}
  19250. */
  19251. }, {
  19252. key: "destroy",
  19253. value: function () {
  19254. var _destroy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  19255. var _len2,
  19256. args,
  19257. _key5,
  19258. current,
  19259. _args3 = arguments;
  19260. return _regeneratorRuntime().wrap(function _callee3$(_context3) {
  19261. while (1) {
  19262. switch (_context3.prev = _context3.next) {
  19263. case 0:
  19264. for (_len2 = _args3.length, args = new Array(_len2), _key5 = 0; _key5 < _len2; _key5++) {
  19265. args[_key5] = _args3[_key5];
  19266. }
  19267. _context3.next = 3;
  19268. return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "destroy", this).apply(this, args);
  19269. case 3:
  19270. _context3.next = 5;
  19271. return this.isCurrentAsync();
  19272. case 5:
  19273. current = _context3.sent;
  19274. if (!current) {
  19275. _context3.next = 8;
  19276. break;
  19277. }
  19278. return _context3.abrupt("return", _CoreManager.default.getUserController().removeUserFromDisk());
  19279. case 8:
  19280. return _context3.abrupt("return", this);
  19281. case 9:
  19282. case "end":
  19283. return _context3.stop();
  19284. }
  19285. }
  19286. }, _callee3, this);
  19287. }));
  19288. function destroy() {
  19289. return _destroy.apply(this, arguments);
  19290. }
  19291. return destroy;
  19292. }()
  19293. /**
  19294. * Wrap the default fetch behavior with functionality to save to local
  19295. * storage if this is current user.
  19296. *
  19297. * @param {...any} args
  19298. * @returns {Parse.User}
  19299. */
  19300. }, {
  19301. key: "fetch",
  19302. value: function () {
  19303. var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
  19304. var _len3,
  19305. args,
  19306. _key6,
  19307. current,
  19308. _args4 = arguments;
  19309. return _regeneratorRuntime().wrap(function _callee4$(_context4) {
  19310. while (1) {
  19311. switch (_context4.prev = _context4.next) {
  19312. case 0:
  19313. for (_len3 = _args4.length, args = new Array(_len3), _key6 = 0; _key6 < _len3; _key6++) {
  19314. args[_key6] = _args4[_key6];
  19315. }
  19316. _context4.next = 3;
  19317. return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "fetch", this).apply(this, args);
  19318. case 3:
  19319. _context4.next = 5;
  19320. return this.isCurrentAsync();
  19321. case 5:
  19322. current = _context4.sent;
  19323. if (!current) {
  19324. _context4.next = 8;
  19325. break;
  19326. }
  19327. return _context4.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
  19328. case 8:
  19329. return _context4.abrupt("return", this);
  19330. case 9:
  19331. case "end":
  19332. return _context4.stop();
  19333. }
  19334. }
  19335. }, _callee4, this);
  19336. }));
  19337. function fetch() {
  19338. return _fetch.apply(this, arguments);
  19339. }
  19340. return fetch;
  19341. }()
  19342. /**
  19343. * Wrap the default fetchWithInclude behavior with functionality to save to local
  19344. * storage if this is current user.
  19345. *
  19346. * @param {...any} args
  19347. * @returns {Parse.User}
  19348. */
  19349. }, {
  19350. key: "fetchWithInclude",
  19351. value: function () {
  19352. var _fetchWithInclude = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
  19353. var _len4,
  19354. args,
  19355. _key7,
  19356. current,
  19357. _args5 = arguments;
  19358. return _regeneratorRuntime().wrap(function _callee5$(_context5) {
  19359. while (1) {
  19360. switch (_context5.prev = _context5.next) {
  19361. case 0:
  19362. for (_len4 = _args5.length, args = new Array(_len4), _key7 = 0; _key7 < _len4; _key7++) {
  19363. args[_key7] = _args5[_key7];
  19364. }
  19365. _context5.next = 3;
  19366. return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "fetchWithInclude", this).apply(this, args);
  19367. case 3:
  19368. _context5.next = 5;
  19369. return this.isCurrentAsync();
  19370. case 5:
  19371. current = _context5.sent;
  19372. if (!current) {
  19373. _context5.next = 8;
  19374. break;
  19375. }
  19376. return _context5.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
  19377. case 8:
  19378. return _context5.abrupt("return", this);
  19379. case 9:
  19380. case "end":
  19381. return _context5.stop();
  19382. }
  19383. }
  19384. }, _callee5, this);
  19385. }));
  19386. function fetchWithInclude() {
  19387. return _fetchWithInclude.apply(this, arguments);
  19388. }
  19389. return fetchWithInclude;
  19390. }()
  19391. /**
  19392. * Verify whether a given password is the password of the current user.
  19393. *
  19394. * @param {string} password A password to be verified
  19395. * @param {object} options
  19396. * @returns {Promise} A promise that is fulfilled with a user
  19397. * when the password is correct.
  19398. */
  19399. }, {
  19400. key: "verifyPassword",
  19401. value: function verifyPassword(password
  19402. /*: string*/
  19403. , options
  19404. /*:: ?: RequestOptions*/
  19405. )
  19406. /*: Promise<ParseUser>*/
  19407. {
  19408. var username = this.getUsername() || '';
  19409. return ParseUser.verifyPassword(username, password, options);
  19410. }
  19411. }], [{
  19412. key: "readOnlyAttributes",
  19413. value: function readOnlyAttributes() {
  19414. return ['sessionToken'];
  19415. }
  19416. /**
  19417. * Adds functionality to the existing Parse.User class.
  19418. *
  19419. * @param {object} protoProps A set of properties to add to the prototype
  19420. * @param {object} classProps A set of static properties to add to the class
  19421. * @static
  19422. * @returns {Parse.User} The newly extended Parse.User class
  19423. */
  19424. }, {
  19425. key: "extend",
  19426. value: function extend(protoProps
  19427. /*: { [prop: string]: any }*/
  19428. , classProps
  19429. /*: { [prop: string]: any }*/
  19430. ) {
  19431. if (protoProps) {
  19432. for (var _prop in protoProps) {
  19433. if (_prop !== 'className') {
  19434. (0, _defineProperty.default)(ParseUser.prototype, _prop, {
  19435. value: protoProps[_prop],
  19436. enumerable: false,
  19437. writable: true,
  19438. configurable: true
  19439. });
  19440. }
  19441. }
  19442. }
  19443. if (classProps) {
  19444. for (var _prop2 in classProps) {
  19445. if (_prop2 !== 'className') {
  19446. (0, _defineProperty.default)(ParseUser, _prop2, {
  19447. value: classProps[_prop2],
  19448. enumerable: false,
  19449. writable: true,
  19450. configurable: true
  19451. });
  19452. }
  19453. }
  19454. }
  19455. return ParseUser;
  19456. }
  19457. /**
  19458. * Retrieves the currently logged in ParseUser with a valid session,
  19459. * either from memory or localStorage, if necessary.
  19460. *
  19461. * @static
  19462. * @returns {Parse.Object} The currently logged in Parse.User.
  19463. */
  19464. }, {
  19465. key: "current",
  19466. value: function current()
  19467. /*: ?ParseUser*/
  19468. {
  19469. if (!canUseCurrentUser) {
  19470. return null;
  19471. }
  19472. var controller = _CoreManager.default.getUserController();
  19473. return controller.currentUser();
  19474. }
  19475. /**
  19476. * Retrieves the currently logged in ParseUser from asynchronous Storage.
  19477. *
  19478. * @static
  19479. * @returns {Promise} A Promise that is resolved with the currently
  19480. * logged in Parse User
  19481. */
  19482. }, {
  19483. key: "currentAsync",
  19484. value: function currentAsync()
  19485. /*: Promise<?ParseUser>*/
  19486. {
  19487. if (!canUseCurrentUser) {
  19488. return _promise.default.resolve(null);
  19489. }
  19490. var controller = _CoreManager.default.getUserController();
  19491. return controller.currentUserAsync();
  19492. }
  19493. /**
  19494. * Signs up a new user with a username (or email) and password.
  19495. * This will create a new Parse.User on the server, and also persist the
  19496. * session in localStorage so that you can access the user using
  19497. * {@link #current}.
  19498. *
  19499. * @param {string} username The username (or email) to sign up with.
  19500. * @param {string} password The password to sign up with.
  19501. * @param {object} attrs Extra fields to set on the new user.
  19502. * @param {object} options
  19503. * @static
  19504. * @returns {Promise} A promise that is fulfilled with the user when
  19505. * the signup completes.
  19506. */
  19507. }, {
  19508. key: "signUp",
  19509. value: function signUp(username
  19510. /*: string*/
  19511. , password
  19512. /*: string*/
  19513. , attrs
  19514. /*: AttributeMap*/
  19515. , options
  19516. /*:: ?: FullOptions*/
  19517. ) {
  19518. attrs = attrs || {};
  19519. attrs.username = username;
  19520. attrs.password = password;
  19521. var user = new this(attrs);
  19522. return user.signUp({}, options);
  19523. }
  19524. /**
  19525. * Logs in a user with a username (or email) and password. On success, this
  19526. * saves the session to disk, so you can retrieve the currently logged in
  19527. * user using <code>current</code>.
  19528. *
  19529. * @param {string} username The username (or email) to log in with.
  19530. * @param {string} password The password to log in with.
  19531. * @param {object} options
  19532. * @static
  19533. * @returns {Promise} A promise that is fulfilled with the user when
  19534. * the login completes.
  19535. */
  19536. }, {
  19537. key: "logIn",
  19538. value: function logIn(username
  19539. /*: string*/
  19540. , password
  19541. /*: string*/
  19542. , options
  19543. /*:: ?: FullOptions*/
  19544. ) {
  19545. if (typeof username !== 'string') {
  19546. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
  19547. } else if (typeof password !== 'string') {
  19548. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
  19549. }
  19550. var user = new this();
  19551. user._finishFetch({
  19552. username: username,
  19553. password: password
  19554. });
  19555. return user.logIn(options);
  19556. }
  19557. /**
  19558. * Logs in a user with a session token. On success, this saves the session
  19559. * to disk, so you can retrieve the currently logged in user using
  19560. * <code>current</code>.
  19561. *
  19562. * @param {string} sessionToken The sessionToken to log in with.
  19563. * @param {object} options
  19564. * @static
  19565. * @returns {Promise} A promise that is fulfilled with the user when
  19566. * the login completes.
  19567. */
  19568. }, {
  19569. key: "become",
  19570. value: function become(sessionToken
  19571. /*: string*/
  19572. , options
  19573. /*:: ?: RequestOptions*/
  19574. ) {
  19575. if (!canUseCurrentUser) {
  19576. throw new Error('It is not memory-safe to become a user in a server environment');
  19577. }
  19578. options = options || {};
  19579. var becomeOptions
  19580. /*: RequestOptions*/
  19581. = {
  19582. sessionToken: sessionToken
  19583. };
  19584. if (options.hasOwnProperty('useMasterKey')) {
  19585. becomeOptions.useMasterKey = options.useMasterKey;
  19586. }
  19587. var controller = _CoreManager.default.getUserController();
  19588. var user = new this();
  19589. return controller.become(user, becomeOptions);
  19590. }
  19591. /**
  19592. * Retrieves a user with a session token.
  19593. *
  19594. * @param {string} sessionToken The sessionToken to get user with.
  19595. * @param {object} options
  19596. * @static
  19597. * @returns {Promise} A promise that is fulfilled with the user is fetched.
  19598. */
  19599. }, {
  19600. key: "me",
  19601. value: function me(sessionToken
  19602. /*: string*/
  19603. ) {
  19604. var options
  19605. /*:: ?: RequestOptions*/
  19606. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19607. var controller = _CoreManager.default.getUserController();
  19608. var meOptions
  19609. /*: RequestOptions*/
  19610. = {
  19611. sessionToken: sessionToken
  19612. };
  19613. if (options.useMasterKey) {
  19614. meOptions.useMasterKey = options.useMasterKey;
  19615. }
  19616. var user = new this();
  19617. return controller.me(user, meOptions);
  19618. }
  19619. /**
  19620. * Logs in a user with a session token. On success, this saves the session
  19621. * to disk, so you can retrieve the currently logged in user using
  19622. * <code>current</code>. If there is no session token the user will not logged in.
  19623. *
  19624. * @param {object} userJSON The JSON map of the User's data
  19625. * @static
  19626. * @returns {Promise} A promise that is fulfilled with the user when
  19627. * the login completes.
  19628. */
  19629. }, {
  19630. key: "hydrate",
  19631. value: function hydrate(userJSON
  19632. /*: AttributeMap*/
  19633. ) {
  19634. var controller = _CoreManager.default.getUserController();
  19635. var user = new this();
  19636. return controller.hydrate(user, userJSON);
  19637. }
  19638. /**
  19639. * Static version of {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
  19640. *
  19641. * @param provider
  19642. * @param options
  19643. * @param saveOpts
  19644. * @static
  19645. * @returns {Promise}
  19646. */
  19647. }, {
  19648. key: "logInWith",
  19649. value: function logInWith(provider
  19650. /*: any*/
  19651. , options
  19652. /*: { authData?: AuthData }*/
  19653. , saveOpts
  19654. /*:: ?: FullOptions*/
  19655. )
  19656. /*: Promise<ParseUser>*/
  19657. {
  19658. var user = new this();
  19659. return user.linkWith(provider, options, saveOpts);
  19660. }
  19661. /**
  19662. * Logs out the currently logged in user session. This will remove the
  19663. * session from disk, log out of linked services, and future calls to
  19664. * <code>current</code> will return <code>null</code>.
  19665. *
  19666. * @param {object} options
  19667. * @static
  19668. * @returns {Promise} A promise that is resolved when the session is
  19669. * destroyed on the server.
  19670. */
  19671. }, {
  19672. key: "logOut",
  19673. value: function logOut() {
  19674. var options
  19675. /*: RequestOptions*/
  19676. = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19677. var controller = _CoreManager.default.getUserController();
  19678. return controller.logOut(options);
  19679. }
  19680. /**
  19681. * Requests a password reset email to be sent to the specified email address
  19682. * associated with the user account. This email allows the user to securely
  19683. * reset their password on the Parse site.
  19684. *
  19685. * @param {string} email The email address associated with the user that
  19686. * forgot their password.
  19687. * @param {object} options
  19688. * @static
  19689. * @returns {Promise}
  19690. */
  19691. }, {
  19692. key: "requestPasswordReset",
  19693. value: function requestPasswordReset(email
  19694. /*: string*/
  19695. , options
  19696. /*:: ?: RequestOptions*/
  19697. ) {
  19698. options = options || {};
  19699. var requestOptions = {};
  19700. if (options.hasOwnProperty('useMasterKey')) {
  19701. requestOptions.useMasterKey = options.useMasterKey;
  19702. }
  19703. var controller = _CoreManager.default.getUserController();
  19704. return controller.requestPasswordReset(email, requestOptions);
  19705. }
  19706. /**
  19707. * Request an email verification.
  19708. *
  19709. * @param {string} email The email address associated with the user that
  19710. * needs to verify their email.
  19711. * @param {object} options
  19712. * @static
  19713. * @returns {Promise}
  19714. */
  19715. }, {
  19716. key: "requestEmailVerification",
  19717. value: function requestEmailVerification(email
  19718. /*: string*/
  19719. , options
  19720. /*:: ?: RequestOptions*/
  19721. ) {
  19722. options = options || {};
  19723. var requestOptions = {};
  19724. if (options.hasOwnProperty('useMasterKey')) {
  19725. requestOptions.useMasterKey = options.useMasterKey;
  19726. }
  19727. var controller = _CoreManager.default.getUserController();
  19728. return controller.requestEmailVerification(email, requestOptions);
  19729. }
  19730. /**
  19731. * Verify whether a given password is the password of the current user.
  19732. *
  19733. * @param {string} username A username to be used for identificaiton
  19734. * @param {string} password A password to be verified
  19735. * @param {object} options
  19736. * @static
  19737. * @returns {Promise} A promise that is fulfilled with a user
  19738. * when the password is correct.
  19739. */
  19740. }, {
  19741. key: "verifyPassword",
  19742. value: function verifyPassword(username
  19743. /*: string*/
  19744. , password
  19745. /*: string*/
  19746. , options
  19747. /*:: ?: RequestOptions*/
  19748. ) {
  19749. if (typeof username !== 'string') {
  19750. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
  19751. }
  19752. if (typeof password !== 'string') {
  19753. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
  19754. }
  19755. options = options || {};
  19756. var verificationOption = {};
  19757. if (options.hasOwnProperty('useMasterKey')) {
  19758. verificationOption.useMasterKey = options.useMasterKey;
  19759. }
  19760. var controller = _CoreManager.default.getUserController();
  19761. return controller.verifyPassword(username, password, verificationOption);
  19762. }
  19763. /**
  19764. * Allow someone to define a custom User class without className
  19765. * being rewritten to _User. The default behavior is to rewrite
  19766. * User to _User for legacy reasons. This allows developers to
  19767. * override that behavior.
  19768. *
  19769. * @param {boolean} isAllowed Whether or not to allow custom User class
  19770. * @static
  19771. */
  19772. }, {
  19773. key: "allowCustomUserClass",
  19774. value: function allowCustomUserClass(isAllowed
  19775. /*: boolean*/
  19776. ) {
  19777. _CoreManager.default.set('PERFORM_USER_REWRITE', !isAllowed);
  19778. }
  19779. /**
  19780. * Allows a legacy application to start using revocable sessions. If the
  19781. * current session token is not revocable, a request will be made for a new,
  19782. * revocable session.
  19783. * It is not necessary to call this method from cloud code unless you are
  19784. * handling user signup or login from the server side. In a cloud code call,
  19785. * this function will not attempt to upgrade the current token.
  19786. *
  19787. * @param {object} options
  19788. * @static
  19789. * @returns {Promise} A promise that is resolved when the process has
  19790. * completed. If a replacement session token is requested, the promise
  19791. * will be resolved after a new token has been fetched.
  19792. */
  19793. }, {
  19794. key: "enableRevocableSession",
  19795. value: function enableRevocableSession(options
  19796. /*:: ?: RequestOptions*/
  19797. ) {
  19798. options = options || {};
  19799. _CoreManager.default.set('FORCE_REVOCABLE_SESSION', true);
  19800. if (canUseCurrentUser) {
  19801. var current = ParseUser.current();
  19802. if (current) {
  19803. return current._upgradeToRevocableSession(options);
  19804. }
  19805. }
  19806. return _promise.default.resolve();
  19807. }
  19808. /**
  19809. * Enables the use of become or the current user in a server
  19810. * environment. These features are disabled by default, since they depend on
  19811. * global objects that are not memory-safe for most servers.
  19812. *
  19813. * @static
  19814. */
  19815. }, {
  19816. key: "enableUnsafeCurrentUser",
  19817. value: function enableUnsafeCurrentUser() {
  19818. canUseCurrentUser = true;
  19819. }
  19820. /**
  19821. * Disables the use of become or the current user in any environment.
  19822. * These features are disabled on servers by default, since they depend on
  19823. * global objects that are not memory-safe for most servers.
  19824. *
  19825. * @static
  19826. */
  19827. }, {
  19828. key: "disableUnsafeCurrentUser",
  19829. value: function disableUnsafeCurrentUser() {
  19830. canUseCurrentUser = false;
  19831. }
  19832. /**
  19833. * When registering users with {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith} a basic auth provider
  19834. * is automatically created for you.
  19835. *
  19836. * For advanced authentication, you can register an Auth provider to
  19837. * implement custom authentication, deauthentication.
  19838. *
  19839. * @param provider
  19840. * @see {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
  19841. * @see {@link https://docs.parseplatform.org/js/guide/#custom-authentication-module Custom Authentication Module}
  19842. * @static
  19843. */
  19844. }, {
  19845. key: "_registerAuthenticationProvider",
  19846. value: function _registerAuthenticationProvider(provider
  19847. /*: any*/
  19848. ) {
  19849. authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
  19850. ParseUser.currentAsync().then(function (current) {
  19851. if (current) {
  19852. current._synchronizeAuthData(provider.getAuthType());
  19853. }
  19854. });
  19855. }
  19856. /**
  19857. * @param provider
  19858. * @param options
  19859. * @param saveOpts
  19860. * @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#logInWith logInWith}
  19861. * @static
  19862. * @returns {Promise}
  19863. */
  19864. }, {
  19865. key: "_logInWith",
  19866. value: function _logInWith(provider
  19867. /*: any*/
  19868. , options
  19869. /*: { authData?: AuthData }*/
  19870. , saveOpts
  19871. /*:: ?: FullOptions*/
  19872. ) {
  19873. var user = new this();
  19874. return user.linkWith(provider, options, saveOpts);
  19875. }
  19876. }, {
  19877. key: "_clearCache",
  19878. value: function _clearCache() {
  19879. currentUserCache = null;
  19880. currentUserCacheMatchesDisk = false;
  19881. }
  19882. }, {
  19883. key: "_setCurrentUserCache",
  19884. value: function _setCurrentUserCache(user
  19885. /*: ParseUser*/
  19886. ) {
  19887. currentUserCache = user;
  19888. }
  19889. }]);
  19890. return ParseUser;
  19891. }(_ParseObject2.default);
  19892. _ParseObject2.default.registerSubclass('_User', ParseUser);
  19893. var DefaultController = {
  19894. updateUserOnDisk: function updateUserOnDisk(user) {
  19895. var path = _Storage.default.generatePath(CURRENT_USER_KEY);
  19896. var json = user.toJSON();
  19897. delete json.password;
  19898. json.className = '_User';
  19899. var userData = (0, _stringify.default)(json);
  19900. if (_CoreManager.default.get('ENCRYPTED_USER')) {
  19901. var crypto = _CoreManager.default.getCryptoController();
  19902. userData = crypto.encrypt(json, _CoreManager.default.get('ENCRYPTED_KEY'));
  19903. }
  19904. return _Storage.default.setItemAsync(path, userData).then(function () {
  19905. return user;
  19906. });
  19907. },
  19908. removeUserFromDisk: function removeUserFromDisk() {
  19909. var path = _Storage.default.generatePath(CURRENT_USER_KEY);
  19910. currentUserCacheMatchesDisk = true;
  19911. currentUserCache = null;
  19912. return _Storage.default.removeItemAsync(path);
  19913. },
  19914. setCurrentUser: function setCurrentUser(user) {
  19915. currentUserCache = user;
  19916. user._cleanupAuthData();
  19917. user._synchronizeAllAuthData();
  19918. return DefaultController.updateUserOnDisk(user);
  19919. },
  19920. currentUser: function currentUser()
  19921. /*: ?ParseUser*/
  19922. {
  19923. if (currentUserCache) {
  19924. return currentUserCache;
  19925. }
  19926. if (currentUserCacheMatchesDisk) {
  19927. return null;
  19928. }
  19929. if (_Storage.default.async()) {
  19930. throw new Error('Cannot call currentUser() when using a platform with an async ' + 'storage system. Call currentUserAsync() instead.');
  19931. }
  19932. var path = _Storage.default.generatePath(CURRENT_USER_KEY);
  19933. var userData = _Storage.default.getItem(path);
  19934. currentUserCacheMatchesDisk = true;
  19935. if (!userData) {
  19936. currentUserCache = null;
  19937. return null;
  19938. }
  19939. if (_CoreManager.default.get('ENCRYPTED_USER')) {
  19940. var crypto = _CoreManager.default.getCryptoController();
  19941. userData = crypto.decrypt(userData, _CoreManager.default.get('ENCRYPTED_KEY'));
  19942. }
  19943. userData = JSON.parse(userData);
  19944. if (!userData.className) {
  19945. userData.className = '_User';
  19946. }
  19947. if (userData._id) {
  19948. if (userData.objectId !== userData._id) {
  19949. userData.objectId = userData._id;
  19950. }
  19951. delete userData._id;
  19952. }
  19953. if (userData._sessionToken) {
  19954. userData.sessionToken = userData._sessionToken;
  19955. delete userData._sessionToken;
  19956. }
  19957. var current = _ParseObject2.default.fromJSON(userData);
  19958. currentUserCache = current;
  19959. current._synchronizeAllAuthData();
  19960. return current;
  19961. },
  19962. currentUserAsync: function currentUserAsync()
  19963. /*: Promise<?ParseUser>*/
  19964. {
  19965. if (currentUserCache) {
  19966. return _promise.default.resolve(currentUserCache);
  19967. }
  19968. if (currentUserCacheMatchesDisk) {
  19969. return _promise.default.resolve(null);
  19970. }
  19971. var path = _Storage.default.generatePath(CURRENT_USER_KEY);
  19972. return _Storage.default.getItemAsync(path).then(function (userData) {
  19973. currentUserCacheMatchesDisk = true;
  19974. if (!userData) {
  19975. currentUserCache = null;
  19976. return _promise.default.resolve(null);
  19977. }
  19978. if (_CoreManager.default.get('ENCRYPTED_USER')) {
  19979. var crypto = _CoreManager.default.getCryptoController();
  19980. userData = crypto.decrypt(userData.toString(), _CoreManager.default.get('ENCRYPTED_KEY'));
  19981. }
  19982. userData = JSON.parse(userData);
  19983. if (!userData.className) {
  19984. userData.className = '_User';
  19985. }
  19986. if (userData._id) {
  19987. if (userData.objectId !== userData._id) {
  19988. userData.objectId = userData._id;
  19989. }
  19990. delete userData._id;
  19991. }
  19992. if (userData._sessionToken) {
  19993. userData.sessionToken = userData._sessionToken;
  19994. delete userData._sessionToken;
  19995. }
  19996. var current = _ParseObject2.default.fromJSON(userData);
  19997. currentUserCache = current;
  19998. current._synchronizeAllAuthData();
  19999. return _promise.default.resolve(current);
  20000. });
  20001. },
  20002. signUp: function signUp(user
  20003. /*: ParseUser*/
  20004. , attrs
  20005. /*: AttributeMap*/
  20006. , options
  20007. /*: RequestOptions*/
  20008. )
  20009. /*: Promise<ParseUser>*/
  20010. {
  20011. var username = attrs && attrs.username || user.get('username');
  20012. var password = attrs && attrs.password || user.get('password');
  20013. if (!username || !username.length) {
  20014. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Cannot sign up user with an empty username.'));
  20015. }
  20016. if (!password || !password.length) {
  20017. return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Cannot sign up user with an empty password.'));
  20018. }
  20019. return user.save(attrs, options).then(function () {
  20020. // Clear the password field
  20021. user._finishFetch({
  20022. password: undefined
  20023. });
  20024. if (canUseCurrentUser) {
  20025. return DefaultController.setCurrentUser(user);
  20026. }
  20027. return user;
  20028. });
  20029. },
  20030. logIn: function logIn(user
  20031. /*: ParseUser*/
  20032. , options
  20033. /*: RequestOptions*/
  20034. )
  20035. /*: Promise<ParseUser>*/
  20036. {
  20037. var RESTController = _CoreManager.default.getRESTController();
  20038. var stateController = _CoreManager.default.getObjectStateController();
  20039. var auth = {
  20040. username: user.get('username'),
  20041. password: user.get('password')
  20042. };
  20043. return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(function (response) {
  20044. user._migrateId(response.objectId);
  20045. user._setExisted(true);
  20046. stateController.setPendingOp(user._getStateIdentifier(), 'username', undefined);
  20047. stateController.setPendingOp(user._getStateIdentifier(), 'password', undefined);
  20048. response.password = undefined;
  20049. user._finishFetch(response);
  20050. if (!canUseCurrentUser) {
  20051. // We can't set the current user, so just return the one we logged in
  20052. return _promise.default.resolve(user);
  20053. }
  20054. return DefaultController.setCurrentUser(user);
  20055. });
  20056. },
  20057. become: function become(user
  20058. /*: ParseUser*/
  20059. , options
  20060. /*: RequestOptions*/
  20061. )
  20062. /*: Promise<ParseUser>*/
  20063. {
  20064. var RESTController = _CoreManager.default.getRESTController();
  20065. return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
  20066. user._finishFetch(response);
  20067. user._setExisted(true);
  20068. return DefaultController.setCurrentUser(user);
  20069. });
  20070. },
  20071. hydrate: function hydrate(user
  20072. /*: ParseUser*/
  20073. , userJSON
  20074. /*: AttributeMap*/
  20075. )
  20076. /*: Promise<ParseUser>*/
  20077. {
  20078. user._finishFetch(userJSON);
  20079. user._setExisted(true);
  20080. if (userJSON.sessionToken && canUseCurrentUser) {
  20081. return DefaultController.setCurrentUser(user);
  20082. } else {
  20083. return _promise.default.resolve(user);
  20084. }
  20085. },
  20086. me: function me(user
  20087. /*: ParseUser*/
  20088. , options
  20089. /*: RequestOptions*/
  20090. )
  20091. /*: Promise<ParseUser>*/
  20092. {
  20093. var RESTController = _CoreManager.default.getRESTController();
  20094. return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
  20095. user._finishFetch(response);
  20096. user._setExisted(true);
  20097. return user;
  20098. });
  20099. },
  20100. logOut: function logOut(options
  20101. /*: RequestOptions*/
  20102. )
  20103. /*: Promise<ParseUser>*/
  20104. {
  20105. var RESTController = _CoreManager.default.getRESTController();
  20106. if (options.sessionToken) {
  20107. return RESTController.request('POST', 'logout', {}, options);
  20108. }
  20109. return DefaultController.currentUserAsync().then(function (currentUser) {
  20110. var path = _Storage.default.generatePath(CURRENT_USER_KEY);
  20111. var promise = _Storage.default.removeItemAsync(path);
  20112. if (currentUser !== null) {
  20113. var currentSession = currentUser.getSessionToken();
  20114. if (currentSession && (0, _isRevocableSession.default)(currentSession)) {
  20115. promise = promise.then(function () {
  20116. return RESTController.request('POST', 'logout', {}, {
  20117. sessionToken: currentSession
  20118. });
  20119. });
  20120. }
  20121. currentUser._logOutWithAll();
  20122. currentUser._finishFetch({
  20123. sessionToken: undefined
  20124. });
  20125. }
  20126. currentUserCacheMatchesDisk = true;
  20127. currentUserCache = null;
  20128. return promise;
  20129. });
  20130. },
  20131. requestPasswordReset: function requestPasswordReset(email
  20132. /*: string*/
  20133. , options
  20134. /*: RequestOptions*/
  20135. ) {
  20136. var RESTController = _CoreManager.default.getRESTController();
  20137. return RESTController.request('POST', 'requestPasswordReset', {
  20138. email: email
  20139. }, options);
  20140. },
  20141. upgradeToRevocableSession: function upgradeToRevocableSession(user
  20142. /*: ParseUser*/
  20143. , options
  20144. /*: RequestOptions*/
  20145. ) {
  20146. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
  20147. var token, RESTController, result, session, current;
  20148. return _regeneratorRuntime().wrap(function _callee6$(_context6) {
  20149. while (1) {
  20150. switch (_context6.prev = _context6.next) {
  20151. case 0:
  20152. token = user.getSessionToken();
  20153. if (token) {
  20154. _context6.next = 3;
  20155. break;
  20156. }
  20157. return _context6.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.SESSION_MISSING, 'Cannot upgrade a user with no session token')));
  20158. case 3:
  20159. options.sessionToken = token;
  20160. RESTController = _CoreManager.default.getRESTController();
  20161. _context6.next = 7;
  20162. return RESTController.request('POST', 'upgradeToRevocableSession', {}, options);
  20163. case 7:
  20164. result = _context6.sent;
  20165. session = new _ParseSession.default();
  20166. session._finishFetch(result);
  20167. user._finishFetch({
  20168. sessionToken: session.getSessionToken()
  20169. });
  20170. _context6.next = 13;
  20171. return user.isCurrentAsync();
  20172. case 13:
  20173. current = _context6.sent;
  20174. if (!current) {
  20175. _context6.next = 16;
  20176. break;
  20177. }
  20178. return _context6.abrupt("return", DefaultController.setCurrentUser(user));
  20179. case 16:
  20180. return _context6.abrupt("return", _promise.default.resolve(user));
  20181. case 17:
  20182. case "end":
  20183. return _context6.stop();
  20184. }
  20185. }
  20186. }, _callee6);
  20187. }))();
  20188. },
  20189. linkWith: function linkWith(user
  20190. /*: ParseUser*/
  20191. , authData
  20192. /*: AuthData*/
  20193. , options
  20194. /*: FullOptions*/
  20195. ) {
  20196. return user.save({
  20197. authData: authData
  20198. }, options).then(function () {
  20199. if (canUseCurrentUser) {
  20200. return DefaultController.setCurrentUser(user);
  20201. }
  20202. return user;
  20203. });
  20204. },
  20205. verifyPassword: function verifyPassword(username
  20206. /*: string*/
  20207. , password
  20208. /*: string*/
  20209. , options
  20210. /*: RequestOptions*/
  20211. ) {
  20212. var RESTController = _CoreManager.default.getRESTController();
  20213. return RESTController.request('GET', 'verifyPassword', {
  20214. username: username,
  20215. password: password
  20216. }, options);
  20217. },
  20218. requestEmailVerification: function requestEmailVerification(email
  20219. /*: string*/
  20220. , options
  20221. /*: RequestOptions*/
  20222. ) {
  20223. var RESTController = _CoreManager.default.getRESTController();
  20224. return RESTController.request('POST', 'verificationEmailRequest', {
  20225. email: email
  20226. }, options);
  20227. }
  20228. };
  20229. _CoreManager.default.setUserController(DefaultController);
  20230. var _default = ParseUser;
  20231. exports.default = _default;
  20232. },{"./CoreManager":4,"./ParseError":21,"./ParseObject":26,"./ParseSession":33,"./Storage":39,"./isRevocableSession":50,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/reverse":71,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/create":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":91,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/helpers/asyncToGenerator":121,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/get":126,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/typeof":141}],35:[function(_dereq_,module,exports){
  20233. "use strict";
  20234. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  20235. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  20236. _Object$defineProperty(exports, "__esModule", {
  20237. value: true
  20238. });
  20239. exports.getPushStatus = getPushStatus;
  20240. exports.send = send;
  20241. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  20242. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  20243. var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
  20244. /**
  20245. * Copyright (c) 2015-present, Parse, LLC.
  20246. * All rights reserved.
  20247. *
  20248. * This source code is licensed under the BSD-style license found in the
  20249. * LICENSE file in the root directory of this source tree. An additional grant
  20250. * of patent rights can be found in the PATENTS file in the same directory.
  20251. *
  20252. * @flow
  20253. */
  20254. /**
  20255. * Contains functions to deal with Push in Parse.
  20256. *
  20257. * @class Parse.Push
  20258. * @static
  20259. * @hideconstructor
  20260. */
  20261. /**
  20262. * Sends a push notification.
  20263. * **Available in Cloud Code only.**
  20264. *
  20265. * See {@link https://docs.parseplatform.org/js/guide/#push-notifications Push Notification Guide}
  20266. *
  20267. * @function send
  20268. * @name Parse.Push.send
  20269. * @param {object} data - The data of the push notification. Valid fields
  20270. * are:
  20271. * <ol>
  20272. * <li>channels - An Array of channels to push to.</li>
  20273. * <li>push_time - A Date object for when to send the push.</li>
  20274. * <li>expiration_time - A Date object for when to expire
  20275. * the push.</li>
  20276. * <li>expiration_interval - The seconds from now to expire the push.</li>
  20277. * <li>where - A Parse.Query over Parse.Installation that is used to match
  20278. * a set of installations to push to.</li>
  20279. * <li>data - The data to send as part of the push.</li>
  20280. * <ol>
  20281. * @param {object} options Valid options
  20282. * are:<ul>
  20283. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  20284. * be used for this request.
  20285. * </ul>
  20286. * @returns {Promise} A promise that is fulfilled when the push request
  20287. * completes.
  20288. */
  20289. function send(data
  20290. /*: PushData*/
  20291. )
  20292. /*: Promise*/
  20293. {
  20294. var options
  20295. /*:: ?: FullOptions*/
  20296. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20297. if (data.where && data.where instanceof _ParseQuery.default) {
  20298. data.where = data.where.toJSON().where;
  20299. }
  20300. if (data.push_time && (0, _typeof2.default)(data.push_time) === 'object') {
  20301. data.push_time = data.push_time.toJSON();
  20302. }
  20303. if (data.expiration_time && (0, _typeof2.default)(data.expiration_time) === 'object') {
  20304. data.expiration_time = data.expiration_time.toJSON();
  20305. }
  20306. if (data.expiration_time && data.expiration_interval) {
  20307. throw new Error('expiration_time and expiration_interval cannot both be set.');
  20308. }
  20309. var pushOptions = {
  20310. useMasterKey: true
  20311. };
  20312. if (options.hasOwnProperty('useMasterKey')) {
  20313. pushOptions.useMasterKey = options.useMasterKey;
  20314. }
  20315. return _CoreManager.default.getPushController().send(data, pushOptions);
  20316. }
  20317. /**
  20318. * Gets push status by Id
  20319. *
  20320. * @function getPushStatus
  20321. * @name Parse.Push.getPushStatus
  20322. * @param {string} pushStatusId The Id of Push Status.
  20323. * @param {object} options Valid options
  20324. * are:<ul>
  20325. * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
  20326. * be used for this request.
  20327. * </ul>
  20328. * @returns {Parse.Object} Status of Push.
  20329. */
  20330. function getPushStatus(pushStatusId
  20331. /*: string*/
  20332. )
  20333. /*: Promise<string>*/
  20334. {
  20335. var options
  20336. /*:: ?: FullOptions*/
  20337. = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20338. var pushOptions = {
  20339. useMasterKey: true
  20340. };
  20341. if (options.hasOwnProperty('useMasterKey')) {
  20342. pushOptions.useMasterKey = options.useMasterKey;
  20343. }
  20344. var query = new _ParseQuery.default('_PushStatus');
  20345. return query.get(pushStatusId, pushOptions);
  20346. }
  20347. var DefaultController = {
  20348. send: function (data
  20349. /*: PushData*/
  20350. , options
  20351. /*:: ?: FullOptions*/
  20352. ) {
  20353. return _CoreManager.default.getRESTController().request('POST', 'push', data, options);
  20354. }
  20355. };
  20356. _CoreManager.default.setPushController(DefaultController);
  20357. },{"./CoreManager":4,"./ParseQuery":29,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],36:[function(_dereq_,module,exports){
  20358. (function (process){(function (){
  20359. "use strict";
  20360. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  20361. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  20362. var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
  20363. var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
  20364. var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  20365. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  20366. var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
  20367. var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
  20368. var _Object$keys = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
  20369. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  20370. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  20371. var _setTimeout2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set-timeout"));
  20372. var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  20373. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  20374. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  20375. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  20376. var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
  20377. var _promiseUtils = _dereq_("./promiseUtils");
  20378. function ownKeys(object, enumerableOnly) {
  20379. var keys = _Object$keys(object);
  20380. if (_Object$getOwnPropertySymbols) {
  20381. var symbols = _Object$getOwnPropertySymbols(object);
  20382. enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
  20383. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  20384. })), keys.push.apply(keys, symbols);
  20385. }
  20386. return keys;
  20387. }
  20388. function _objectSpread(target) {
  20389. for (var i = 1; i < arguments.length; i++) {
  20390. var _context4, _context5;
  20391. var source = null != arguments[i] ? arguments[i] : {};
  20392. i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) {
  20393. (0, _defineProperty2.default)(target, key, source[key]);
  20394. }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) {
  20395. _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
  20396. });
  20397. }
  20398. return target;
  20399. }
  20400. /**
  20401. * Copyright (c) 2015-present, Parse, LLC.
  20402. * All rights reserved.
  20403. *
  20404. * This source code is licensed under the BSD-style license found in the
  20405. * LICENSE file in the root directory of this source tree. An additional grant
  20406. * of patent rights can be found in the PATENTS file in the same directory.
  20407. *
  20408. * @flow
  20409. */
  20410. /* global XMLHttpRequest, XDomainRequest */
  20411. var uuidv4 = _dereq_('./uuid');
  20412. var XHR = null;
  20413. if (typeof XMLHttpRequest !== 'undefined') {
  20414. XHR = XMLHttpRequest;
  20415. }
  20416. XHR = _dereq_('./Xhr.weapp');
  20417. var useXDomainRequest = false;
  20418. if (typeof XDomainRequest !== 'undefined' && !('withCredentials' in new XMLHttpRequest())) {
  20419. useXDomainRequest = true;
  20420. }
  20421. function ajaxIE9(method
  20422. /*: string*/
  20423. , url
  20424. /*: string*/
  20425. , data
  20426. /*: any*/
  20427. , headers
  20428. /*:: ?: any*/
  20429. , options
  20430. /*:: ?: FullOptions*/
  20431. ) {
  20432. return new _promise.default(function (resolve, reject) {
  20433. var xdr = new XDomainRequest();
  20434. xdr.onload = function () {
  20435. var response;
  20436. try {
  20437. response = JSON.parse(xdr.responseText);
  20438. } catch (e) {
  20439. reject(e);
  20440. }
  20441. if (response) {
  20442. resolve({
  20443. response: response
  20444. });
  20445. }
  20446. };
  20447. xdr.onerror = xdr.ontimeout = function () {
  20448. // Let's fake a real error message.
  20449. var fakeResponse = {
  20450. responseText: (0, _stringify.default)({
  20451. code: _ParseError.default.X_DOMAIN_REQUEST,
  20452. error: "IE's XDomainRequest does not supply error info."
  20453. })
  20454. };
  20455. reject(fakeResponse);
  20456. };
  20457. xdr.onprogress = function () {
  20458. if (options && typeof options.progress === 'function') {
  20459. options.progress(xdr.responseText);
  20460. }
  20461. };
  20462. xdr.open(method, url);
  20463. xdr.send(data);
  20464. if (options && typeof options.requestTask === 'function') {
  20465. options.requestTask(xdr);
  20466. }
  20467. });
  20468. }
  20469. var RESTController = {
  20470. ajax: function (method
  20471. /*: string*/
  20472. , url
  20473. /*: string*/
  20474. , data
  20475. /*: any*/
  20476. , headers
  20477. /*:: ?: any*/
  20478. , options
  20479. /*:: ?: FullOptions*/
  20480. ) {
  20481. var _context;
  20482. if (useXDomainRequest) {
  20483. return ajaxIE9(method, url, data, headers, options);
  20484. }
  20485. var promise = (0, _promiseUtils.resolvingPromise)();
  20486. var isIdempotent = _CoreManager.default.get('IDEMPOTENCY') && (0, _includes.default)(_context = ['POST', 'PUT']).call(_context, method);
  20487. var requestId = isIdempotent ? uuidv4() : '';
  20488. var attempts = 0;
  20489. (function dispatch() {
  20490. if (XHR == null) {
  20491. throw new Error('Cannot make a request: No definition of XMLHttpRequest was found.');
  20492. }
  20493. var handled = false;
  20494. var xhr = new XHR();
  20495. xhr.onreadystatechange = function () {
  20496. if (xhr.readyState !== 4 || handled || xhr._aborted) {
  20497. return;
  20498. }
  20499. handled = true;
  20500. if (xhr.status >= 200 && xhr.status < 300) {
  20501. var response;
  20502. try {
  20503. response = JSON.parse(xhr.responseText);
  20504. if (typeof xhr.getResponseHeader === 'function') {
  20505. var _context2, _context3;
  20506. if ((0, _includes.default)(_context2 = xhr.getAllResponseHeaders() || '').call(_context2, 'x-parse-job-status-id: ')) {
  20507. response = xhr.getResponseHeader('x-parse-job-status-id');
  20508. }
  20509. if ((0, _includes.default)(_context3 = xhr.getAllResponseHeaders() || '').call(_context3, 'x-parse-push-status-id: ')) {
  20510. response = xhr.getResponseHeader('x-parse-push-status-id');
  20511. }
  20512. }
  20513. } catch (e) {
  20514. promise.reject(e.toString());
  20515. }
  20516. if (response) {
  20517. promise.resolve({
  20518. response: response,
  20519. status: xhr.status,
  20520. xhr: xhr
  20521. });
  20522. }
  20523. } else if (xhr.status >= 500 || xhr.status === 0) {
  20524. // retry on 5XX or node-xmlhttprequest error
  20525. if (++attempts < _CoreManager.default.get('REQUEST_ATTEMPT_LIMIT')) {
  20526. // Exponentially-growing random delay
  20527. var delay = Math.round(Math.random() * 125 * Math.pow(2, attempts));
  20528. (0, _setTimeout2.default)(dispatch, delay);
  20529. } else if (xhr.status === 0) {
  20530. promise.reject('Unable to connect to the Parse API');
  20531. } else {
  20532. // After the retry limit is reached, fail
  20533. promise.reject(xhr);
  20534. }
  20535. } else {
  20536. promise.reject(xhr);
  20537. }
  20538. };
  20539. headers = headers || {};
  20540. if (typeof headers['Content-Type'] !== 'string') {
  20541. headers['Content-Type'] = 'text/plain'; // Avoid pre-flight
  20542. }
  20543. if (_CoreManager.default.get('IS_NODE')) {
  20544. headers['User-Agent'] = 'Parse/' + _CoreManager.default.get('VERSION') + ' (NodeJS ' + process.versions.node + ')';
  20545. }
  20546. if (isIdempotent) {
  20547. headers['X-Parse-Request-Id'] = requestId;
  20548. }
  20549. if (_CoreManager.default.get('SERVER_AUTH_TYPE') && _CoreManager.default.get('SERVER_AUTH_TOKEN')) {
  20550. headers['Authorization'] = _CoreManager.default.get('SERVER_AUTH_TYPE') + ' ' + _CoreManager.default.get('SERVER_AUTH_TOKEN');
  20551. }
  20552. var customHeaders = _CoreManager.default.get('REQUEST_HEADERS');
  20553. for (var key in customHeaders) {
  20554. headers[key] = customHeaders[key];
  20555. }
  20556. function handleProgress(type, event) {
  20557. if (options && typeof options.progress === 'function') {
  20558. if (event.lengthComputable) {
  20559. options.progress(event.loaded / event.total, event.loaded, event.total, {
  20560. type: type
  20561. });
  20562. } else {
  20563. options.progress(null, null, null, {
  20564. type: type
  20565. });
  20566. }
  20567. }
  20568. }
  20569. xhr.onprogress = function (event) {
  20570. handleProgress('download', event);
  20571. };
  20572. if (xhr.upload) {
  20573. xhr.upload.onprogress = function (event) {
  20574. handleProgress('upload', event);
  20575. };
  20576. }
  20577. xhr.open(method, url, true);
  20578. for (var h in headers) {
  20579. xhr.setRequestHeader(h, headers[h]);
  20580. }
  20581. xhr.onabort = function () {
  20582. promise.resolve({
  20583. response: {
  20584. results: []
  20585. },
  20586. status: 0,
  20587. xhr: xhr
  20588. });
  20589. };
  20590. xhr.send(data);
  20591. if (options && typeof options.requestTask === 'function') {
  20592. options.requestTask(xhr);
  20593. }
  20594. })();
  20595. return promise;
  20596. },
  20597. request: function request(method
  20598. /*: string*/
  20599. , path
  20600. /*: string*/
  20601. , data
  20602. /*: mixed*/
  20603. , options
  20604. /*:: ?: RequestOptions*/
  20605. ) {
  20606. options = options || {};
  20607. var url = _CoreManager.default.get('SERVER_URL');
  20608. if (url[url.length - 1] !== '/') {
  20609. url += '/';
  20610. }
  20611. url += path;
  20612. var payload = {};
  20613. if (data && (0, _typeof2.default)(data) === 'object') {
  20614. for (var k in data) {
  20615. payload[k] = data[k];
  20616. }
  20617. } // Add context
  20618. var context = options.context;
  20619. if (context !== undefined) {
  20620. payload._context = context;
  20621. }
  20622. if (method !== 'POST') {
  20623. payload._method = method;
  20624. method = 'POST';
  20625. }
  20626. payload._ApplicationId = _CoreManager.default.get('APPLICATION_ID');
  20627. var jsKey = _CoreManager.default.get('JAVASCRIPT_KEY');
  20628. if (jsKey) {
  20629. payload._JavaScriptKey = jsKey;
  20630. }
  20631. payload._ClientVersion = _CoreManager.default.get('VERSION');
  20632. var useMasterKey = options.useMasterKey;
  20633. if (typeof useMasterKey === 'undefined') {
  20634. useMasterKey = _CoreManager.default.get('USE_MASTER_KEY');
  20635. }
  20636. if (useMasterKey) {
  20637. if (_CoreManager.default.get('MASTER_KEY')) {
  20638. delete payload._JavaScriptKey;
  20639. payload._MasterKey = _CoreManager.default.get('MASTER_KEY');
  20640. } else {
  20641. throw new Error('Cannot use the Master Key, it has not been provided.');
  20642. }
  20643. }
  20644. if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
  20645. payload._RevocableSession = '1';
  20646. }
  20647. var installationId = options.installationId;
  20648. var installationIdPromise;
  20649. if (installationId && typeof installationId === 'string') {
  20650. installationIdPromise = _promise.default.resolve(installationId);
  20651. } else {
  20652. var installationController = _CoreManager.default.getInstallationController();
  20653. installationIdPromise = installationController.currentInstallationId();
  20654. }
  20655. return installationIdPromise.then(function (iid) {
  20656. payload._InstallationId = iid;
  20657. var userController = _CoreManager.default.getUserController();
  20658. if (options && typeof options.sessionToken === 'string') {
  20659. return _promise.default.resolve(options.sessionToken);
  20660. } else if (userController) {
  20661. return userController.currentUserAsync().then(function (user) {
  20662. if (user) {
  20663. return _promise.default.resolve(user.getSessionToken());
  20664. }
  20665. return _promise.default.resolve(null);
  20666. });
  20667. }
  20668. return _promise.default.resolve(null);
  20669. }).then(function (token) {
  20670. if (token) {
  20671. payload._SessionToken = token;
  20672. }
  20673. var payloadString = (0, _stringify.default)(payload);
  20674. return RESTController.ajax(method, url, payloadString, {}, options).then(function (_ref) {
  20675. var response = _ref.response,
  20676. status = _ref.status;
  20677. if (options.returnStatus) {
  20678. return _objectSpread(_objectSpread({}, response), {}, {
  20679. _status: status
  20680. });
  20681. } else {
  20682. return response;
  20683. }
  20684. });
  20685. }).catch(RESTController.handleError);
  20686. },
  20687. handleError: function handleError(response) {
  20688. // Transform the error into an instance of ParseError by trying to parse
  20689. // the error string as JSON
  20690. var error;
  20691. if (response && response.responseText) {
  20692. try {
  20693. var errorJSON = JSON.parse(response.responseText);
  20694. error = new _ParseError.default(errorJSON.code, errorJSON.error);
  20695. } catch (e) {
  20696. // If we fail to parse the error text, that's okay.
  20697. error = new _ParseError.default(_ParseError.default.INVALID_JSON, 'Received an error with invalid JSON from Parse: ' + response.responseText);
  20698. }
  20699. } else {
  20700. var message = response.message ? response.message : response;
  20701. error = new _ParseError.default(_ParseError.default.CONNECTION_FAILED, 'XMLHttpRequest failed: ' + (0, _stringify.default)(message));
  20702. }
  20703. return _promise.default.reject(error);
  20704. },
  20705. _setXHR: function _setXHR(xhr
  20706. /*: any*/
  20707. ) {
  20708. XHR = xhr;
  20709. },
  20710. _getXHR: function _getXHR() {
  20711. return XHR;
  20712. }
  20713. };
  20714. module.exports = RESTController;
  20715. }).call(this)}).call(this,_dereq_('_process'))
  20716. },{"./CoreManager":4,"./ParseError":21,"./Xhr.weapp":43,"./promiseUtils":52,"./uuid":55,"@babel/runtime-corejs3/core-js-stable/instance/filter":62,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/includes":66,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/define-properties":82,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":87,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":88,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/core-js-stable/set-timeout":96,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141,"_process":146}],37:[function(_dereq_,module,exports){
  20717. "use strict";
  20718. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  20719. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  20720. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  20721. var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
  20722. _Object$defineProperty(exports, "__esModule", {
  20723. value: true
  20724. });
  20725. exports.clearAllState = clearAllState;
  20726. exports.commitServerChanges = commitServerChanges;
  20727. exports.duplicateState = duplicateState;
  20728. exports.enqueueTask = enqueueTask;
  20729. exports.estimateAttribute = estimateAttribute;
  20730. exports.estimateAttributes = estimateAttributes;
  20731. exports.getObjectCache = getObjectCache;
  20732. exports.getPendingOps = getPendingOps;
  20733. exports.getServerData = getServerData;
  20734. exports.getState = getState;
  20735. exports.initializeState = initializeState;
  20736. exports.mergeFirstPendingState = mergeFirstPendingState;
  20737. exports.popPendingState = popPendingState;
  20738. exports.pushPendingState = pushPendingState;
  20739. exports.removeState = removeState;
  20740. exports.setPendingOp = setPendingOp;
  20741. exports.setServerData = setServerData;
  20742. var ObjectStateMutations = _interopRequireWildcard(_dereq_("./ObjectStateMutations"));
  20743. function _getRequireWildcardCache(nodeInterop) {
  20744. if (typeof _WeakMap !== "function") return null;
  20745. var cacheBabelInterop = new _WeakMap();
  20746. var cacheNodeInterop = new _WeakMap();
  20747. return (_getRequireWildcardCache = function (nodeInterop) {
  20748. return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
  20749. })(nodeInterop);
  20750. }
  20751. function _interopRequireWildcard(obj, nodeInterop) {
  20752. if (!nodeInterop && obj && obj.__esModule) {
  20753. return obj;
  20754. }
  20755. if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
  20756. return {
  20757. default: obj
  20758. };
  20759. }
  20760. var cache = _getRequireWildcardCache(nodeInterop);
  20761. if (cache && cache.has(obj)) {
  20762. return cache.get(obj);
  20763. }
  20764. var newObj = {};
  20765. for (var key in obj) {
  20766. if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
  20767. var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
  20768. if (desc && (desc.get || desc.set)) {
  20769. _Object$defineProperty(newObj, key, desc);
  20770. } else {
  20771. newObj[key] = obj[key];
  20772. }
  20773. }
  20774. }
  20775. newObj.default = obj;
  20776. if (cache) {
  20777. cache.set(obj, newObj);
  20778. }
  20779. return newObj;
  20780. }
  20781. /**
  20782. * Copyright (c) 2015-present, Parse, LLC.
  20783. * All rights reserved.
  20784. *
  20785. * This source code is licensed under the BSD-style license found in the
  20786. * LICENSE file in the root directory of this source tree. An additional grant
  20787. * of patent rights can be found in the PATENTS file in the same directory.
  20788. *
  20789. * @flow
  20790. */
  20791. var objectState
  20792. /*: {
  20793. [className: string]: {
  20794. [id: string]: State,
  20795. },
  20796. }*/
  20797. = {};
  20798. function getState(obj
  20799. /*: ObjectIdentifier*/
  20800. )
  20801. /*: ?State*/
  20802. {
  20803. var classData = objectState[obj.className];
  20804. if (classData) {
  20805. return classData[obj.id] || null;
  20806. }
  20807. return null;
  20808. }
  20809. function initializeState(obj
  20810. /*: ObjectIdentifier*/
  20811. , initial
  20812. /*:: ?: State*/
  20813. )
  20814. /*: State*/
  20815. {
  20816. var state = getState(obj);
  20817. if (state) {
  20818. return state;
  20819. }
  20820. if (!objectState[obj.className]) {
  20821. objectState[obj.className] = {};
  20822. }
  20823. if (!initial) {
  20824. initial = ObjectStateMutations.defaultState();
  20825. }
  20826. state = objectState[obj.className][obj.id] = initial;
  20827. return state;
  20828. }
  20829. function removeState(obj
  20830. /*: ObjectIdentifier*/
  20831. )
  20832. /*: ?State*/
  20833. {
  20834. var state = getState(obj);
  20835. if (state === null) {
  20836. return null;
  20837. }
  20838. delete objectState[obj.className][obj.id];
  20839. return state;
  20840. }
  20841. function getServerData(obj
  20842. /*: ObjectIdentifier*/
  20843. )
  20844. /*: AttributeMap*/
  20845. {
  20846. var state = getState(obj);
  20847. if (state) {
  20848. return state.serverData;
  20849. }
  20850. return {};
  20851. }
  20852. function setServerData(obj
  20853. /*: ObjectIdentifier*/
  20854. , attributes
  20855. /*: AttributeMap*/
  20856. ) {
  20857. var serverData = initializeState(obj).serverData;
  20858. ObjectStateMutations.setServerData(serverData, attributes);
  20859. }
  20860. function getPendingOps(obj
  20861. /*: ObjectIdentifier*/
  20862. )
  20863. /*: Array<OpsMap>*/
  20864. {
  20865. var state = getState(obj);
  20866. if (state) {
  20867. return state.pendingOps;
  20868. }
  20869. return [{}];
  20870. }
  20871. function setPendingOp(obj
  20872. /*: ObjectIdentifier*/
  20873. , attr
  20874. /*: string*/
  20875. , op
  20876. /*: ?Op*/
  20877. ) {
  20878. var pendingOps = initializeState(obj).pendingOps;
  20879. ObjectStateMutations.setPendingOp(pendingOps, attr, op);
  20880. }
  20881. function pushPendingState(obj
  20882. /*: ObjectIdentifier*/
  20883. ) {
  20884. var pendingOps = initializeState(obj).pendingOps;
  20885. ObjectStateMutations.pushPendingState(pendingOps);
  20886. }
  20887. function popPendingState(obj
  20888. /*: ObjectIdentifier*/
  20889. )
  20890. /*: OpsMap*/
  20891. {
  20892. var pendingOps = initializeState(obj).pendingOps;
  20893. return ObjectStateMutations.popPendingState(pendingOps);
  20894. }
  20895. function mergeFirstPendingState(obj
  20896. /*: ObjectIdentifier*/
  20897. ) {
  20898. var pendingOps = getPendingOps(obj);
  20899. ObjectStateMutations.mergeFirstPendingState(pendingOps);
  20900. }
  20901. function getObjectCache(obj
  20902. /*: ObjectIdentifier*/
  20903. )
  20904. /*: ObjectCache*/
  20905. {
  20906. var state = getState(obj);
  20907. if (state) {
  20908. return state.objectCache;
  20909. }
  20910. return {};
  20911. }
  20912. function estimateAttribute(obj
  20913. /*: ObjectIdentifier*/
  20914. , attr
  20915. /*: string*/
  20916. )
  20917. /*: mixed*/
  20918. {
  20919. var serverData = getServerData(obj);
  20920. var pendingOps = getPendingOps(obj);
  20921. return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
  20922. }
  20923. function estimateAttributes(obj
  20924. /*: ObjectIdentifier*/
  20925. )
  20926. /*: AttributeMap*/
  20927. {
  20928. var serverData = getServerData(obj);
  20929. var pendingOps = getPendingOps(obj);
  20930. return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
  20931. }
  20932. function commitServerChanges(obj
  20933. /*: ObjectIdentifier*/
  20934. , changes
  20935. /*: AttributeMap*/
  20936. ) {
  20937. var state = initializeState(obj);
  20938. ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
  20939. }
  20940. function enqueueTask(obj
  20941. /*: ObjectIdentifier*/
  20942. , task
  20943. /*: () => Promise*/
  20944. )
  20945. /*: Promise*/
  20946. {
  20947. var state = initializeState(obj);
  20948. return state.tasks.enqueue(task);
  20949. }
  20950. function clearAllState() {
  20951. objectState = {};
  20952. }
  20953. function duplicateState(source
  20954. /*: { id: string }*/
  20955. , dest
  20956. /*: { id: string }*/
  20957. ) {
  20958. dest.id = source.id;
  20959. }
  20960. },{"./ObjectStateMutations":15,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/weak-map":99,"@babel/runtime-corejs3/helpers/typeof":141}],38:[function(_dereq_,module,exports){
  20961. "use strict";
  20962. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  20963. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  20964. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  20965. module.exports = /*#__PURE__*/function () {
  20966. function SocketWeapp(serverURL) {
  20967. var _this = this;
  20968. (0, _classCallCheck2.default)(this, SocketWeapp);
  20969. this.onopen = function () {};
  20970. this.onmessage = function () {};
  20971. this.onclose = function () {};
  20972. this.onerror = function () {};
  20973. wx.onSocketOpen(function () {
  20974. _this.onopen();
  20975. });
  20976. wx.onSocketMessage(function (msg) {
  20977. _this.onmessage(msg);
  20978. });
  20979. wx.onSocketClose(function () {
  20980. _this.onclose();
  20981. });
  20982. wx.onSocketError(function (error) {
  20983. _this.onerror(error);
  20984. });
  20985. wx.connectSocket({
  20986. url: serverURL
  20987. });
  20988. }
  20989. (0, _createClass2.default)(SocketWeapp, [{
  20990. key: "send",
  20991. value: function (data) {
  20992. wx.sendSocketMessage({
  20993. data: data
  20994. });
  20995. }
  20996. }, {
  20997. key: "close",
  20998. value: function () {
  20999. wx.closeSocket();
  21000. }
  21001. }]);
  21002. return SocketWeapp;
  21003. }();
  21004. },{"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],39:[function(_dereq_,module,exports){
  21005. "use strict";
  21006. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21007. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
  21008. var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
  21009. /**
  21010. * Copyright (c) 2015-present, Parse, LLC.
  21011. * All rights reserved.
  21012. *
  21013. * This source code is licensed under the BSD-style license found in the
  21014. * LICENSE file in the root directory of this source tree. An additional grant
  21015. * of patent rights can be found in the PATENTS file in the same directory.
  21016. *
  21017. * @flow
  21018. */
  21019. var Storage = {
  21020. async: function ()
  21021. /*: boolean*/
  21022. {
  21023. var controller = _CoreManager.default.getStorageController();
  21024. return !!controller.async;
  21025. },
  21026. getItem: function (path
  21027. /*: string*/
  21028. )
  21029. /*: ?string*/
  21030. {
  21031. var controller = _CoreManager.default.getStorageController();
  21032. if (controller.async === 1) {
  21033. throw new Error('Synchronous storage is not supported by the current storage controller');
  21034. }
  21035. return controller.getItem(path);
  21036. },
  21037. getItemAsync: function (path
  21038. /*: string*/
  21039. )
  21040. /*: Promise<string>*/
  21041. {
  21042. var controller = _CoreManager.default.getStorageController();
  21043. if (controller.async === 1) {
  21044. return controller.getItemAsync(path);
  21045. }
  21046. return _promise.default.resolve(controller.getItem(path));
  21047. },
  21048. setItem: function (path
  21049. /*: string*/
  21050. , value
  21051. /*: string*/
  21052. )
  21053. /*: void*/
  21054. {
  21055. var controller = _CoreManager.default.getStorageController();
  21056. if (controller.async === 1) {
  21057. throw new Error('Synchronous storage is not supported by the current storage controller');
  21058. }
  21059. return controller.setItem(path, value);
  21060. },
  21061. setItemAsync: function (path
  21062. /*: string*/
  21063. , value
  21064. /*: string*/
  21065. )
  21066. /*: Promise<void>*/
  21067. {
  21068. var controller = _CoreManager.default.getStorageController();
  21069. if (controller.async === 1) {
  21070. return controller.setItemAsync(path, value);
  21071. }
  21072. return _promise.default.resolve(controller.setItem(path, value));
  21073. },
  21074. removeItem: function (path
  21075. /*: string*/
  21076. )
  21077. /*: void*/
  21078. {
  21079. var controller = _CoreManager.default.getStorageController();
  21080. if (controller.async === 1) {
  21081. throw new Error('Synchronous storage is not supported by the current storage controller');
  21082. }
  21083. return controller.removeItem(path);
  21084. },
  21085. removeItemAsync: function (path
  21086. /*: string*/
  21087. )
  21088. /*: Promise<void>*/
  21089. {
  21090. var controller = _CoreManager.default.getStorageController();
  21091. if (controller.async === 1) {
  21092. return controller.removeItemAsync(path);
  21093. }
  21094. return _promise.default.resolve(controller.removeItem(path));
  21095. },
  21096. getAllKeys: function ()
  21097. /*: Array<string>*/
  21098. {
  21099. var controller = _CoreManager.default.getStorageController();
  21100. if (controller.async === 1) {
  21101. throw new Error('Synchronous storage is not supported by the current storage controller');
  21102. }
  21103. return controller.getAllKeys();
  21104. },
  21105. getAllKeysAsync: function ()
  21106. /*: Promise<Array<string>>*/
  21107. {
  21108. var controller = _CoreManager.default.getStorageController();
  21109. if (controller.async === 1) {
  21110. return controller.getAllKeysAsync();
  21111. }
  21112. return _promise.default.resolve(controller.getAllKeys());
  21113. },
  21114. generatePath: function (path
  21115. /*: string*/
  21116. )
  21117. /*: string*/
  21118. {
  21119. if (!_CoreManager.default.get('APPLICATION_ID')) {
  21120. throw new Error('You need to call Parse.initialize before using Parse.');
  21121. }
  21122. if (typeof path !== 'string') {
  21123. throw new Error('Tried to get a Storage path that was not a String.');
  21124. }
  21125. if (path[0] === '/') {
  21126. path = path.substr(1);
  21127. }
  21128. return 'Parse/' + _CoreManager.default.get('APPLICATION_ID') + '/' + path;
  21129. },
  21130. _clear: function () {
  21131. var controller = _CoreManager.default.getStorageController();
  21132. if (controller.hasOwnProperty('clear')) {
  21133. controller.clear();
  21134. }
  21135. }
  21136. };
  21137. module.exports = Storage;
  21138. _CoreManager.default.setStorageController(_dereq_('./StorageController.weapp'));
  21139. },{"./CoreManager":4,"./StorageController.weapp":40,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],40:[function(_dereq_,module,exports){
  21140. "use strict";
  21141. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21142. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
  21143. /**
  21144. * Copyright (c) 2015-present, Parse, LLC.
  21145. * All rights reserved.
  21146. *
  21147. * This source code is licensed under the BSD-style license found in the
  21148. * LICENSE file in the root directory of this source tree. An additional grant
  21149. * of patent rights can be found in the PATENTS file in the same directory.
  21150. *
  21151. * @flow
  21152. * @private
  21153. */
  21154. var StorageController = {
  21155. async: 0,
  21156. getItem: function (path
  21157. /*: string*/
  21158. )
  21159. /*: ?string*/
  21160. {
  21161. return wx.getStorageSync(path);
  21162. },
  21163. setItem: function (path
  21164. /*: string*/
  21165. , value
  21166. /*: string*/
  21167. ) {
  21168. try {
  21169. wx.setStorageSync(path, value);
  21170. } catch (e) {// Quota exceeded
  21171. }
  21172. },
  21173. removeItem: function (path
  21174. /*: string*/
  21175. ) {
  21176. wx.removeStorageSync(path);
  21177. },
  21178. getAllKeys: function () {
  21179. var res = wx.getStorageInfoSync();
  21180. return (0, _keys.default)(res);
  21181. },
  21182. clear: function () {
  21183. wx.clearStorageSync();
  21184. }
  21185. };
  21186. module.exports = StorageController;
  21187. },{"@babel/runtime-corejs3/core-js-stable/instance/keys":68,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],41:[function(_dereq_,module,exports){
  21188. "use strict";
  21189. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21190. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  21191. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  21192. var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
  21193. var _promiseUtils = _dereq_("./promiseUtils");
  21194. /**
  21195. * Copyright (c) 2015-present, Parse, LLC.
  21196. * All rights reserved.
  21197. *
  21198. * This source code is licensed under the BSD-style license found in the
  21199. * LICENSE file in the root directory of this source tree. An additional grant
  21200. * of patent rights can be found in the PATENTS file in the same directory.
  21201. *
  21202. * @flow
  21203. */
  21204. var TaskQueue = /*#__PURE__*/function () {
  21205. function TaskQueue() {
  21206. (0, _classCallCheck2.default)(this, TaskQueue);
  21207. (0, _defineProperty2.default)(this, "queue", void 0);
  21208. this.queue = [];
  21209. }
  21210. (0, _createClass2.default)(TaskQueue, [{
  21211. key: "enqueue",
  21212. value: function (task
  21213. /*: () => Promise*/
  21214. )
  21215. /*: Promise*/
  21216. {
  21217. var _this = this;
  21218. var taskComplete = new _promiseUtils.resolvingPromise();
  21219. this.queue.push({
  21220. task: task,
  21221. _completion: taskComplete
  21222. });
  21223. if (this.queue.length === 1) {
  21224. task().then(function () {
  21225. _this._dequeue();
  21226. taskComplete.resolve();
  21227. }, function (error) {
  21228. _this._dequeue();
  21229. taskComplete.reject(error);
  21230. });
  21231. }
  21232. return taskComplete;
  21233. }
  21234. }, {
  21235. key: "_dequeue",
  21236. value: function () {
  21237. var _this2 = this;
  21238. this.queue.shift();
  21239. if (this.queue.length) {
  21240. var next = this.queue[0];
  21241. next.task().then(function () {
  21242. _this2._dequeue();
  21243. next._completion.resolve();
  21244. }, function (error) {
  21245. _this2._dequeue();
  21246. next._completion.reject(error);
  21247. });
  21248. }
  21249. }
  21250. }]);
  21251. return TaskQueue;
  21252. }();
  21253. module.exports = TaskQueue;
  21254. },{"./promiseUtils":52,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],42:[function(_dereq_,module,exports){
  21255. "use strict";
  21256. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21257. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  21258. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21259. var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
  21260. var _WeakMap2 = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
  21261. _Object$defineProperty(exports, "__esModule", {
  21262. value: true
  21263. });
  21264. exports.clearAllState = clearAllState;
  21265. exports.commitServerChanges = commitServerChanges;
  21266. exports.duplicateState = duplicateState;
  21267. exports.enqueueTask = enqueueTask;
  21268. exports.estimateAttribute = estimateAttribute;
  21269. exports.estimateAttributes = estimateAttributes;
  21270. exports.getObjectCache = getObjectCache;
  21271. exports.getPendingOps = getPendingOps;
  21272. exports.getServerData = getServerData;
  21273. exports.getState = getState;
  21274. exports.initializeState = initializeState;
  21275. exports.mergeFirstPendingState = mergeFirstPendingState;
  21276. exports.popPendingState = popPendingState;
  21277. exports.pushPendingState = pushPendingState;
  21278. exports.removeState = removeState;
  21279. exports.setPendingOp = setPendingOp;
  21280. exports.setServerData = setServerData;
  21281. var _weakMap = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/weak-map"));
  21282. var ObjectStateMutations = _interopRequireWildcard(_dereq_("./ObjectStateMutations"));
  21283. var _TaskQueue = _interopRequireDefault(_dereq_("./TaskQueue"));
  21284. function _getRequireWildcardCache(nodeInterop) {
  21285. if (typeof _WeakMap2 !== "function") return null;
  21286. var cacheBabelInterop = new _WeakMap2();
  21287. var cacheNodeInterop = new _WeakMap2();
  21288. return (_getRequireWildcardCache = function (nodeInterop) {
  21289. return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
  21290. })(nodeInterop);
  21291. }
  21292. function _interopRequireWildcard(obj, nodeInterop) {
  21293. if (!nodeInterop && obj && obj.__esModule) {
  21294. return obj;
  21295. }
  21296. if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
  21297. return {
  21298. default: obj
  21299. };
  21300. }
  21301. var cache = _getRequireWildcardCache(nodeInterop);
  21302. if (cache && cache.has(obj)) {
  21303. return cache.get(obj);
  21304. }
  21305. var newObj = {};
  21306. for (var key in obj) {
  21307. if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
  21308. var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
  21309. if (desc && (desc.get || desc.set)) {
  21310. _Object$defineProperty(newObj, key, desc);
  21311. } else {
  21312. newObj[key] = obj[key];
  21313. }
  21314. }
  21315. }
  21316. newObj.default = obj;
  21317. if (cache) {
  21318. cache.set(obj, newObj);
  21319. }
  21320. return newObj;
  21321. }
  21322. /**
  21323. * Copyright (c) 2015-present, Parse, LLC.
  21324. * All rights reserved.
  21325. *
  21326. * This source code is licensed under the BSD-style license found in the
  21327. * LICENSE file in the root directory of this source tree. An additional grant
  21328. * of patent rights can be found in the PATENTS file in the same directory.
  21329. *
  21330. * @flow
  21331. */
  21332. var objectState = new _weakMap.default();
  21333. function getState(obj
  21334. /*: ParseObject*/
  21335. )
  21336. /*: ?State*/
  21337. {
  21338. var classData = objectState.get(obj);
  21339. return classData || null;
  21340. }
  21341. function initializeState(obj
  21342. /*: ParseObject*/
  21343. , initial
  21344. /*:: ?: State*/
  21345. )
  21346. /*: State*/
  21347. {
  21348. var state = getState(obj);
  21349. if (state) {
  21350. return state;
  21351. }
  21352. if (!initial) {
  21353. initial = {
  21354. serverData: {},
  21355. pendingOps: [{}],
  21356. objectCache: {},
  21357. tasks: new _TaskQueue.default(),
  21358. existed: false
  21359. };
  21360. }
  21361. state = initial;
  21362. objectState.set(obj, state);
  21363. return state;
  21364. }
  21365. function removeState(obj
  21366. /*: ParseObject*/
  21367. )
  21368. /*: ?State*/
  21369. {
  21370. var state = getState(obj);
  21371. if (state === null) {
  21372. return null;
  21373. }
  21374. objectState.delete(obj);
  21375. return state;
  21376. }
  21377. function getServerData(obj
  21378. /*: ParseObject*/
  21379. )
  21380. /*: AttributeMap*/
  21381. {
  21382. var state = getState(obj);
  21383. if (state) {
  21384. return state.serverData;
  21385. }
  21386. return {};
  21387. }
  21388. function setServerData(obj
  21389. /*: ParseObject*/
  21390. , attributes
  21391. /*: AttributeMap*/
  21392. ) {
  21393. var serverData = initializeState(obj).serverData;
  21394. ObjectStateMutations.setServerData(serverData, attributes);
  21395. }
  21396. function getPendingOps(obj
  21397. /*: ParseObject*/
  21398. )
  21399. /*: Array<OpsMap>*/
  21400. {
  21401. var state = getState(obj);
  21402. if (state) {
  21403. return state.pendingOps;
  21404. }
  21405. return [{}];
  21406. }
  21407. function setPendingOp(obj
  21408. /*: ParseObject*/
  21409. , attr
  21410. /*: string*/
  21411. , op
  21412. /*: ?Op*/
  21413. ) {
  21414. var pendingOps = initializeState(obj).pendingOps;
  21415. ObjectStateMutations.setPendingOp(pendingOps, attr, op);
  21416. }
  21417. function pushPendingState(obj
  21418. /*: ParseObject*/
  21419. ) {
  21420. var pendingOps = initializeState(obj).pendingOps;
  21421. ObjectStateMutations.pushPendingState(pendingOps);
  21422. }
  21423. function popPendingState(obj
  21424. /*: ParseObject*/
  21425. )
  21426. /*: OpsMap*/
  21427. {
  21428. var pendingOps = initializeState(obj).pendingOps;
  21429. return ObjectStateMutations.popPendingState(pendingOps);
  21430. }
  21431. function mergeFirstPendingState(obj
  21432. /*: ParseObject*/
  21433. ) {
  21434. var pendingOps = getPendingOps(obj);
  21435. ObjectStateMutations.mergeFirstPendingState(pendingOps);
  21436. }
  21437. function getObjectCache(obj
  21438. /*: ParseObject*/
  21439. )
  21440. /*: ObjectCache*/
  21441. {
  21442. var state = getState(obj);
  21443. if (state) {
  21444. return state.objectCache;
  21445. }
  21446. return {};
  21447. }
  21448. function estimateAttribute(obj
  21449. /*: ParseObject*/
  21450. , attr
  21451. /*: string*/
  21452. )
  21453. /*: mixed*/
  21454. {
  21455. var serverData = getServerData(obj);
  21456. var pendingOps = getPendingOps(obj);
  21457. return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
  21458. }
  21459. function estimateAttributes(obj
  21460. /*: ParseObject*/
  21461. )
  21462. /*: AttributeMap*/
  21463. {
  21464. var serverData = getServerData(obj);
  21465. var pendingOps = getPendingOps(obj);
  21466. return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
  21467. }
  21468. function commitServerChanges(obj
  21469. /*: ParseObject*/
  21470. , changes
  21471. /*: AttributeMap*/
  21472. ) {
  21473. var state = initializeState(obj);
  21474. ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
  21475. }
  21476. function enqueueTask(obj
  21477. /*: ParseObject*/
  21478. , task
  21479. /*: () => Promise*/
  21480. )
  21481. /*: Promise*/
  21482. {
  21483. var state = initializeState(obj);
  21484. return state.tasks.enqueue(task);
  21485. }
  21486. function duplicateState(source
  21487. /*: ParseObject*/
  21488. , dest
  21489. /*: ParseObject*/
  21490. )
  21491. /*: void*/
  21492. {
  21493. var oldState = initializeState(source);
  21494. var newState = initializeState(dest);
  21495. for (var key in oldState.serverData) {
  21496. newState.serverData[key] = oldState.serverData[key];
  21497. }
  21498. for (var index = 0; index < oldState.pendingOps.length; index++) {
  21499. for (var _key in oldState.pendingOps[index]) {
  21500. newState.pendingOps[index][_key] = oldState.pendingOps[index][_key];
  21501. }
  21502. }
  21503. for (var _key2 in oldState.objectCache) {
  21504. newState.objectCache[_key2] = oldState.objectCache[_key2];
  21505. }
  21506. newState.existed = oldState.existed;
  21507. }
  21508. function clearAllState() {
  21509. objectState = new _weakMap.default();
  21510. }
  21511. },{"./ObjectStateMutations":15,"./TaskQueue":41,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/weak-map":99,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],43:[function(_dereq_,module,exports){
  21512. "use strict";
  21513. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21514. var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  21515. var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
  21516. var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
  21517. module.exports = /*#__PURE__*/function () {
  21518. function XhrWeapp() {
  21519. (0, _classCallCheck2.default)(this, XhrWeapp);
  21520. this.UNSENT = 0;
  21521. this.OPENED = 1;
  21522. this.HEADERS_RECEIVED = 2;
  21523. this.LOADING = 3;
  21524. this.DONE = 4;
  21525. this.header = {};
  21526. this.readyState = this.DONE;
  21527. this.status = 0;
  21528. this.response = '';
  21529. this.responseType = '';
  21530. this.responseText = '';
  21531. this.responseHeader = {};
  21532. this.method = '';
  21533. this.url = '';
  21534. this.onabort = function () {};
  21535. this.onprogress = function () {};
  21536. this.onerror = function () {};
  21537. this.onreadystatechange = function () {};
  21538. this.requestTask = null;
  21539. }
  21540. (0, _createClass2.default)(XhrWeapp, [{
  21541. key: "getAllResponseHeaders",
  21542. value: function () {
  21543. var header = '';
  21544. for (var key in this.responseHeader) {
  21545. header += key + ':' + this.getResponseHeader(key) + '\r\n';
  21546. }
  21547. return header;
  21548. }
  21549. }, {
  21550. key: "getResponseHeader",
  21551. value: function (key) {
  21552. return this.responseHeader[key];
  21553. }
  21554. }, {
  21555. key: "setRequestHeader",
  21556. value: function (key, value) {
  21557. this.header[key] = value;
  21558. }
  21559. }, {
  21560. key: "open",
  21561. value: function (method, url) {
  21562. this.method = method;
  21563. this.url = url;
  21564. }
  21565. }, {
  21566. key: "abort",
  21567. value: function () {
  21568. if (!this.requestTask) {
  21569. return;
  21570. }
  21571. this.requestTask.abort();
  21572. this.status = 0;
  21573. this.response = undefined;
  21574. this.onabort();
  21575. this.onreadystatechange();
  21576. }
  21577. }, {
  21578. key: "send",
  21579. value: function (data) {
  21580. var _this = this;
  21581. this.requestTask = wx.request({
  21582. url: this.url,
  21583. method: this.method,
  21584. data: data,
  21585. header: this.header,
  21586. responseType: this.responseType,
  21587. success: function (res) {
  21588. _this.status = res.statusCode;
  21589. _this.response = res.data;
  21590. _this.responseHeader = res.header;
  21591. _this.responseText = (0, _stringify.default)(res.data);
  21592. _this.requestTask = null;
  21593. _this.onreadystatechange();
  21594. },
  21595. fail: function (err) {
  21596. _this.requestTask = null;
  21597. _this.onerror(err);
  21598. }
  21599. });
  21600. this.requestTask.onProgressUpdate(function (res) {
  21601. var event = {
  21602. lengthComputable: res.totalBytesExpectedToWrite !== 0,
  21603. loaded: res.totalBytesWritten,
  21604. total: res.totalBytesExpectedToWrite
  21605. };
  21606. _this.onprogress(event);
  21607. });
  21608. }
  21609. }]);
  21610. return XhrWeapp;
  21611. }();
  21612. },{"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],44:[function(_dereq_,module,exports){
  21613. "use strict";
  21614. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21615. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21616. _Object$defineProperty(exports, "__esModule", {
  21617. value: true
  21618. });
  21619. exports.default = arrayContainsObject;
  21620. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  21621. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  21622. /**
  21623. * Copyright (c) 2015-present, Parse, LLC.
  21624. * All rights reserved.
  21625. *
  21626. * This source code is licensed under the BSD-style license found in the
  21627. * LICENSE file in the root directory of this source tree. An additional grant
  21628. * of patent rights can be found in the PATENTS file in the same directory.
  21629. *
  21630. * @flow
  21631. */
  21632. function arrayContainsObject(array
  21633. /*: Array<any>*/
  21634. , object
  21635. /*: ParseObject*/
  21636. )
  21637. /*: boolean*/
  21638. {
  21639. if ((0, _indexOf.default)(array).call(array, object) > -1) {
  21640. return true;
  21641. }
  21642. for (var i = 0; i < array.length; i++) {
  21643. if (array[i] instanceof _ParseObject.default && array[i].className === object.className && array[i]._getId() === object._getId()) {
  21644. return true;
  21645. }
  21646. }
  21647. return false;
  21648. }
  21649. },{"./ParseObject":26,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],45:[function(_dereq_,module,exports){
  21650. "use strict";
  21651. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21652. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21653. _Object$defineProperty(exports, "__esModule", {
  21654. value: true
  21655. });
  21656. exports.default = canBeSerialized;
  21657. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  21658. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  21659. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  21660. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  21661. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  21662. /**
  21663. * Copyright (c) 2015-present, Parse, LLC.
  21664. * All rights reserved.
  21665. *
  21666. * This source code is licensed under the BSD-style license found in the
  21667. * LICENSE file in the root directory of this source tree. An additional grant
  21668. * of patent rights can be found in the PATENTS file in the same directory.
  21669. *
  21670. * @flow
  21671. */
  21672. function canBeSerialized(obj
  21673. /*: ParseObject*/
  21674. )
  21675. /*: boolean*/
  21676. {
  21677. if (!(obj instanceof _ParseObject.default)) {
  21678. return true;
  21679. }
  21680. var attributes = obj.attributes;
  21681. for (var attr in attributes) {
  21682. var val = attributes[attr];
  21683. if (!canBeSerializedHelper(val)) {
  21684. return false;
  21685. }
  21686. }
  21687. return true;
  21688. }
  21689. function canBeSerializedHelper(value
  21690. /*: any*/
  21691. )
  21692. /*: boolean*/
  21693. {
  21694. if ((0, _typeof2.default)(value) !== 'object') {
  21695. return true;
  21696. }
  21697. if (value instanceof _ParseRelation.default) {
  21698. return true;
  21699. }
  21700. if (value instanceof _ParseObject.default) {
  21701. return !!value.id;
  21702. }
  21703. if (value instanceof _ParseFile.default) {
  21704. if (value.url()) {
  21705. return true;
  21706. }
  21707. return false;
  21708. }
  21709. if ((0, _isArray.default)(value)) {
  21710. for (var i = 0; i < value.length; i++) {
  21711. if (!canBeSerializedHelper(value[i])) {
  21712. return false;
  21713. }
  21714. }
  21715. return true;
  21716. }
  21717. for (var k in value) {
  21718. if (!canBeSerializedHelper(value[k])) {
  21719. return false;
  21720. }
  21721. }
  21722. return true;
  21723. }
  21724. },{"./ParseFile":22,"./ParseObject":26,"./ParseRelation":30,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],46:[function(_dereq_,module,exports){
  21725. "use strict";
  21726. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21727. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21728. _Object$defineProperty(exports, "__esModule", {
  21729. value: true
  21730. });
  21731. exports.default = decode;
  21732. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  21733. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  21734. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  21735. var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
  21736. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  21737. var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
  21738. var _ParsePolygon = _interopRequireDefault(_dereq_("./ParsePolygon"));
  21739. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  21740. var _ParseOp = _dereq_("./ParseOp");
  21741. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  21742. /**
  21743. * Copyright (c) 2015-present, Parse, LLC.
  21744. * All rights reserved.
  21745. *
  21746. * This source code is licensed under the BSD-style license found in the
  21747. * LICENSE file in the root directory of this source tree. An additional grant
  21748. * of patent rights can be found in the PATENTS file in the same directory.
  21749. *
  21750. * @flow
  21751. */
  21752. // eslint-disable-line no-unused-vars
  21753. function decode(value
  21754. /*: any*/
  21755. )
  21756. /*: any*/
  21757. {
  21758. if (value === null || (0, _typeof2.default)(value) !== 'object' || value instanceof Date) {
  21759. return value;
  21760. }
  21761. if ((0, _isArray.default)(value)) {
  21762. var dup = [];
  21763. (0, _forEach.default)(value).call(value, function (v, i) {
  21764. dup[i] = decode(v);
  21765. });
  21766. return dup;
  21767. }
  21768. if (typeof value.__op === 'string') {
  21769. return (0, _ParseOp.opFromJSON)(value);
  21770. }
  21771. if (value.__type === 'Pointer' && value.className) {
  21772. return _ParseObject.default.fromJSON(value);
  21773. }
  21774. if (value.__type === 'Object' && value.className) {
  21775. return _ParseObject.default.fromJSON(value);
  21776. }
  21777. if (value.__type === 'Relation') {
  21778. // The parent and key fields will be populated by the parent
  21779. var relation = new _ParseRelation.default(null, null);
  21780. relation.targetClassName = value.className;
  21781. return relation;
  21782. }
  21783. if (value.__type === 'Date') {
  21784. return new Date(value.iso);
  21785. }
  21786. if (value.__type === 'File') {
  21787. return _ParseFile.default.fromJSON(value);
  21788. }
  21789. if (value.__type === 'GeoPoint') {
  21790. return new _ParseGeoPoint.default({
  21791. latitude: value.latitude,
  21792. longitude: value.longitude
  21793. });
  21794. }
  21795. if (value.__type === 'Polygon') {
  21796. return new _ParsePolygon.default(value.coordinates);
  21797. }
  21798. var copy = {};
  21799. for (var k in value) {
  21800. copy[k] = decode(value[k]);
  21801. }
  21802. return copy;
  21803. }
  21804. },{"./ParseACL":18,"./ParseFile":22,"./ParseGeoPoint":23,"./ParseObject":26,"./ParseOp":27,"./ParsePolygon":28,"./ParseRelation":30,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],47:[function(_dereq_,module,exports){
  21805. "use strict";
  21806. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21807. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21808. _Object$defineProperty(exports, "__esModule", {
  21809. value: true
  21810. });
  21811. exports.default = _default;
  21812. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  21813. var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
  21814. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  21815. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  21816. var _startsWith = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
  21817. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  21818. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  21819. var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
  21820. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  21821. var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
  21822. var _ParsePolygon = _interopRequireDefault(_dereq_("./ParsePolygon"));
  21823. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  21824. var _ParseOp = _dereq_("./ParseOp");
  21825. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  21826. /**
  21827. * Copyright (c) 2015-present, Parse, LLC.
  21828. * All rights reserved.
  21829. *
  21830. * This source code is licensed under the BSD-style license found in the
  21831. * LICENSE file in the root directory of this source tree. An additional grant
  21832. * of patent rights can be found in the PATENTS file in the same directory.
  21833. *
  21834. * @flow
  21835. */
  21836. function encode(value
  21837. /*: mixed*/
  21838. , disallowObjects
  21839. /*: boolean*/
  21840. , forcePointers
  21841. /*: boolean*/
  21842. , seen
  21843. /*: Array<mixed>*/
  21844. , offline
  21845. /*: boolean*/
  21846. )
  21847. /*: any*/
  21848. {
  21849. if (value instanceof _ParseObject.default) {
  21850. if (disallowObjects) {
  21851. throw new Error('Parse Objects not allowed here');
  21852. }
  21853. var seenEntry = value.id ? value.className + ':' + value.id : value;
  21854. if (forcePointers || !seen || (0, _indexOf.default)(seen).call(seen, seenEntry) > -1 || value.dirty() || (0, _keys.default)(value._getServerData()).length < 1) {
  21855. var _context;
  21856. if (offline && (0, _startsWith.default)(_context = value._getId()).call(_context, 'local')) {
  21857. return value.toOfflinePointer();
  21858. }
  21859. return value.toPointer();
  21860. }
  21861. seen = (0, _concat.default)(seen).call(seen, seenEntry);
  21862. return value._toFullJSON(seen, offline);
  21863. }
  21864. if (value instanceof _ParseOp.Op || value instanceof _ParseACL.default || value instanceof _ParseGeoPoint.default || value instanceof _ParsePolygon.default || value instanceof _ParseRelation.default) {
  21865. return value.toJSON();
  21866. }
  21867. if (value instanceof _ParseFile.default) {
  21868. if (!value.url()) {
  21869. throw new Error('Tried to encode an unsaved file.');
  21870. }
  21871. return value.toJSON();
  21872. }
  21873. if (Object.prototype.toString.call(value) === '[object Date]') {
  21874. if (isNaN(value)) {
  21875. throw new Error('Tried to encode an invalid date.');
  21876. }
  21877. return {
  21878. __type: 'Date',
  21879. iso: value
  21880. /*: any*/
  21881. .toJSON()
  21882. };
  21883. }
  21884. if (Object.prototype.toString.call(value) === '[object RegExp]' && typeof value.source === 'string') {
  21885. return value.source;
  21886. }
  21887. if ((0, _isArray.default)(value)) {
  21888. return (0, _map.default)(value).call(value, function (v) {
  21889. return encode(v, disallowObjects, forcePointers, seen, offline);
  21890. });
  21891. }
  21892. if (value && (0, _typeof2.default)(value) === 'object') {
  21893. var output = {};
  21894. for (var k in value) {
  21895. output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
  21896. }
  21897. return output;
  21898. }
  21899. return value;
  21900. }
  21901. function _default(value
  21902. /*: mixed*/
  21903. , disallowObjects
  21904. /*:: ?: boolean*/
  21905. , forcePointers
  21906. /*:: ?: boolean*/
  21907. , seen
  21908. /*:: ?: Array<mixed>*/
  21909. , offline
  21910. /*:: ?: boolean*/
  21911. )
  21912. /*: any*/
  21913. {
  21914. return encode(value, !!disallowObjects, !!forcePointers, seen || [], offline);
  21915. }
  21916. },{"./ParseACL":18,"./ParseFile":22,"./ParseGeoPoint":23,"./ParseObject":26,"./ParseOp":27,"./ParsePolygon":28,"./ParseRelation":30,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/map":69,"@babel/runtime-corejs3/core-js-stable/instance/starts-with":75,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],48:[function(_dereq_,module,exports){
  21917. "use strict";
  21918. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  21919. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21920. _Object$defineProperty(exports, "__esModule", {
  21921. value: true
  21922. });
  21923. exports.default = equals;
  21924. var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
  21925. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  21926. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  21927. var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
  21928. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  21929. var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
  21930. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  21931. /**
  21932. * Copyright (c) 2015-present, Parse, LLC.
  21933. * All rights reserved.
  21934. *
  21935. * This source code is licensed under the BSD-style license found in the
  21936. * LICENSE file in the root directory of this source tree. An additional grant
  21937. * of patent rights can be found in the PATENTS file in the same directory.
  21938. */
  21939. function equals(a, b) {
  21940. var toString = Object.prototype.toString;
  21941. if (toString.call(a) === '[object Date]' || toString.call(b) === '[object Date]') {
  21942. var dateA = new Date(a);
  21943. var dateB = new Date(b);
  21944. return +dateA === +dateB;
  21945. }
  21946. if ((0, _typeof2.default)(a) !== (0, _typeof2.default)(b)) {
  21947. return false;
  21948. }
  21949. if (!a || (0, _typeof2.default)(a) !== 'object') {
  21950. // a is a primitive
  21951. return a === b;
  21952. }
  21953. if ((0, _isArray.default)(a) || (0, _isArray.default)(b)) {
  21954. if (!(0, _isArray.default)(a) || !(0, _isArray.default)(b)) {
  21955. return false;
  21956. }
  21957. if (a.length !== b.length) {
  21958. return false;
  21959. }
  21960. for (var i = a.length; i--;) {
  21961. if (!equals(a[i], b[i])) {
  21962. return false;
  21963. }
  21964. }
  21965. return true;
  21966. }
  21967. if (a instanceof _ParseACL.default || a instanceof _ParseFile.default || a instanceof _ParseGeoPoint.default || a instanceof _ParseObject.default) {
  21968. return a.equals(b);
  21969. }
  21970. if (b instanceof _ParseObject.default) {
  21971. if (a.__type === 'Object' || a.__type === 'Pointer') {
  21972. return a.objectId === b.id && a.className === b.className;
  21973. }
  21974. }
  21975. if ((0, _keys.default)(a).length !== (0, _keys.default)(b).length) {
  21976. return false;
  21977. }
  21978. for (var k in a) {
  21979. if (!equals(a[k], b[k])) {
  21980. return false;
  21981. }
  21982. }
  21983. return true;
  21984. }
  21985. },{"./ParseACL":18,"./ParseFile":22,"./ParseGeoPoint":23,"./ParseObject":26,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],49:[function(_dereq_,module,exports){
  21986. "use strict";
  21987. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  21988. _Object$defineProperty(exports, "__esModule", {
  21989. value: true
  21990. });
  21991. exports.default = escape;
  21992. /*
  21993. * Copyright (c) 2015-present, Parse, LLC.
  21994. * All rights reserved.
  21995. *
  21996. * This source code is licensed under the BSD-style license found in the
  21997. * LICENSE file in the root directory of this source tree. An additional grant
  21998. * of patent rights can be found in the PATENTS file in the same directory.
  21999. *
  22000. * @flow
  22001. */
  22002. var encoded = {
  22003. '&': '&amp;',
  22004. '<': '&lt;',
  22005. '>': '&gt;',
  22006. '/': '&#x2F;',
  22007. "'": '&#x27;',
  22008. '"': '&quot;'
  22009. };
  22010. function escape(str
  22011. /*: string*/
  22012. )
  22013. /*: string*/
  22014. {
  22015. return str.replace(/[&<>\/'"]/g, function (char) {
  22016. return encoded[char];
  22017. });
  22018. }
  22019. },{"@babel/runtime-corejs3/core-js-stable/object/define-property":83}],50:[function(_dereq_,module,exports){
  22020. "use strict";
  22021. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  22022. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  22023. _Object$defineProperty(exports, "__esModule", {
  22024. value: true
  22025. });
  22026. exports.default = isRevocableSession;
  22027. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  22028. /**
  22029. * Copyright (c) 2015-present, Parse, LLC.
  22030. * All rights reserved.
  22031. *
  22032. * This source code is licensed under the BSD-style license found in the
  22033. * LICENSE file in the root directory of this source tree. An additional grant
  22034. * of patent rights can be found in the PATENTS file in the same directory.
  22035. *
  22036. * @flow
  22037. */
  22038. function isRevocableSession(token
  22039. /*: string*/
  22040. )
  22041. /*: boolean*/
  22042. {
  22043. return (0, _indexOf.default)(token).call(token, 'r:') > -1;
  22044. }
  22045. },{"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],51:[function(_dereq_,module,exports){
  22046. "use strict";
  22047. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  22048. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  22049. _Object$defineProperty(exports, "__esModule", {
  22050. value: true
  22051. });
  22052. exports.default = parseDate;
  22053. var _parseInt2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/parse-int"));
  22054. /**
  22055. * Copyright (c) 2015-present, Parse, LLC.
  22056. * All rights reserved.
  22057. *
  22058. * This source code is licensed under the BSD-style license found in the
  22059. * LICENSE file in the root directory of this source tree. An additional grant
  22060. * of patent rights can be found in the PATENTS file in the same directory.
  22061. *
  22062. * @flow
  22063. */
  22064. function parseDate(iso8601
  22065. /*: string*/
  22066. )
  22067. /*: ?Date*/
  22068. {
  22069. var regexp = new RegExp('^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})' + 'T' + '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})' + '(.([0-9]+))?' + 'Z$');
  22070. var match = regexp.exec(iso8601);
  22071. if (!match) {
  22072. return null;
  22073. }
  22074. var year = (0, _parseInt2.default)(match[1]) || 0;
  22075. var month = ((0, _parseInt2.default)(match[2]) || 1) - 1;
  22076. var day = (0, _parseInt2.default)(match[3]) || 0;
  22077. var hour = (0, _parseInt2.default)(match[4]) || 0;
  22078. var minute = (0, _parseInt2.default)(match[5]) || 0;
  22079. var second = (0, _parseInt2.default)(match[6]) || 0;
  22080. var milli = (0, _parseInt2.default)(match[8]) || 0;
  22081. return new Date(Date.UTC(year, month, day, hour, minute, second, milli));
  22082. }
  22083. },{"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/parse-int":92,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],52:[function(_dereq_,module,exports){
  22084. "use strict";
  22085. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  22086. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  22087. _Object$defineProperty(exports, "__esModule", {
  22088. value: true
  22089. });
  22090. exports.continueWhile = continueWhile;
  22091. exports.resolvingPromise = resolvingPromise;
  22092. exports.when = when;
  22093. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  22094. var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise")); // Create Deferred Promise
  22095. function resolvingPromise() {
  22096. var res;
  22097. var rej;
  22098. var promise = new _promise.default(function (resolve, reject) {
  22099. res = resolve;
  22100. rej = reject;
  22101. });
  22102. promise.resolve = res;
  22103. promise.reject = rej;
  22104. return promise;
  22105. }
  22106. function when(promises) {
  22107. var objects;
  22108. var arrayArgument = (0, _isArray.default)(promises);
  22109. if (arrayArgument) {
  22110. objects = promises;
  22111. } else {
  22112. objects = arguments;
  22113. }
  22114. var total = objects.length;
  22115. var hadError = false;
  22116. var results = [];
  22117. var returnValue = arrayArgument ? [results] : results;
  22118. var errors = [];
  22119. results.length = objects.length;
  22120. errors.length = objects.length;
  22121. if (total === 0) {
  22122. return _promise.default.resolve(returnValue);
  22123. }
  22124. var promise = new resolvingPromise();
  22125. var resolveOne = function () {
  22126. total--;
  22127. if (total <= 0) {
  22128. if (hadError) {
  22129. promise.reject(errors);
  22130. } else {
  22131. promise.resolve(returnValue);
  22132. }
  22133. }
  22134. };
  22135. var chain = function (object, index) {
  22136. if (object && typeof object.then === 'function') {
  22137. object.then(function (result) {
  22138. results[index] = result;
  22139. resolveOne();
  22140. }, function (error) {
  22141. errors[index] = error;
  22142. hadError = true;
  22143. resolveOne();
  22144. });
  22145. } else {
  22146. results[index] = object;
  22147. resolveOne();
  22148. }
  22149. };
  22150. for (var i = 0; i < objects.length; i++) {
  22151. chain(objects[i], i);
  22152. }
  22153. return promise;
  22154. }
  22155. function continueWhile(test, emitter) {
  22156. if (test()) {
  22157. return emitter().then(function () {
  22158. return continueWhile(test, emitter);
  22159. });
  22160. }
  22161. return _promise.default.resolve();
  22162. }
  22163. },{"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],53:[function(_dereq_,module,exports){
  22164. "use strict";
  22165. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  22166. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  22167. _Object$defineProperty(exports, "__esModule", {
  22168. value: true
  22169. });
  22170. exports.default = unique;
  22171. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  22172. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  22173. var _arrayContainsObject = _interopRequireDefault(_dereq_("./arrayContainsObject"));
  22174. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  22175. /**
  22176. * Copyright (c) 2015-present, Parse, LLC.
  22177. * All rights reserved.
  22178. *
  22179. * This source code is licensed under the BSD-style license found in the
  22180. * LICENSE file in the root directory of this source tree. An additional grant
  22181. * of patent rights can be found in the PATENTS file in the same directory.
  22182. *
  22183. * @flow
  22184. */
  22185. function unique
  22186. /*:: <T>*/
  22187. (arr
  22188. /*: Array<T>*/
  22189. )
  22190. /*: Array<T>*/
  22191. {
  22192. var uniques = [];
  22193. (0, _forEach.default)(arr).call(arr, function (value) {
  22194. if (value instanceof _ParseObject.default) {
  22195. if (!(0, _arrayContainsObject.default)(uniques, value)) {
  22196. uniques.push(value);
  22197. }
  22198. } else {
  22199. if ((0, _indexOf.default)(uniques).call(uniques, value) < 0) {
  22200. uniques.push(value);
  22201. }
  22202. }
  22203. });
  22204. return uniques;
  22205. }
  22206. },{"./ParseObject":26,"./arrayContainsObject":44,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129}],54:[function(_dereq_,module,exports){
  22207. "use strict";
  22208. var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
  22209. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
  22210. _Object$defineProperty(exports, "__esModule", {
  22211. value: true
  22212. });
  22213. exports.default = unsavedChildren;
  22214. var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  22215. var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
  22216. var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
  22217. var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  22218. var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
  22219. var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
  22220. var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
  22221. var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
  22222. /**
  22223. * Copyright (c) 2015-present, Parse, LLC.
  22224. * All rights reserved.
  22225. *
  22226. * This source code is licensed under the BSD-style license found in the
  22227. * LICENSE file in the root directory of this source tree. An additional grant
  22228. * of patent rights can be found in the PATENTS file in the same directory.
  22229. *
  22230. * @flow
  22231. */
  22232. /**
  22233. * Return an array of unsaved children, which are either Parse Objects or Files.
  22234. * If it encounters any dirty Objects without Ids, it will throw an exception.
  22235. *
  22236. * @param {Parse.Object} obj
  22237. * @param {boolean} allowDeepUnsaved
  22238. * @returns {Array}
  22239. */
  22240. function unsavedChildren(obj
  22241. /*: ParseObject*/
  22242. , allowDeepUnsaved
  22243. /*:: ?: boolean*/
  22244. )
  22245. /*: Array<ParseFile | ParseObject>*/
  22246. {
  22247. var encountered = {
  22248. objects: {},
  22249. files: []
  22250. };
  22251. var identifier = obj.className + ':' + obj._getId();
  22252. encountered.objects[identifier] = obj.dirty() ? obj : true;
  22253. var attributes = obj.attributes;
  22254. for (var attr in attributes) {
  22255. if ((0, _typeof2.default)(attributes[attr]) === 'object') {
  22256. traverse(attributes[attr], encountered, false, !!allowDeepUnsaved);
  22257. }
  22258. }
  22259. var unsaved = [];
  22260. for (var id in encountered.objects) {
  22261. if (id !== identifier && encountered.objects[id] !== true) {
  22262. unsaved.push(encountered.objects[id]);
  22263. }
  22264. }
  22265. return (0, _concat.default)(unsaved).call(unsaved, encountered.files);
  22266. }
  22267. function traverse(obj
  22268. /*: ParseObject*/
  22269. , encountered
  22270. /*: EncounterMap*/
  22271. , shouldThrow
  22272. /*: boolean*/
  22273. , allowDeepUnsaved
  22274. /*: boolean*/
  22275. ) {
  22276. if (obj instanceof _ParseObject.default) {
  22277. if (!obj.id && shouldThrow) {
  22278. throw new Error('Cannot create a pointer to an unsaved Object.');
  22279. }
  22280. var _identifier = obj.className + ':' + obj._getId();
  22281. if (!encountered.objects[_identifier]) {
  22282. encountered.objects[_identifier] = obj.dirty() ? obj : true;
  22283. var attributes = obj.attributes;
  22284. for (var attr in attributes) {
  22285. if ((0, _typeof2.default)(attributes[attr]) === 'object') {
  22286. traverse(attributes[attr], encountered, !allowDeepUnsaved, allowDeepUnsaved);
  22287. }
  22288. }
  22289. }
  22290. return;
  22291. }
  22292. if (obj instanceof _ParseFile.default) {
  22293. var _context;
  22294. if (!obj.url() && (0, _indexOf.default)(_context = encountered.files).call(_context, obj) < 0) {
  22295. encountered.files.push(obj);
  22296. }
  22297. return;
  22298. }
  22299. if (obj instanceof _ParseRelation.default) {
  22300. return;
  22301. }
  22302. if ((0, _isArray.default)(obj)) {
  22303. (0, _forEach.default)(obj).call(obj, function (el) {
  22304. if ((0, _typeof2.default)(el) === 'object') {
  22305. traverse(el, encountered, shouldThrow, allowDeepUnsaved);
  22306. }
  22307. });
  22308. }
  22309. for (var k in obj) {
  22310. if ((0, _typeof2.default)(obj[k]) === 'object') {
  22311. traverse(obj[k], encountered, shouldThrow, allowDeepUnsaved);
  22312. }
  22313. }
  22314. }
  22315. },{"./ParseFile":22,"./ParseObject":26,"./ParseRelation":30,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/concat":59,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/typeof":141}],55:[function(_dereq_,module,exports){
  22316. "use strict";
  22317. var uuid = null;
  22318. uuid = function () {
  22319. var s = [];
  22320. var hexDigits = '0123456789abcdef';
  22321. for (var i = 0; i < 36; i++) {
  22322. s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  22323. }
  22324. s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
  22325. s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
  22326. s[8] = s[13] = s[18] = s[23] = '-';
  22327. return s.join('');
  22328. };
  22329. module.exports = uuid;
  22330. },{}],56:[function(_dereq_,module,exports){
  22331. module.exports = _dereq_("core-js-pure/stable/array/from");
  22332. },{"core-js-pure/stable/array/from":546}],57:[function(_dereq_,module,exports){
  22333. module.exports = _dereq_("core-js-pure/stable/array/is-array");
  22334. },{"core-js-pure/stable/array/is-array":547}],58:[function(_dereq_,module,exports){
  22335. module.exports = _dereq_("core-js-pure/stable/instance/bind");
  22336. },{"core-js-pure/stable/instance/bind":553}],59:[function(_dereq_,module,exports){
  22337. module.exports = _dereq_("core-js-pure/stable/instance/concat");
  22338. },{"core-js-pure/stable/instance/concat":554}],60:[function(_dereq_,module,exports){
  22339. module.exports = _dereq_("core-js-pure/stable/instance/entries");
  22340. },{"core-js-pure/stable/instance/entries":555}],61:[function(_dereq_,module,exports){
  22341. module.exports = _dereq_("core-js-pure/stable/instance/every");
  22342. },{"core-js-pure/stable/instance/every":556}],62:[function(_dereq_,module,exports){
  22343. module.exports = _dereq_("core-js-pure/stable/instance/filter");
  22344. },{"core-js-pure/stable/instance/filter":557}],63:[function(_dereq_,module,exports){
  22345. module.exports = _dereq_("core-js-pure/stable/instance/find-index");
  22346. },{"core-js-pure/stable/instance/find-index":558}],64:[function(_dereq_,module,exports){
  22347. module.exports = _dereq_("core-js-pure/stable/instance/find");
  22348. },{"core-js-pure/stable/instance/find":559}],65:[function(_dereq_,module,exports){
  22349. module.exports = _dereq_("core-js-pure/stable/instance/for-each");
  22350. },{"core-js-pure/stable/instance/for-each":560}],66:[function(_dereq_,module,exports){
  22351. module.exports = _dereq_("core-js-pure/stable/instance/includes");
  22352. },{"core-js-pure/stable/instance/includes":561}],67:[function(_dereq_,module,exports){
  22353. module.exports = _dereq_("core-js-pure/stable/instance/index-of");
  22354. },{"core-js-pure/stable/instance/index-of":562}],68:[function(_dereq_,module,exports){
  22355. module.exports = _dereq_("core-js-pure/stable/instance/keys");
  22356. },{"core-js-pure/stable/instance/keys":563}],69:[function(_dereq_,module,exports){
  22357. module.exports = _dereq_("core-js-pure/stable/instance/map");
  22358. },{"core-js-pure/stable/instance/map":564}],70:[function(_dereq_,module,exports){
  22359. module.exports = _dereq_("core-js-pure/stable/instance/reduce");
  22360. },{"core-js-pure/stable/instance/reduce":565}],71:[function(_dereq_,module,exports){
  22361. module.exports = _dereq_("core-js-pure/stable/instance/reverse");
  22362. },{"core-js-pure/stable/instance/reverse":566}],72:[function(_dereq_,module,exports){
  22363. module.exports = _dereq_("core-js-pure/stable/instance/slice");
  22364. },{"core-js-pure/stable/instance/slice":567}],73:[function(_dereq_,module,exports){
  22365. module.exports = _dereq_("core-js-pure/stable/instance/sort");
  22366. },{"core-js-pure/stable/instance/sort":568}],74:[function(_dereq_,module,exports){
  22367. module.exports = _dereq_("core-js-pure/stable/instance/splice");
  22368. },{"core-js-pure/stable/instance/splice":569}],75:[function(_dereq_,module,exports){
  22369. module.exports = _dereq_("core-js-pure/stable/instance/starts-with");
  22370. },{"core-js-pure/stable/instance/starts-with":570}],76:[function(_dereq_,module,exports){
  22371. module.exports = _dereq_("core-js-pure/stable/instance/values");
  22372. },{"core-js-pure/stable/instance/values":571}],77:[function(_dereq_,module,exports){
  22373. module.exports = _dereq_("core-js-pure/stable/json/stringify");
  22374. },{"core-js-pure/stable/json/stringify":572}],78:[function(_dereq_,module,exports){
  22375. module.exports = _dereq_("core-js-pure/stable/map");
  22376. },{"core-js-pure/stable/map":573}],79:[function(_dereq_,module,exports){
  22377. module.exports = _dereq_("core-js-pure/stable/number/is-integer");
  22378. },{"core-js-pure/stable/number/is-integer":574}],80:[function(_dereq_,module,exports){
  22379. module.exports = _dereq_("core-js-pure/stable/object/assign");
  22380. },{"core-js-pure/stable/object/assign":575}],81:[function(_dereq_,module,exports){
  22381. module.exports = _dereq_("core-js-pure/stable/object/create");
  22382. },{"core-js-pure/stable/object/create":576}],82:[function(_dereq_,module,exports){
  22383. module.exports = _dereq_("core-js-pure/stable/object/define-properties");
  22384. },{"core-js-pure/stable/object/define-properties":577}],83:[function(_dereq_,module,exports){
  22385. module.exports = _dereq_("core-js-pure/stable/object/define-property");
  22386. },{"core-js-pure/stable/object/define-property":578}],84:[function(_dereq_,module,exports){
  22387. module.exports = _dereq_("core-js-pure/stable/object/entries");
  22388. },{"core-js-pure/stable/object/entries":579}],85:[function(_dereq_,module,exports){
  22389. module.exports = _dereq_("core-js-pure/stable/object/freeze");
  22390. },{"core-js-pure/stable/object/freeze":580}],86:[function(_dereq_,module,exports){
  22391. module.exports = _dereq_("core-js-pure/stable/object/get-own-property-descriptor");
  22392. },{"core-js-pure/stable/object/get-own-property-descriptor":581}],87:[function(_dereq_,module,exports){
  22393. module.exports = _dereq_("core-js-pure/stable/object/get-own-property-descriptors");
  22394. },{"core-js-pure/stable/object/get-own-property-descriptors":582}],88:[function(_dereq_,module,exports){
  22395. module.exports = _dereq_("core-js-pure/stable/object/get-own-property-symbols");
  22396. },{"core-js-pure/stable/object/get-own-property-symbols":583}],89:[function(_dereq_,module,exports){
  22397. module.exports = _dereq_("core-js-pure/stable/object/get-prototype-of");
  22398. },{"core-js-pure/stable/object/get-prototype-of":584}],90:[function(_dereq_,module,exports){
  22399. module.exports = _dereq_("core-js-pure/stable/object/keys");
  22400. },{"core-js-pure/stable/object/keys":585}],91:[function(_dereq_,module,exports){
  22401. module.exports = _dereq_("core-js-pure/stable/object/set-prototype-of");
  22402. },{"core-js-pure/stable/object/set-prototype-of":586}],92:[function(_dereq_,module,exports){
  22403. module.exports = _dereq_("core-js-pure/stable/parse-int");
  22404. },{"core-js-pure/stable/parse-int":587}],93:[function(_dereq_,module,exports){
  22405. module.exports = _dereq_("core-js-pure/stable/promise");
  22406. },{"core-js-pure/stable/promise":588}],94:[function(_dereq_,module,exports){
  22407. module.exports = _dereq_("core-js-pure/stable/reflect/construct");
  22408. },{"core-js-pure/stable/reflect/construct":589}],95:[function(_dereq_,module,exports){
  22409. module.exports = _dereq_("core-js-pure/stable/set-interval");
  22410. },{"core-js-pure/stable/set-interval":591}],96:[function(_dereq_,module,exports){
  22411. module.exports = _dereq_("core-js-pure/stable/set-timeout");
  22412. },{"core-js-pure/stable/set-timeout":592}],97:[function(_dereq_,module,exports){
  22413. module.exports = _dereq_("core-js-pure/stable/set");
  22414. },{"core-js-pure/stable/set":593}],98:[function(_dereq_,module,exports){
  22415. module.exports = _dereq_("core-js-pure/stable/symbol");
  22416. },{"core-js-pure/stable/symbol":594}],99:[function(_dereq_,module,exports){
  22417. module.exports = _dereq_("core-js-pure/stable/weak-map");
  22418. },{"core-js-pure/stable/weak-map":596}],100:[function(_dereq_,module,exports){
  22419. module.exports = _dereq_("core-js-pure/features/array/from");
  22420. },{"core-js-pure/features/array/from":225}],101:[function(_dereq_,module,exports){
  22421. module.exports = _dereq_("core-js-pure/features/array/is-array");
  22422. },{"core-js-pure/features/array/is-array":226}],102:[function(_dereq_,module,exports){
  22423. module.exports = _dereq_("core-js-pure/features/get-iterator-method");
  22424. },{"core-js-pure/features/get-iterator-method":227}],103:[function(_dereq_,module,exports){
  22425. module.exports = _dereq_("core-js-pure/features/instance/bind");
  22426. },{"core-js-pure/features/instance/bind":228}],104:[function(_dereq_,module,exports){
  22427. module.exports = _dereq_("core-js-pure/features/instance/index-of");
  22428. },{"core-js-pure/features/instance/index-of":229}],105:[function(_dereq_,module,exports){
  22429. module.exports = _dereq_("core-js-pure/features/instance/slice");
  22430. },{"core-js-pure/features/instance/slice":230}],106:[function(_dereq_,module,exports){
  22431. module.exports = _dereq_("core-js-pure/features/map");
  22432. },{"core-js-pure/features/map":231}],107:[function(_dereq_,module,exports){
  22433. module.exports = _dereq_("core-js-pure/features/object/create");
  22434. },{"core-js-pure/features/object/create":232}],108:[function(_dereq_,module,exports){
  22435. module.exports = _dereq_("core-js-pure/features/object/define-property");
  22436. },{"core-js-pure/features/object/define-property":233}],109:[function(_dereq_,module,exports){
  22437. module.exports = _dereq_("core-js-pure/features/object/get-own-property-descriptor");
  22438. },{"core-js-pure/features/object/get-own-property-descriptor":234}],110:[function(_dereq_,module,exports){
  22439. module.exports = _dereq_("core-js-pure/features/object/get-prototype-of");
  22440. },{"core-js-pure/features/object/get-prototype-of":235}],111:[function(_dereq_,module,exports){
  22441. module.exports = _dereq_("core-js-pure/features/object/set-prototype-of");
  22442. },{"core-js-pure/features/object/set-prototype-of":236}],112:[function(_dereq_,module,exports){
  22443. module.exports = _dereq_("core-js-pure/features/promise");
  22444. },{"core-js-pure/features/promise":237}],113:[function(_dereq_,module,exports){
  22445. module.exports = _dereq_("core-js-pure/features/reflect/construct");
  22446. },{"core-js-pure/features/reflect/construct":238}],114:[function(_dereq_,module,exports){
  22447. module.exports = _dereq_("core-js-pure/features/reflect/get");
  22448. },{"core-js-pure/features/reflect/get":239}],115:[function(_dereq_,module,exports){
  22449. module.exports = _dereq_("core-js-pure/features/symbol");
  22450. },{"core-js-pure/features/symbol":240}],116:[function(_dereq_,module,exports){
  22451. module.exports = _dereq_("core-js-pure/features/symbol/iterator");
  22452. },{"core-js-pure/features/symbol/iterator":241}],117:[function(_dereq_,module,exports){
  22453. function _arrayLikeToArray(arr, len) {
  22454. if (len == null || len > arr.length) len = arr.length;
  22455. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  22456. arr2[i] = arr[i];
  22457. }
  22458. return arr2;
  22459. }
  22460. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22461. },{}],118:[function(_dereq_,module,exports){
  22462. var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js/array/is-array");
  22463. function _arrayWithHoles(arr) {
  22464. if (_Array$isArray(arr)) return arr;
  22465. }
  22466. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22467. },{"@babel/runtime-corejs3/core-js/array/is-array":101}],119:[function(_dereq_,module,exports){
  22468. var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js/array/is-array");
  22469. var arrayLikeToArray = _dereq_("./arrayLikeToArray.js");
  22470. function _arrayWithoutHoles(arr) {
  22471. if (_Array$isArray(arr)) return arrayLikeToArray(arr);
  22472. }
  22473. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22474. },{"./arrayLikeToArray.js":117,"@babel/runtime-corejs3/core-js/array/is-array":101}],120:[function(_dereq_,module,exports){
  22475. function _assertThisInitialized(self) {
  22476. if (self === void 0) {
  22477. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  22478. }
  22479. return self;
  22480. }
  22481. module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22482. },{}],121:[function(_dereq_,module,exports){
  22483. var _Promise = _dereq_("@babel/runtime-corejs3/core-js/promise");
  22484. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  22485. try {
  22486. var info = gen[key](arg);
  22487. var value = info.value;
  22488. } catch (error) {
  22489. reject(error);
  22490. return;
  22491. }
  22492. if (info.done) {
  22493. resolve(value);
  22494. } else {
  22495. _Promise.resolve(value).then(_next, _throw);
  22496. }
  22497. }
  22498. function _asyncToGenerator(fn) {
  22499. return function () {
  22500. var self = this,
  22501. args = arguments;
  22502. return new _Promise(function (resolve, reject) {
  22503. var gen = fn.apply(self, args);
  22504. function _next(value) {
  22505. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  22506. }
  22507. function _throw(err) {
  22508. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  22509. }
  22510. _next(undefined);
  22511. });
  22512. };
  22513. }
  22514. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22515. },{"@babel/runtime-corejs3/core-js/promise":112}],122:[function(_dereq_,module,exports){
  22516. function _classCallCheck(instance, Constructor) {
  22517. if (!(instance instanceof Constructor)) {
  22518. throw new TypeError("Cannot call a class as a function");
  22519. }
  22520. }
  22521. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22522. },{}],123:[function(_dereq_,module,exports){
  22523. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js/reflect/construct");
  22524. var _bindInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js/instance/bind");
  22525. var setPrototypeOf = _dereq_("./setPrototypeOf.js");
  22526. var isNativeReflectConstruct = _dereq_("./isNativeReflectConstruct.js");
  22527. function _construct(Parent, args, Class) {
  22528. if (isNativeReflectConstruct()) {
  22529. module.exports = _construct = _Reflect$construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22530. } else {
  22531. module.exports = _construct = function _construct(Parent, args, Class) {
  22532. var a = [null];
  22533. a.push.apply(a, args);
  22534. var Constructor = _bindInstanceProperty(Function).apply(Parent, a);
  22535. var instance = new Constructor();
  22536. if (Class) setPrototypeOf(instance, Class.prototype);
  22537. return instance;
  22538. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22539. }
  22540. return _construct.apply(null, arguments);
  22541. }
  22542. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22543. },{"./isNativeReflectConstruct.js":131,"./setPrototypeOf.js":137,"@babel/runtime-corejs3/core-js/instance/bind":103,"@babel/runtime-corejs3/core-js/reflect/construct":113}],124:[function(_dereq_,module,exports){
  22544. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js/object/define-property");
  22545. function _defineProperties(target, props) {
  22546. for (var i = 0; i < props.length; i++) {
  22547. var descriptor = props[i];
  22548. descriptor.enumerable = descriptor.enumerable || false;
  22549. descriptor.configurable = true;
  22550. if ("value" in descriptor) descriptor.writable = true;
  22551. _Object$defineProperty(target, descriptor.key, descriptor);
  22552. }
  22553. }
  22554. function _createClass(Constructor, protoProps, staticProps) {
  22555. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  22556. if (staticProps) _defineProperties(Constructor, staticProps);
  22557. _Object$defineProperty(Constructor, "prototype", {
  22558. writable: false
  22559. });
  22560. return Constructor;
  22561. }
  22562. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22563. },{"@babel/runtime-corejs3/core-js/object/define-property":108}],125:[function(_dereq_,module,exports){
  22564. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js/object/define-property");
  22565. function _defineProperty(obj, key, value) {
  22566. if (key in obj) {
  22567. _Object$defineProperty(obj, key, {
  22568. value: value,
  22569. enumerable: true,
  22570. configurable: true,
  22571. writable: true
  22572. });
  22573. } else {
  22574. obj[key] = value;
  22575. }
  22576. return obj;
  22577. }
  22578. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22579. },{"@babel/runtime-corejs3/core-js/object/define-property":108}],126:[function(_dereq_,module,exports){
  22580. var _Reflect$get = _dereq_("@babel/runtime-corejs3/core-js/reflect/get");
  22581. var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor");
  22582. var superPropBase = _dereq_("./superPropBase.js");
  22583. function _get() {
  22584. if (typeof Reflect !== "undefined" && _Reflect$get) {
  22585. module.exports = _get = _Reflect$get, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22586. } else {
  22587. module.exports = _get = function _get(target, property, receiver) {
  22588. var base = superPropBase(target, property);
  22589. if (!base) return;
  22590. var desc = _Object$getOwnPropertyDescriptor(base, property);
  22591. if (desc.get) {
  22592. return desc.get.call(arguments.length < 3 ? target : receiver);
  22593. }
  22594. return desc.value;
  22595. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22596. }
  22597. return _get.apply(this, arguments);
  22598. }
  22599. module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22600. },{"./superPropBase.js":139,"@babel/runtime-corejs3/core-js/object/get-own-property-descriptor":109,"@babel/runtime-corejs3/core-js/reflect/get":114}],127:[function(_dereq_,module,exports){
  22601. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js/object/set-prototype-of");
  22602. var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js/object/get-prototype-of");
  22603. function _getPrototypeOf(o) {
  22604. module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _Object$getPrototypeOf : function _getPrototypeOf(o) {
  22605. return o.__proto__ || _Object$getPrototypeOf(o);
  22606. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22607. return _getPrototypeOf(o);
  22608. }
  22609. module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22610. },{"@babel/runtime-corejs3/core-js/object/get-prototype-of":110,"@babel/runtime-corejs3/core-js/object/set-prototype-of":111}],128:[function(_dereq_,module,exports){
  22611. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js/object/create");
  22612. var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js/object/define-property");
  22613. var setPrototypeOf = _dereq_("./setPrototypeOf.js");
  22614. function _inherits(subClass, superClass) {
  22615. if (typeof superClass !== "function" && superClass !== null) {
  22616. throw new TypeError("Super expression must either be null or a function");
  22617. }
  22618. subClass.prototype = _Object$create(superClass && superClass.prototype, {
  22619. constructor: {
  22620. value: subClass,
  22621. writable: true,
  22622. configurable: true
  22623. }
  22624. });
  22625. _Object$defineProperty(subClass, "prototype", {
  22626. writable: false
  22627. });
  22628. if (superClass) setPrototypeOf(subClass, superClass);
  22629. }
  22630. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22631. },{"./setPrototypeOf.js":137,"@babel/runtime-corejs3/core-js/object/create":107,"@babel/runtime-corejs3/core-js/object/define-property":108}],129:[function(_dereq_,module,exports){
  22632. function _interopRequireDefault(obj) {
  22633. return obj && obj.__esModule ? obj : {
  22634. "default": obj
  22635. };
  22636. }
  22637. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22638. },{}],130:[function(_dereq_,module,exports){
  22639. var _indexOfInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js/instance/index-of");
  22640. function _isNativeFunction(fn) {
  22641. var _context;
  22642. return _indexOfInstanceProperty(_context = Function.toString.call(fn)).call(_context, "[native code]") !== -1;
  22643. }
  22644. module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22645. },{"@babel/runtime-corejs3/core-js/instance/index-of":104}],131:[function(_dereq_,module,exports){
  22646. var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js/reflect/construct");
  22647. function _isNativeReflectConstruct() {
  22648. if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
  22649. if (_Reflect$construct.sham) return false;
  22650. if (typeof Proxy === "function") return true;
  22651. try {
  22652. Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
  22653. return true;
  22654. } catch (e) {
  22655. return false;
  22656. }
  22657. }
  22658. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22659. },{"@babel/runtime-corejs3/core-js/reflect/construct":113}],132:[function(_dereq_,module,exports){
  22660. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js/symbol");
  22661. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  22662. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js/array/from");
  22663. function _iterableToArray(iter) {
  22664. if (typeof _Symbol !== "undefined" && _getIteratorMethod(iter) != null || iter["@@iterator"] != null) return _Array$from(iter);
  22665. }
  22666. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22667. },{"@babel/runtime-corejs3/core-js/array/from":100,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/core-js/symbol":115}],133:[function(_dereq_,module,exports){
  22668. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js/symbol");
  22669. var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
  22670. function _iterableToArrayLimit(arr, i) {
  22671. var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
  22672. if (_i == null) return;
  22673. var _arr = [];
  22674. var _n = true;
  22675. var _d = false;
  22676. var _s, _e;
  22677. try {
  22678. for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
  22679. _arr.push(_s.value);
  22680. if (i && _arr.length === i) break;
  22681. }
  22682. } catch (err) {
  22683. _d = true;
  22684. _e = err;
  22685. } finally {
  22686. try {
  22687. if (!_n && _i["return"] != null) _i["return"]();
  22688. } finally {
  22689. if (_d) throw _e;
  22690. }
  22691. }
  22692. return _arr;
  22693. }
  22694. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22695. },{"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/core-js/symbol":115}],134:[function(_dereq_,module,exports){
  22696. function _nonIterableRest() {
  22697. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  22698. }
  22699. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22700. },{}],135:[function(_dereq_,module,exports){
  22701. function _nonIterableSpread() {
  22702. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  22703. }
  22704. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22705. },{}],136:[function(_dereq_,module,exports){
  22706. var _typeof = _dereq_("./typeof.js")["default"];
  22707. var assertThisInitialized = _dereq_("./assertThisInitialized.js");
  22708. function _possibleConstructorReturn(self, call) {
  22709. if (call && (_typeof(call) === "object" || typeof call === "function")) {
  22710. return call;
  22711. } else if (call !== void 0) {
  22712. throw new TypeError("Derived constructors may only return object or undefined");
  22713. }
  22714. return assertThisInitialized(self);
  22715. }
  22716. module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22717. },{"./assertThisInitialized.js":120,"./typeof.js":141}],137:[function(_dereq_,module,exports){
  22718. var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js/object/set-prototype-of");
  22719. function _setPrototypeOf(o, p) {
  22720. module.exports = _setPrototypeOf = _Object$setPrototypeOf || function _setPrototypeOf(o, p) {
  22721. o.__proto__ = p;
  22722. return o;
  22723. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22724. return _setPrototypeOf(o, p);
  22725. }
  22726. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22727. },{"@babel/runtime-corejs3/core-js/object/set-prototype-of":111}],138:[function(_dereq_,module,exports){
  22728. var arrayWithHoles = _dereq_("./arrayWithHoles.js");
  22729. var iterableToArrayLimit = _dereq_("./iterableToArrayLimit.js");
  22730. var unsupportedIterableToArray = _dereq_("./unsupportedIterableToArray.js");
  22731. var nonIterableRest = _dereq_("./nonIterableRest.js");
  22732. function _slicedToArray(arr, i) {
  22733. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  22734. }
  22735. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22736. },{"./arrayWithHoles.js":118,"./iterableToArrayLimit.js":133,"./nonIterableRest.js":134,"./unsupportedIterableToArray.js":142}],139:[function(_dereq_,module,exports){
  22737. var getPrototypeOf = _dereq_("./getPrototypeOf.js");
  22738. function _superPropBase(object, property) {
  22739. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  22740. object = getPrototypeOf(object);
  22741. if (object === null) break;
  22742. }
  22743. return object;
  22744. }
  22745. module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22746. },{"./getPrototypeOf.js":127}],140:[function(_dereq_,module,exports){
  22747. var arrayWithoutHoles = _dereq_("./arrayWithoutHoles.js");
  22748. var iterableToArray = _dereq_("./iterableToArray.js");
  22749. var unsupportedIterableToArray = _dereq_("./unsupportedIterableToArray.js");
  22750. var nonIterableSpread = _dereq_("./nonIterableSpread.js");
  22751. function _toConsumableArray(arr) {
  22752. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  22753. }
  22754. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22755. },{"./arrayWithoutHoles.js":119,"./iterableToArray.js":132,"./nonIterableSpread.js":135,"./unsupportedIterableToArray.js":142}],141:[function(_dereq_,module,exports){
  22756. var _Symbol = _dereq_("@babel/runtime-corejs3/core-js/symbol");
  22757. var _Symbol$iterator = _dereq_("@babel/runtime-corejs3/core-js/symbol/iterator");
  22758. function _typeof(obj) {
  22759. "@babel/helpers - typeof";
  22760. return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
  22761. return typeof obj;
  22762. } : function (obj) {
  22763. return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
  22764. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  22765. }
  22766. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22767. },{"@babel/runtime-corejs3/core-js/symbol":115,"@babel/runtime-corejs3/core-js/symbol/iterator":116}],142:[function(_dereq_,module,exports){
  22768. var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js/instance/slice");
  22769. var _Array$from = _dereq_("@babel/runtime-corejs3/core-js/array/from");
  22770. var arrayLikeToArray = _dereq_("./arrayLikeToArray.js");
  22771. function _unsupportedIterableToArray(o, minLen) {
  22772. var _context;
  22773. if (!o) return;
  22774. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  22775. var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
  22776. if (n === "Object" && o.constructor) n = o.constructor.name;
  22777. if (n === "Map" || n === "Set") return _Array$from(o);
  22778. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  22779. }
  22780. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22781. },{"./arrayLikeToArray.js":117,"@babel/runtime-corejs3/core-js/array/from":100,"@babel/runtime-corejs3/core-js/instance/slice":105}],143:[function(_dereq_,module,exports){
  22782. var _Map = _dereq_("@babel/runtime-corejs3/core-js/map");
  22783. var _Object$create = _dereq_("@babel/runtime-corejs3/core-js/object/create");
  22784. var getPrototypeOf = _dereq_("./getPrototypeOf.js");
  22785. var setPrototypeOf = _dereq_("./setPrototypeOf.js");
  22786. var isNativeFunction = _dereq_("./isNativeFunction.js");
  22787. var construct = _dereq_("./construct.js");
  22788. function _wrapNativeSuper(Class) {
  22789. var _cache = typeof _Map === "function" ? new _Map() : undefined;
  22790. module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
  22791. if (Class === null || !isNativeFunction(Class)) return Class;
  22792. if (typeof Class !== "function") {
  22793. throw new TypeError("Super expression must either be null or a function");
  22794. }
  22795. if (typeof _cache !== "undefined") {
  22796. if (_cache.has(Class)) return _cache.get(Class);
  22797. _cache.set(Class, Wrapper);
  22798. }
  22799. function Wrapper() {
  22800. return construct(Class, arguments, getPrototypeOf(this).constructor);
  22801. }
  22802. Wrapper.prototype = _Object$create(Class.prototype, {
  22803. constructor: {
  22804. value: Wrapper,
  22805. enumerable: false,
  22806. writable: true,
  22807. configurable: true
  22808. }
  22809. });
  22810. return setPrototypeOf(Wrapper, Class);
  22811. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22812. return _wrapNativeSuper(Class);
  22813. }
  22814. module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22815. },{"./construct.js":123,"./getPrototypeOf.js":127,"./isNativeFunction.js":130,"./setPrototypeOf.js":137,"@babel/runtime-corejs3/core-js/map":106,"@babel/runtime-corejs3/core-js/object/create":107}],144:[function(_dereq_,module,exports){
  22816. /**
  22817. * Copyright (c) 2014-present, Facebook, Inc.
  22818. *
  22819. * This source code is licensed under the MIT license found in the
  22820. * LICENSE file in the root directory of this source tree.
  22821. */
  22822. var runtime = (function (exports) {
  22823. "use strict";
  22824. var Op = Object.prototype;
  22825. var hasOwn = Op.hasOwnProperty;
  22826. var undefined; // More compressible than void 0.
  22827. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  22828. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  22829. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  22830. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  22831. function define(obj, key, value) {
  22832. Object.defineProperty(obj, key, {
  22833. value: value,
  22834. enumerable: true,
  22835. configurable: true,
  22836. writable: true
  22837. });
  22838. return obj[key];
  22839. }
  22840. try {
  22841. // IE 8 has a broken Object.defineProperty that only works on DOM objects.
  22842. define({}, "");
  22843. } catch (err) {
  22844. define = function(obj, key, value) {
  22845. return obj[key] = value;
  22846. };
  22847. }
  22848. function wrap(innerFn, outerFn, self, tryLocsList) {
  22849. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  22850. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  22851. var generator = Object.create(protoGenerator.prototype);
  22852. var context = new Context(tryLocsList || []);
  22853. // The ._invoke method unifies the implementations of the .next,
  22854. // .throw, and .return methods.
  22855. generator._invoke = makeInvokeMethod(innerFn, self, context);
  22856. return generator;
  22857. }
  22858. exports.wrap = wrap;
  22859. // Try/catch helper to minimize deoptimizations. Returns a completion
  22860. // record like context.tryEntries[i].completion. This interface could
  22861. // have been (and was previously) designed to take a closure to be
  22862. // invoked without arguments, but in all the cases we care about we
  22863. // already have an existing method we want to call, so there's no need
  22864. // to create a new function object. We can even get away with assuming
  22865. // the method takes exactly one argument, since that happens to be true
  22866. // in every case, so we don't have to touch the arguments object. The
  22867. // only additional allocation required is the completion record, which
  22868. // has a stable shape and so hopefully should be cheap to allocate.
  22869. function tryCatch(fn, obj, arg) {
  22870. try {
  22871. return { type: "normal", arg: fn.call(obj, arg) };
  22872. } catch (err) {
  22873. return { type: "throw", arg: err };
  22874. }
  22875. }
  22876. var GenStateSuspendedStart = "suspendedStart";
  22877. var GenStateSuspendedYield = "suspendedYield";
  22878. var GenStateExecuting = "executing";
  22879. var GenStateCompleted = "completed";
  22880. // Returning this object from the innerFn has the same effect as
  22881. // breaking out of the dispatch switch statement.
  22882. var ContinueSentinel = {};
  22883. // Dummy constructor functions that we use as the .constructor and
  22884. // .constructor.prototype properties for functions that return Generator
  22885. // objects. For full spec compliance, you may wish to configure your
  22886. // minifier not to mangle the names of these two functions.
  22887. function Generator() {}
  22888. function GeneratorFunction() {}
  22889. function GeneratorFunctionPrototype() {}
  22890. // This is a polyfill for %IteratorPrototype% for environments that
  22891. // don't natively support it.
  22892. var IteratorPrototype = {};
  22893. define(IteratorPrototype, iteratorSymbol, function () {
  22894. return this;
  22895. });
  22896. var getProto = Object.getPrototypeOf;
  22897. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  22898. if (NativeIteratorPrototype &&
  22899. NativeIteratorPrototype !== Op &&
  22900. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  22901. // This environment has a native %IteratorPrototype%; use it instead
  22902. // of the polyfill.
  22903. IteratorPrototype = NativeIteratorPrototype;
  22904. }
  22905. var Gp = GeneratorFunctionPrototype.prototype =
  22906. Generator.prototype = Object.create(IteratorPrototype);
  22907. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  22908. define(Gp, "constructor", GeneratorFunctionPrototype);
  22909. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  22910. GeneratorFunction.displayName = define(
  22911. GeneratorFunctionPrototype,
  22912. toStringTagSymbol,
  22913. "GeneratorFunction"
  22914. );
  22915. // Helper for defining the .next, .throw, and .return methods of the
  22916. // Iterator interface in terms of a single ._invoke method.
  22917. function defineIteratorMethods(prototype) {
  22918. ["next", "throw", "return"].forEach(function(method) {
  22919. define(prototype, method, function(arg) {
  22920. return this._invoke(method, arg);
  22921. });
  22922. });
  22923. }
  22924. exports.isGeneratorFunction = function(genFun) {
  22925. var ctor = typeof genFun === "function" && genFun.constructor;
  22926. return ctor
  22927. ? ctor === GeneratorFunction ||
  22928. // For the native GeneratorFunction constructor, the best we can
  22929. // do is to check its .name property.
  22930. (ctor.displayName || ctor.name) === "GeneratorFunction"
  22931. : false;
  22932. };
  22933. exports.mark = function(genFun) {
  22934. if (Object.setPrototypeOf) {
  22935. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  22936. } else {
  22937. genFun.__proto__ = GeneratorFunctionPrototype;
  22938. define(genFun, toStringTagSymbol, "GeneratorFunction");
  22939. }
  22940. genFun.prototype = Object.create(Gp);
  22941. return genFun;
  22942. };
  22943. // Within the body of any async function, `await x` is transformed to
  22944. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  22945. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  22946. // meant to be awaited.
  22947. exports.awrap = function(arg) {
  22948. return { __await: arg };
  22949. };
  22950. function AsyncIterator(generator, PromiseImpl) {
  22951. function invoke(method, arg, resolve, reject) {
  22952. var record = tryCatch(generator[method], generator, arg);
  22953. if (record.type === "throw") {
  22954. reject(record.arg);
  22955. } else {
  22956. var result = record.arg;
  22957. var value = result.value;
  22958. if (value &&
  22959. typeof value === "object" &&
  22960. hasOwn.call(value, "__await")) {
  22961. return PromiseImpl.resolve(value.__await).then(function(value) {
  22962. invoke("next", value, resolve, reject);
  22963. }, function(err) {
  22964. invoke("throw", err, resolve, reject);
  22965. });
  22966. }
  22967. return PromiseImpl.resolve(value).then(function(unwrapped) {
  22968. // When a yielded Promise is resolved, its final value becomes
  22969. // the .value of the Promise<{value,done}> result for the
  22970. // current iteration.
  22971. result.value = unwrapped;
  22972. resolve(result);
  22973. }, function(error) {
  22974. // If a rejected Promise was yielded, throw the rejection back
  22975. // into the async generator function so it can be handled there.
  22976. return invoke("throw", error, resolve, reject);
  22977. });
  22978. }
  22979. }
  22980. var previousPromise;
  22981. function enqueue(method, arg) {
  22982. function callInvokeWithMethodAndArg() {
  22983. return new PromiseImpl(function(resolve, reject) {
  22984. invoke(method, arg, resolve, reject);
  22985. });
  22986. }
  22987. return previousPromise =
  22988. // If enqueue has been called before, then we want to wait until
  22989. // all previous Promises have been resolved before calling invoke,
  22990. // so that results are always delivered in the correct order. If
  22991. // enqueue has not been called before, then it is important to
  22992. // call invoke immediately, without waiting on a callback to fire,
  22993. // so that the async generator function has the opportunity to do
  22994. // any necessary setup in a predictable way. This predictability
  22995. // is why the Promise constructor synchronously invokes its
  22996. // executor callback, and why async functions synchronously
  22997. // execute code before the first await. Since we implement simple
  22998. // async functions in terms of async generators, it is especially
  22999. // important to get this right, even though it requires care.
  23000. previousPromise ? previousPromise.then(
  23001. callInvokeWithMethodAndArg,
  23002. // Avoid propagating failures to Promises returned by later
  23003. // invocations of the iterator.
  23004. callInvokeWithMethodAndArg
  23005. ) : callInvokeWithMethodAndArg();
  23006. }
  23007. // Define the unified helper method that is used to implement .next,
  23008. // .throw, and .return (see defineIteratorMethods).
  23009. this._invoke = enqueue;
  23010. }
  23011. defineIteratorMethods(AsyncIterator.prototype);
  23012. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  23013. return this;
  23014. });
  23015. exports.AsyncIterator = AsyncIterator;
  23016. // Note that simple async functions are implemented on top of
  23017. // AsyncIterator objects; they just return a Promise for the value of
  23018. // the final result produced by the iterator.
  23019. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  23020. if (PromiseImpl === void 0) PromiseImpl = Promise;
  23021. var iter = new AsyncIterator(
  23022. wrap(innerFn, outerFn, self, tryLocsList),
  23023. PromiseImpl
  23024. );
  23025. return exports.isGeneratorFunction(outerFn)
  23026. ? iter // If outerFn is a generator, return the full iterator.
  23027. : iter.next().then(function(result) {
  23028. return result.done ? result.value : iter.next();
  23029. });
  23030. };
  23031. function makeInvokeMethod(innerFn, self, context) {
  23032. var state = GenStateSuspendedStart;
  23033. return function invoke(method, arg) {
  23034. if (state === GenStateExecuting) {
  23035. throw new Error("Generator is already running");
  23036. }
  23037. if (state === GenStateCompleted) {
  23038. if (method === "throw") {
  23039. throw arg;
  23040. }
  23041. // Be forgiving, per 25.3.3.3.3 of the spec:
  23042. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  23043. return doneResult();
  23044. }
  23045. context.method = method;
  23046. context.arg = arg;
  23047. while (true) {
  23048. var delegate = context.delegate;
  23049. if (delegate) {
  23050. var delegateResult = maybeInvokeDelegate(delegate, context);
  23051. if (delegateResult) {
  23052. if (delegateResult === ContinueSentinel) continue;
  23053. return delegateResult;
  23054. }
  23055. }
  23056. if (context.method === "next") {
  23057. // Setting context._sent for legacy support of Babel's
  23058. // function.sent implementation.
  23059. context.sent = context._sent = context.arg;
  23060. } else if (context.method === "throw") {
  23061. if (state === GenStateSuspendedStart) {
  23062. state = GenStateCompleted;
  23063. throw context.arg;
  23064. }
  23065. context.dispatchException(context.arg);
  23066. } else if (context.method === "return") {
  23067. context.abrupt("return", context.arg);
  23068. }
  23069. state = GenStateExecuting;
  23070. var record = tryCatch(innerFn, self, context);
  23071. if (record.type === "normal") {
  23072. // If an exception is thrown from innerFn, we leave state ===
  23073. // GenStateExecuting and loop back for another invocation.
  23074. state = context.done
  23075. ? GenStateCompleted
  23076. : GenStateSuspendedYield;
  23077. if (record.arg === ContinueSentinel) {
  23078. continue;
  23079. }
  23080. return {
  23081. value: record.arg,
  23082. done: context.done
  23083. };
  23084. } else if (record.type === "throw") {
  23085. state = GenStateCompleted;
  23086. // Dispatch the exception by looping back around to the
  23087. // context.dispatchException(context.arg) call above.
  23088. context.method = "throw";
  23089. context.arg = record.arg;
  23090. }
  23091. }
  23092. };
  23093. }
  23094. // Call delegate.iterator[context.method](context.arg) and handle the
  23095. // result, either by returning a { value, done } result from the
  23096. // delegate iterator, or by modifying context.method and context.arg,
  23097. // setting context.delegate to null, and returning the ContinueSentinel.
  23098. function maybeInvokeDelegate(delegate, context) {
  23099. var method = delegate.iterator[context.method];
  23100. if (method === undefined) {
  23101. // A .throw or .return when the delegate iterator has no .throw
  23102. // method always terminates the yield* loop.
  23103. context.delegate = null;
  23104. if (context.method === "throw") {
  23105. // Note: ["return"] must be used for ES3 parsing compatibility.
  23106. if (delegate.iterator["return"]) {
  23107. // If the delegate iterator has a return method, give it a
  23108. // chance to clean up.
  23109. context.method = "return";
  23110. context.arg = undefined;
  23111. maybeInvokeDelegate(delegate, context);
  23112. if (context.method === "throw") {
  23113. // If maybeInvokeDelegate(context) changed context.method from
  23114. // "return" to "throw", let that override the TypeError below.
  23115. return ContinueSentinel;
  23116. }
  23117. }
  23118. context.method = "throw";
  23119. context.arg = new TypeError(
  23120. "The iterator does not provide a 'throw' method");
  23121. }
  23122. return ContinueSentinel;
  23123. }
  23124. var record = tryCatch(method, delegate.iterator, context.arg);
  23125. if (record.type === "throw") {
  23126. context.method = "throw";
  23127. context.arg = record.arg;
  23128. context.delegate = null;
  23129. return ContinueSentinel;
  23130. }
  23131. var info = record.arg;
  23132. if (! info) {
  23133. context.method = "throw";
  23134. context.arg = new TypeError("iterator result is not an object");
  23135. context.delegate = null;
  23136. return ContinueSentinel;
  23137. }
  23138. if (info.done) {
  23139. // Assign the result of the finished delegate to the temporary
  23140. // variable specified by delegate.resultName (see delegateYield).
  23141. context[delegate.resultName] = info.value;
  23142. // Resume execution at the desired location (see delegateYield).
  23143. context.next = delegate.nextLoc;
  23144. // If context.method was "throw" but the delegate handled the
  23145. // exception, let the outer generator proceed normally. If
  23146. // context.method was "next", forget context.arg since it has been
  23147. // "consumed" by the delegate iterator. If context.method was
  23148. // "return", allow the original .return call to continue in the
  23149. // outer generator.
  23150. if (context.method !== "return") {
  23151. context.method = "next";
  23152. context.arg = undefined;
  23153. }
  23154. } else {
  23155. // Re-yield the result returned by the delegate method.
  23156. return info;
  23157. }
  23158. // The delegate iterator is finished, so forget it and continue with
  23159. // the outer generator.
  23160. context.delegate = null;
  23161. return ContinueSentinel;
  23162. }
  23163. // Define Generator.prototype.{next,throw,return} in terms of the
  23164. // unified ._invoke helper method.
  23165. defineIteratorMethods(Gp);
  23166. define(Gp, toStringTagSymbol, "Generator");
  23167. // A Generator should always return itself as the iterator object when the
  23168. // @@iterator function is called on it. Some browsers' implementations of the
  23169. // iterator prototype chain incorrectly implement this, causing the Generator
  23170. // object to not be returned from this call. This ensures that doesn't happen.
  23171. // See https://github.com/facebook/regenerator/issues/274 for more details.
  23172. define(Gp, iteratorSymbol, function() {
  23173. return this;
  23174. });
  23175. define(Gp, "toString", function() {
  23176. return "[object Generator]";
  23177. });
  23178. function pushTryEntry(locs) {
  23179. var entry = { tryLoc: locs[0] };
  23180. if (1 in locs) {
  23181. entry.catchLoc = locs[1];
  23182. }
  23183. if (2 in locs) {
  23184. entry.finallyLoc = locs[2];
  23185. entry.afterLoc = locs[3];
  23186. }
  23187. this.tryEntries.push(entry);
  23188. }
  23189. function resetTryEntry(entry) {
  23190. var record = entry.completion || {};
  23191. record.type = "normal";
  23192. delete record.arg;
  23193. entry.completion = record;
  23194. }
  23195. function Context(tryLocsList) {
  23196. // The root entry object (effectively a try statement without a catch
  23197. // or a finally block) gives us a place to store values thrown from
  23198. // locations where there is no enclosing try statement.
  23199. this.tryEntries = [{ tryLoc: "root" }];
  23200. tryLocsList.forEach(pushTryEntry, this);
  23201. this.reset(true);
  23202. }
  23203. exports.keys = function(object) {
  23204. var keys = [];
  23205. for (var key in object) {
  23206. keys.push(key);
  23207. }
  23208. keys.reverse();
  23209. // Rather than returning an object with a next method, we keep
  23210. // things simple and return the next function itself.
  23211. return function next() {
  23212. while (keys.length) {
  23213. var key = keys.pop();
  23214. if (key in object) {
  23215. next.value = key;
  23216. next.done = false;
  23217. return next;
  23218. }
  23219. }
  23220. // To avoid creating an additional object, we just hang the .value
  23221. // and .done properties off the next function object itself. This
  23222. // also ensures that the minifier will not anonymize the function.
  23223. next.done = true;
  23224. return next;
  23225. };
  23226. };
  23227. function values(iterable) {
  23228. if (iterable) {
  23229. var iteratorMethod = iterable[iteratorSymbol];
  23230. if (iteratorMethod) {
  23231. return iteratorMethod.call(iterable);
  23232. }
  23233. if (typeof iterable.next === "function") {
  23234. return iterable;
  23235. }
  23236. if (!isNaN(iterable.length)) {
  23237. var i = -1, next = function next() {
  23238. while (++i < iterable.length) {
  23239. if (hasOwn.call(iterable, i)) {
  23240. next.value = iterable[i];
  23241. next.done = false;
  23242. return next;
  23243. }
  23244. }
  23245. next.value = undefined;
  23246. next.done = true;
  23247. return next;
  23248. };
  23249. return next.next = next;
  23250. }
  23251. }
  23252. // Return an iterator with no values.
  23253. return { next: doneResult };
  23254. }
  23255. exports.values = values;
  23256. function doneResult() {
  23257. return { value: undefined, done: true };
  23258. }
  23259. Context.prototype = {
  23260. constructor: Context,
  23261. reset: function(skipTempReset) {
  23262. this.prev = 0;
  23263. this.next = 0;
  23264. // Resetting context._sent for legacy support of Babel's
  23265. // function.sent implementation.
  23266. this.sent = this._sent = undefined;
  23267. this.done = false;
  23268. this.delegate = null;
  23269. this.method = "next";
  23270. this.arg = undefined;
  23271. this.tryEntries.forEach(resetTryEntry);
  23272. if (!skipTempReset) {
  23273. for (var name in this) {
  23274. // Not sure about the optimal order of these conditions:
  23275. if (name.charAt(0) === "t" &&
  23276. hasOwn.call(this, name) &&
  23277. !isNaN(+name.slice(1))) {
  23278. this[name] = undefined;
  23279. }
  23280. }
  23281. }
  23282. },
  23283. stop: function() {
  23284. this.done = true;
  23285. var rootEntry = this.tryEntries[0];
  23286. var rootRecord = rootEntry.completion;
  23287. if (rootRecord.type === "throw") {
  23288. throw rootRecord.arg;
  23289. }
  23290. return this.rval;
  23291. },
  23292. dispatchException: function(exception) {
  23293. if (this.done) {
  23294. throw exception;
  23295. }
  23296. var context = this;
  23297. function handle(loc, caught) {
  23298. record.type = "throw";
  23299. record.arg = exception;
  23300. context.next = loc;
  23301. if (caught) {
  23302. // If the dispatched exception was caught by a catch block,
  23303. // then let that catch block handle the exception normally.
  23304. context.method = "next";
  23305. context.arg = undefined;
  23306. }
  23307. return !! caught;
  23308. }
  23309. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  23310. var entry = this.tryEntries[i];
  23311. var record = entry.completion;
  23312. if (entry.tryLoc === "root") {
  23313. // Exception thrown outside of any try block that could handle
  23314. // it, so set the completion value of the entire function to
  23315. // throw the exception.
  23316. return handle("end");
  23317. }
  23318. if (entry.tryLoc <= this.prev) {
  23319. var hasCatch = hasOwn.call(entry, "catchLoc");
  23320. var hasFinally = hasOwn.call(entry, "finallyLoc");
  23321. if (hasCatch && hasFinally) {
  23322. if (this.prev < entry.catchLoc) {
  23323. return handle(entry.catchLoc, true);
  23324. } else if (this.prev < entry.finallyLoc) {
  23325. return handle(entry.finallyLoc);
  23326. }
  23327. } else if (hasCatch) {
  23328. if (this.prev < entry.catchLoc) {
  23329. return handle(entry.catchLoc, true);
  23330. }
  23331. } else if (hasFinally) {
  23332. if (this.prev < entry.finallyLoc) {
  23333. return handle(entry.finallyLoc);
  23334. }
  23335. } else {
  23336. throw new Error("try statement without catch or finally");
  23337. }
  23338. }
  23339. }
  23340. },
  23341. abrupt: function(type, arg) {
  23342. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  23343. var entry = this.tryEntries[i];
  23344. if (entry.tryLoc <= this.prev &&
  23345. hasOwn.call(entry, "finallyLoc") &&
  23346. this.prev < entry.finallyLoc) {
  23347. var finallyEntry = entry;
  23348. break;
  23349. }
  23350. }
  23351. if (finallyEntry &&
  23352. (type === "break" ||
  23353. type === "continue") &&
  23354. finallyEntry.tryLoc <= arg &&
  23355. arg <= finallyEntry.finallyLoc) {
  23356. // Ignore the finally entry if control is not jumping to a
  23357. // location outside the try/catch block.
  23358. finallyEntry = null;
  23359. }
  23360. var record = finallyEntry ? finallyEntry.completion : {};
  23361. record.type = type;
  23362. record.arg = arg;
  23363. if (finallyEntry) {
  23364. this.method = "next";
  23365. this.next = finallyEntry.finallyLoc;
  23366. return ContinueSentinel;
  23367. }
  23368. return this.complete(record);
  23369. },
  23370. complete: function(record, afterLoc) {
  23371. if (record.type === "throw") {
  23372. throw record.arg;
  23373. }
  23374. if (record.type === "break" ||
  23375. record.type === "continue") {
  23376. this.next = record.arg;
  23377. } else if (record.type === "return") {
  23378. this.rval = this.arg = record.arg;
  23379. this.method = "return";
  23380. this.next = "end";
  23381. } else if (record.type === "normal" && afterLoc) {
  23382. this.next = afterLoc;
  23383. }
  23384. return ContinueSentinel;
  23385. },
  23386. finish: function(finallyLoc) {
  23387. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  23388. var entry = this.tryEntries[i];
  23389. if (entry.finallyLoc === finallyLoc) {
  23390. this.complete(entry.completion, entry.afterLoc);
  23391. resetTryEntry(entry);
  23392. return ContinueSentinel;
  23393. }
  23394. }
  23395. },
  23396. "catch": function(tryLoc) {
  23397. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  23398. var entry = this.tryEntries[i];
  23399. if (entry.tryLoc === tryLoc) {
  23400. var record = entry.completion;
  23401. if (record.type === "throw") {
  23402. var thrown = record.arg;
  23403. resetTryEntry(entry);
  23404. }
  23405. return thrown;
  23406. }
  23407. }
  23408. // The context.catch method must only be called with a location
  23409. // argument that corresponds to a known catch block.
  23410. throw new Error("illegal catch attempt");
  23411. },
  23412. delegateYield: function(iterable, resultName, nextLoc) {
  23413. this.delegate = {
  23414. iterator: values(iterable),
  23415. resultName: resultName,
  23416. nextLoc: nextLoc
  23417. };
  23418. if (this.method === "next") {
  23419. // Deliberately forget the last sent value so that we don't
  23420. // accidentally pass it on to the delegate.
  23421. this.arg = undefined;
  23422. }
  23423. return ContinueSentinel;
  23424. }
  23425. };
  23426. // Regardless of whether this script is executing as a CommonJS module
  23427. // or not, return the runtime object so that we can declare the variable
  23428. // regeneratorRuntime in the outer scope, which allows this module to be
  23429. // injected easily by `bin/regenerator --include-runtime script.js`.
  23430. return exports;
  23431. }(
  23432. // If this script is executing as a CommonJS module, use module.exports
  23433. // as the regeneratorRuntime namespace. Otherwise create a new empty
  23434. // object. Either way, the resulting object will be used to initialize
  23435. // the regeneratorRuntime variable at the top of this file.
  23436. typeof module === "object" ? module.exports : {}
  23437. ));
  23438. try {
  23439. regeneratorRuntime = runtime;
  23440. } catch (accidentalStrictMode) {
  23441. // This module should not be running in strict mode, so the above
  23442. // assignment should always work unless something is misconfigured. Just
  23443. // in case runtime.js accidentally runs in strict mode, in modern engines
  23444. // we can explicitly access globalThis. In older engines we can escape
  23445. // strict mode using a global Function call. This could conceivably fail
  23446. // if a Content Security Policy forbids using Function, but in that case
  23447. // the proper solution is to fix the accidental strict mode problem. If
  23448. // you've misconfigured your bundler to force strict mode and applied a
  23449. // CSP to forbid Function, and you're not willing to fix either of those
  23450. // problems, please detail your unique predicament in a GitHub issue.
  23451. if (typeof globalThis === "object") {
  23452. globalThis.regeneratorRuntime = runtime;
  23453. } else {
  23454. Function("r", "regeneratorRuntime = r")(runtime);
  23455. }
  23456. }
  23457. },{}],145:[function(_dereq_,module,exports){
  23458. module.exports = _dereq_("regenerator-runtime");
  23459. },{"regenerator-runtime":144}],146:[function(_dereq_,module,exports){
  23460. },{}],147:[function(_dereq_,module,exports){
  23461. var parent = _dereq_('../../stable/array/from');
  23462. module.exports = parent;
  23463. },{"../../stable/array/from":546}],148:[function(_dereq_,module,exports){
  23464. var parent = _dereq_('../../stable/array/is-array');
  23465. module.exports = parent;
  23466. },{"../../stable/array/is-array":547}],149:[function(_dereq_,module,exports){
  23467. var parent = _dereq_('../stable/get-iterator-method');
  23468. module.exports = parent;
  23469. },{"../stable/get-iterator-method":552}],150:[function(_dereq_,module,exports){
  23470. var parent = _dereq_('../../stable/instance/bind');
  23471. module.exports = parent;
  23472. },{"../../stable/instance/bind":553}],151:[function(_dereq_,module,exports){
  23473. var parent = _dereq_('../../stable/instance/index-of');
  23474. module.exports = parent;
  23475. },{"../../stable/instance/index-of":562}],152:[function(_dereq_,module,exports){
  23476. var parent = _dereq_('../../stable/instance/slice');
  23477. module.exports = parent;
  23478. },{"../../stable/instance/slice":567}],153:[function(_dereq_,module,exports){
  23479. var parent = _dereq_('../../stable/map');
  23480. module.exports = parent;
  23481. },{"../../stable/map":573}],154:[function(_dereq_,module,exports){
  23482. var parent = _dereq_('../../stable/object/create');
  23483. module.exports = parent;
  23484. },{"../../stable/object/create":576}],155:[function(_dereq_,module,exports){
  23485. var parent = _dereq_('../../stable/object/define-property');
  23486. module.exports = parent;
  23487. },{"../../stable/object/define-property":578}],156:[function(_dereq_,module,exports){
  23488. var parent = _dereq_('../../stable/object/get-own-property-descriptor');
  23489. module.exports = parent;
  23490. },{"../../stable/object/get-own-property-descriptor":581}],157:[function(_dereq_,module,exports){
  23491. var parent = _dereq_('../../stable/object/get-prototype-of');
  23492. module.exports = parent;
  23493. },{"../../stable/object/get-prototype-of":584}],158:[function(_dereq_,module,exports){
  23494. var parent = _dereq_('../../stable/object/set-prototype-of');
  23495. module.exports = parent;
  23496. },{"../../stable/object/set-prototype-of":586}],159:[function(_dereq_,module,exports){
  23497. var parent = _dereq_('../../stable/promise');
  23498. module.exports = parent;
  23499. },{"../../stable/promise":588}],160:[function(_dereq_,module,exports){
  23500. var parent = _dereq_('../../stable/reflect/construct');
  23501. module.exports = parent;
  23502. },{"../../stable/reflect/construct":589}],161:[function(_dereq_,module,exports){
  23503. var parent = _dereq_('../../stable/reflect/get');
  23504. module.exports = parent;
  23505. },{"../../stable/reflect/get":590}],162:[function(_dereq_,module,exports){
  23506. var parent = _dereq_('../../stable/symbol');
  23507. module.exports = parent;
  23508. },{"../../stable/symbol":594}],163:[function(_dereq_,module,exports){
  23509. var parent = _dereq_('../../stable/symbol/iterator');
  23510. module.exports = parent;
  23511. },{"../../stable/symbol/iterator":595}],164:[function(_dereq_,module,exports){
  23512. _dereq_('../../modules/es.string.iterator');
  23513. _dereq_('../../modules/es.array.from');
  23514. var path = _dereq_('../../internals/path');
  23515. module.exports = path.Array.from;
  23516. },{"../../internals/path":391,"../../modules/es.array.from":440,"../../modules/es.string.iterator":488}],165:[function(_dereq_,module,exports){
  23517. _dereq_('../../modules/es.array.is-array');
  23518. var path = _dereq_('../../internals/path');
  23519. module.exports = path.Array.isArray;
  23520. },{"../../internals/path":391,"../../modules/es.array.is-array":443}],166:[function(_dereq_,module,exports){
  23521. _dereq_('../../../modules/es.array.concat');
  23522. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23523. module.exports = entryVirtual('Array').concat;
  23524. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.concat":434}],167:[function(_dereq_,module,exports){
  23525. _dereq_('../../../modules/es.array.iterator');
  23526. _dereq_('../../../modules/es.object.to-string');
  23527. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23528. module.exports = entryVirtual('Array').entries;
  23529. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.iterator":444,"../../../modules/es.object.to-string":470}],168:[function(_dereq_,module,exports){
  23530. _dereq_('../../../modules/es.array.every');
  23531. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23532. module.exports = entryVirtual('Array').every;
  23533. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.every":435}],169:[function(_dereq_,module,exports){
  23534. _dereq_('../../../modules/es.array.filter');
  23535. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23536. module.exports = entryVirtual('Array').filter;
  23537. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.filter":436}],170:[function(_dereq_,module,exports){
  23538. _dereq_('../../../modules/es.array.find-index');
  23539. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23540. module.exports = entryVirtual('Array').findIndex;
  23541. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.find-index":437}],171:[function(_dereq_,module,exports){
  23542. _dereq_('../../../modules/es.array.find');
  23543. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23544. module.exports = entryVirtual('Array').find;
  23545. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.find":438}],172:[function(_dereq_,module,exports){
  23546. _dereq_('../../../modules/es.array.for-each');
  23547. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23548. module.exports = entryVirtual('Array').forEach;
  23549. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.for-each":439}],173:[function(_dereq_,module,exports){
  23550. _dereq_('../../../modules/es.array.includes');
  23551. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23552. module.exports = entryVirtual('Array').includes;
  23553. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.includes":441}],174:[function(_dereq_,module,exports){
  23554. _dereq_('../../../modules/es.array.index-of');
  23555. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23556. module.exports = entryVirtual('Array').indexOf;
  23557. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.index-of":442}],175:[function(_dereq_,module,exports){
  23558. _dereq_('../../../modules/es.array.iterator');
  23559. _dereq_('../../../modules/es.object.to-string');
  23560. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23561. module.exports = entryVirtual('Array').keys;
  23562. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.iterator":444,"../../../modules/es.object.to-string":470}],176:[function(_dereq_,module,exports){
  23563. _dereq_('../../../modules/es.array.map');
  23564. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23565. module.exports = entryVirtual('Array').map;
  23566. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.map":445}],177:[function(_dereq_,module,exports){
  23567. _dereq_('../../../modules/es.array.reduce');
  23568. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23569. module.exports = entryVirtual('Array').reduce;
  23570. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.reduce":446}],178:[function(_dereq_,module,exports){
  23571. _dereq_('../../../modules/es.array.reverse');
  23572. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23573. module.exports = entryVirtual('Array').reverse;
  23574. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.reverse":447}],179:[function(_dereq_,module,exports){
  23575. _dereq_('../../../modules/es.array.slice');
  23576. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23577. module.exports = entryVirtual('Array').slice;
  23578. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.slice":448}],180:[function(_dereq_,module,exports){
  23579. _dereq_('../../../modules/es.array.sort');
  23580. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23581. module.exports = entryVirtual('Array').sort;
  23582. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.sort":449}],181:[function(_dereq_,module,exports){
  23583. _dereq_('../../../modules/es.array.splice');
  23584. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23585. module.exports = entryVirtual('Array').splice;
  23586. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.splice":450}],182:[function(_dereq_,module,exports){
  23587. _dereq_('../../../modules/es.array.iterator');
  23588. _dereq_('../../../modules/es.object.to-string');
  23589. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23590. module.exports = entryVirtual('Array').values;
  23591. },{"../../../internals/entry-virtual":315,"../../../modules/es.array.iterator":444,"../../../modules/es.object.to-string":470}],183:[function(_dereq_,module,exports){
  23592. _dereq_('../../../modules/es.function.bind');
  23593. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23594. module.exports = entryVirtual('Function').bind;
  23595. },{"../../../internals/entry-virtual":315,"../../../modules/es.function.bind":451}],184:[function(_dereq_,module,exports){
  23596. _dereq_('../modules/es.array.iterator');
  23597. _dereq_('../modules/es.string.iterator');
  23598. var getIteratorMethod = _dereq_('../internals/get-iterator-method');
  23599. module.exports = getIteratorMethod;
  23600. },{"../internals/get-iterator-method":330,"../modules/es.array.iterator":444,"../modules/es.string.iterator":488}],185:[function(_dereq_,module,exports){
  23601. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23602. var method = _dereq_('../function/virtual/bind');
  23603. var FunctionPrototype = Function.prototype;
  23604. module.exports = function (it) {
  23605. var own = it.bind;
  23606. return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
  23607. };
  23608. },{"../../internals/object-is-prototype-of":382,"../function/virtual/bind":183}],186:[function(_dereq_,module,exports){
  23609. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23610. var method = _dereq_('../array/virtual/concat');
  23611. var ArrayPrototype = Array.prototype;
  23612. module.exports = function (it) {
  23613. var own = it.concat;
  23614. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
  23615. };
  23616. },{"../../internals/object-is-prototype-of":382,"../array/virtual/concat":166}],187:[function(_dereq_,module,exports){
  23617. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23618. var method = _dereq_('../array/virtual/every');
  23619. var ArrayPrototype = Array.prototype;
  23620. module.exports = function (it) {
  23621. var own = it.every;
  23622. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.every) ? method : own;
  23623. };
  23624. },{"../../internals/object-is-prototype-of":382,"../array/virtual/every":168}],188:[function(_dereq_,module,exports){
  23625. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23626. var method = _dereq_('../array/virtual/filter');
  23627. var ArrayPrototype = Array.prototype;
  23628. module.exports = function (it) {
  23629. var own = it.filter;
  23630. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
  23631. };
  23632. },{"../../internals/object-is-prototype-of":382,"../array/virtual/filter":169}],189:[function(_dereq_,module,exports){
  23633. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23634. var method = _dereq_('../array/virtual/find-index');
  23635. var ArrayPrototype = Array.prototype;
  23636. module.exports = function (it) {
  23637. var own = it.findIndex;
  23638. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.findIndex) ? method : own;
  23639. };
  23640. },{"../../internals/object-is-prototype-of":382,"../array/virtual/find-index":170}],190:[function(_dereq_,module,exports){
  23641. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23642. var method = _dereq_('../array/virtual/find');
  23643. var ArrayPrototype = Array.prototype;
  23644. module.exports = function (it) {
  23645. var own = it.find;
  23646. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
  23647. };
  23648. },{"../../internals/object-is-prototype-of":382,"../array/virtual/find":171}],191:[function(_dereq_,module,exports){
  23649. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23650. var arrayMethod = _dereq_('../array/virtual/includes');
  23651. var stringMethod = _dereq_('../string/virtual/includes');
  23652. var ArrayPrototype = Array.prototype;
  23653. var StringPrototype = String.prototype;
  23654. module.exports = function (it) {
  23655. var own = it.includes;
  23656. if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;
  23657. if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {
  23658. return stringMethod;
  23659. } return own;
  23660. };
  23661. },{"../../internals/object-is-prototype-of":382,"../array/virtual/includes":173,"../string/virtual/includes":220}],192:[function(_dereq_,module,exports){
  23662. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23663. var method = _dereq_('../array/virtual/index-of');
  23664. var ArrayPrototype = Array.prototype;
  23665. module.exports = function (it) {
  23666. var own = it.indexOf;
  23667. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
  23668. };
  23669. },{"../../internals/object-is-prototype-of":382,"../array/virtual/index-of":174}],193:[function(_dereq_,module,exports){
  23670. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23671. var method = _dereq_('../array/virtual/map');
  23672. var ArrayPrototype = Array.prototype;
  23673. module.exports = function (it) {
  23674. var own = it.map;
  23675. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
  23676. };
  23677. },{"../../internals/object-is-prototype-of":382,"../array/virtual/map":176}],194:[function(_dereq_,module,exports){
  23678. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23679. var method = _dereq_('../array/virtual/reduce');
  23680. var ArrayPrototype = Array.prototype;
  23681. module.exports = function (it) {
  23682. var own = it.reduce;
  23683. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
  23684. };
  23685. },{"../../internals/object-is-prototype-of":382,"../array/virtual/reduce":177}],195:[function(_dereq_,module,exports){
  23686. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23687. var method = _dereq_('../array/virtual/reverse');
  23688. var ArrayPrototype = Array.prototype;
  23689. module.exports = function (it) {
  23690. var own = it.reverse;
  23691. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reverse) ? method : own;
  23692. };
  23693. },{"../../internals/object-is-prototype-of":382,"../array/virtual/reverse":178}],196:[function(_dereq_,module,exports){
  23694. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23695. var method = _dereq_('../array/virtual/slice');
  23696. var ArrayPrototype = Array.prototype;
  23697. module.exports = function (it) {
  23698. var own = it.slice;
  23699. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
  23700. };
  23701. },{"../../internals/object-is-prototype-of":382,"../array/virtual/slice":179}],197:[function(_dereq_,module,exports){
  23702. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23703. var method = _dereq_('../array/virtual/sort');
  23704. var ArrayPrototype = Array.prototype;
  23705. module.exports = function (it) {
  23706. var own = it.sort;
  23707. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.sort) ? method : own;
  23708. };
  23709. },{"../../internals/object-is-prototype-of":382,"../array/virtual/sort":180}],198:[function(_dereq_,module,exports){
  23710. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23711. var method = _dereq_('../array/virtual/splice');
  23712. var ArrayPrototype = Array.prototype;
  23713. module.exports = function (it) {
  23714. var own = it.splice;
  23715. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.splice) ? method : own;
  23716. };
  23717. },{"../../internals/object-is-prototype-of":382,"../array/virtual/splice":181}],199:[function(_dereq_,module,exports){
  23718. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  23719. var method = _dereq_('../string/virtual/starts-with');
  23720. var StringPrototype = String.prototype;
  23721. module.exports = function (it) {
  23722. var own = it.startsWith;
  23723. return typeof it == 'string' || it === StringPrototype
  23724. || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.startsWith) ? method : own;
  23725. };
  23726. },{"../../internals/object-is-prototype-of":382,"../string/virtual/starts-with":221}],200:[function(_dereq_,module,exports){
  23727. _dereq_('../../modules/es.json.stringify');
  23728. var path = _dereq_('../../internals/path');
  23729. var apply = _dereq_('../../internals/function-apply');
  23730. // eslint-disable-next-line es-x/no-json -- safe
  23731. if (!path.JSON) path.JSON = { stringify: JSON.stringify };
  23732. // eslint-disable-next-line no-unused-vars -- required for `.length`
  23733. module.exports = function stringify(it, replacer, space) {
  23734. return apply(path.JSON.stringify, null, arguments);
  23735. };
  23736. },{"../../internals/function-apply":322,"../../internals/path":391,"../../modules/es.json.stringify":452}],201:[function(_dereq_,module,exports){
  23737. _dereq_('../../modules/es.array.iterator');
  23738. _dereq_('../../modules/es.map');
  23739. _dereq_('../../modules/es.object.to-string');
  23740. _dereq_('../../modules/es.string.iterator');
  23741. var path = _dereq_('../../internals/path');
  23742. module.exports = path.Map;
  23743. },{"../../internals/path":391,"../../modules/es.array.iterator":444,"../../modules/es.map":455,"../../modules/es.object.to-string":470,"../../modules/es.string.iterator":488}],202:[function(_dereq_,module,exports){
  23744. _dereq_('../../modules/es.number.is-integer');
  23745. var path = _dereq_('../../internals/path');
  23746. module.exports = path.Number.isInteger;
  23747. },{"../../internals/path":391,"../../modules/es.number.is-integer":457}],203:[function(_dereq_,module,exports){
  23748. _dereq_('../../modules/es.object.assign');
  23749. var path = _dereq_('../../internals/path');
  23750. module.exports = path.Object.assign;
  23751. },{"../../internals/path":391,"../../modules/es.object.assign":458}],204:[function(_dereq_,module,exports){
  23752. _dereq_('../../modules/es.object.create');
  23753. var path = _dereq_('../../internals/path');
  23754. var Object = path.Object;
  23755. module.exports = function create(P, D) {
  23756. return Object.create(P, D);
  23757. };
  23758. },{"../../internals/path":391,"../../modules/es.object.create":459}],205:[function(_dereq_,module,exports){
  23759. _dereq_('../../modules/es.object.define-properties');
  23760. var path = _dereq_('../../internals/path');
  23761. var Object = path.Object;
  23762. var defineProperties = module.exports = function defineProperties(T, D) {
  23763. return Object.defineProperties(T, D);
  23764. };
  23765. if (Object.defineProperties.sham) defineProperties.sham = true;
  23766. },{"../../internals/path":391,"../../modules/es.object.define-properties":460}],206:[function(_dereq_,module,exports){
  23767. _dereq_('../../modules/es.object.define-property');
  23768. var path = _dereq_('../../internals/path');
  23769. var Object = path.Object;
  23770. var defineProperty = module.exports = function defineProperty(it, key, desc) {
  23771. return Object.defineProperty(it, key, desc);
  23772. };
  23773. if (Object.defineProperty.sham) defineProperty.sham = true;
  23774. },{"../../internals/path":391,"../../modules/es.object.define-property":461}],207:[function(_dereq_,module,exports){
  23775. _dereq_('../../modules/es.object.entries');
  23776. var path = _dereq_('../../internals/path');
  23777. module.exports = path.Object.entries;
  23778. },{"../../internals/path":391,"../../modules/es.object.entries":462}],208:[function(_dereq_,module,exports){
  23779. _dereq_('../../modules/es.object.freeze');
  23780. var path = _dereq_('../../internals/path');
  23781. module.exports = path.Object.freeze;
  23782. },{"../../internals/path":391,"../../modules/es.object.freeze":463}],209:[function(_dereq_,module,exports){
  23783. _dereq_('../../modules/es.object.get-own-property-descriptor');
  23784. var path = _dereq_('../../internals/path');
  23785. var Object = path.Object;
  23786. var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
  23787. return Object.getOwnPropertyDescriptor(it, key);
  23788. };
  23789. if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
  23790. },{"../../internals/path":391,"../../modules/es.object.get-own-property-descriptor":464}],210:[function(_dereq_,module,exports){
  23791. _dereq_('../../modules/es.object.get-own-property-descriptors');
  23792. var path = _dereq_('../../internals/path');
  23793. module.exports = path.Object.getOwnPropertyDescriptors;
  23794. },{"../../internals/path":391,"../../modules/es.object.get-own-property-descriptors":465}],211:[function(_dereq_,module,exports){
  23795. _dereq_('../../modules/es.symbol');
  23796. var path = _dereq_('../../internals/path');
  23797. module.exports = path.Object.getOwnPropertySymbols;
  23798. },{"../../internals/path":391,"../../modules/es.symbol":497}],212:[function(_dereq_,module,exports){
  23799. _dereq_('../../modules/es.object.get-prototype-of');
  23800. var path = _dereq_('../../internals/path');
  23801. module.exports = path.Object.getPrototypeOf;
  23802. },{"../../internals/path":391,"../../modules/es.object.get-prototype-of":467}],213:[function(_dereq_,module,exports){
  23803. _dereq_('../../modules/es.object.keys');
  23804. var path = _dereq_('../../internals/path');
  23805. module.exports = path.Object.keys;
  23806. },{"../../internals/path":391,"../../modules/es.object.keys":468}],214:[function(_dereq_,module,exports){
  23807. _dereq_('../../modules/es.object.set-prototype-of');
  23808. var path = _dereq_('../../internals/path');
  23809. module.exports = path.Object.setPrototypeOf;
  23810. },{"../../internals/path":391,"../../modules/es.object.set-prototype-of":469}],215:[function(_dereq_,module,exports){
  23811. _dereq_('../modules/es.parse-int');
  23812. var path = _dereq_('../internals/path');
  23813. module.exports = path.parseInt;
  23814. },{"../internals/path":391,"../modules/es.parse-int":471}],216:[function(_dereq_,module,exports){
  23815. _dereq_('../../modules/es.aggregate-error');
  23816. _dereq_('../../modules/es.array.iterator');
  23817. _dereq_('../../modules/es.object.to-string');
  23818. _dereq_('../../modules/es.promise');
  23819. _dereq_('../../modules/es.promise.all-settled');
  23820. _dereq_('../../modules/es.promise.any');
  23821. _dereq_('../../modules/es.promise.finally');
  23822. _dereq_('../../modules/es.string.iterator');
  23823. var path = _dereq_('../../internals/path');
  23824. module.exports = path.Promise;
  23825. },{"../../internals/path":391,"../../modules/es.aggregate-error":433,"../../modules/es.array.iterator":444,"../../modules/es.object.to-string":470,"../../modules/es.promise":478,"../../modules/es.promise.all-settled":472,"../../modules/es.promise.any":474,"../../modules/es.promise.finally":477,"../../modules/es.string.iterator":488}],217:[function(_dereq_,module,exports){
  23826. _dereq_('../../modules/es.reflect.construct');
  23827. var path = _dereq_('../../internals/path');
  23828. module.exports = path.Reflect.construct;
  23829. },{"../../internals/path":391,"../../modules/es.reflect.construct":482}],218:[function(_dereq_,module,exports){
  23830. _dereq_('../../modules/es.reflect.get');
  23831. var path = _dereq_('../../internals/path');
  23832. module.exports = path.Reflect.get;
  23833. },{"../../internals/path":391,"../../modules/es.reflect.get":483}],219:[function(_dereq_,module,exports){
  23834. _dereq_('../../modules/es.array.iterator');
  23835. _dereq_('../../modules/es.object.to-string');
  23836. _dereq_('../../modules/es.set');
  23837. _dereq_('../../modules/es.string.iterator');
  23838. var path = _dereq_('../../internals/path');
  23839. module.exports = path.Set;
  23840. },{"../../internals/path":391,"../../modules/es.array.iterator":444,"../../modules/es.object.to-string":470,"../../modules/es.set":486,"../../modules/es.string.iterator":488}],220:[function(_dereq_,module,exports){
  23841. _dereq_('../../../modules/es.string.includes');
  23842. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23843. module.exports = entryVirtual('String').includes;
  23844. },{"../../../internals/entry-virtual":315,"../../../modules/es.string.includes":487}],221:[function(_dereq_,module,exports){
  23845. _dereq_('../../../modules/es.string.starts-with');
  23846. var entryVirtual = _dereq_('../../../internals/entry-virtual');
  23847. module.exports = entryVirtual('String').startsWith;
  23848. },{"../../../internals/entry-virtual":315,"../../../modules/es.string.starts-with":489}],222:[function(_dereq_,module,exports){
  23849. _dereq_('../../modules/es.array.concat');
  23850. _dereq_('../../modules/es.object.to-string');
  23851. _dereq_('../../modules/es.symbol');
  23852. _dereq_('../../modules/es.symbol.async-iterator');
  23853. _dereq_('../../modules/es.symbol.description');
  23854. _dereq_('../../modules/es.symbol.has-instance');
  23855. _dereq_('../../modules/es.symbol.is-concat-spreadable');
  23856. _dereq_('../../modules/es.symbol.iterator');
  23857. _dereq_('../../modules/es.symbol.match');
  23858. _dereq_('../../modules/es.symbol.match-all');
  23859. _dereq_('../../modules/es.symbol.replace');
  23860. _dereq_('../../modules/es.symbol.search');
  23861. _dereq_('../../modules/es.symbol.species');
  23862. _dereq_('../../modules/es.symbol.split');
  23863. _dereq_('../../modules/es.symbol.to-primitive');
  23864. _dereq_('../../modules/es.symbol.to-string-tag');
  23865. _dereq_('../../modules/es.symbol.unscopables');
  23866. _dereq_('../../modules/es.json.to-string-tag');
  23867. _dereq_('../../modules/es.math.to-string-tag');
  23868. _dereq_('../../modules/es.reflect.to-string-tag');
  23869. var path = _dereq_('../../internals/path');
  23870. module.exports = path.Symbol;
  23871. },{"../../internals/path":391,"../../modules/es.array.concat":434,"../../modules/es.json.to-string-tag":453,"../../modules/es.math.to-string-tag":456,"../../modules/es.object.to-string":470,"../../modules/es.reflect.to-string-tag":484,"../../modules/es.symbol":497,"../../modules/es.symbol.async-iterator":490,"../../modules/es.symbol.description":492,"../../modules/es.symbol.has-instance":494,"../../modules/es.symbol.is-concat-spreadable":495,"../../modules/es.symbol.iterator":496,"../../modules/es.symbol.match":500,"../../modules/es.symbol.match-all":499,"../../modules/es.symbol.replace":501,"../../modules/es.symbol.search":502,"../../modules/es.symbol.species":503,"../../modules/es.symbol.split":504,"../../modules/es.symbol.to-primitive":505,"../../modules/es.symbol.to-string-tag":506,"../../modules/es.symbol.unscopables":507}],223:[function(_dereq_,module,exports){
  23872. _dereq_('../../modules/es.array.iterator');
  23873. _dereq_('../../modules/es.object.to-string');
  23874. _dereq_('../../modules/es.string.iterator');
  23875. _dereq_('../../modules/es.symbol.iterator');
  23876. var WrappedWellKnownSymbolModule = _dereq_('../../internals/well-known-symbol-wrapped');
  23877. module.exports = WrappedWellKnownSymbolModule.f('iterator');
  23878. },{"../../internals/well-known-symbol-wrapped":429,"../../modules/es.array.iterator":444,"../../modules/es.object.to-string":470,"../../modules/es.string.iterator":488,"../../modules/es.symbol.iterator":496}],224:[function(_dereq_,module,exports){
  23879. _dereq_('../../modules/es.array.iterator');
  23880. _dereq_('../../modules/es.object.to-string');
  23881. _dereq_('../../modules/es.weak-map');
  23882. var path = _dereq_('../../internals/path');
  23883. module.exports = path.WeakMap;
  23884. },{"../../internals/path":391,"../../modules/es.array.iterator":444,"../../modules/es.object.to-string":470,"../../modules/es.weak-map":509}],225:[function(_dereq_,module,exports){
  23885. module.exports = _dereq_('../../full/array/from');
  23886. },{"../../full/array/from":242}],226:[function(_dereq_,module,exports){
  23887. module.exports = _dereq_('../../full/array/is-array');
  23888. },{"../../full/array/is-array":243}],227:[function(_dereq_,module,exports){
  23889. module.exports = _dereq_('../full/get-iterator-method');
  23890. },{"../full/get-iterator-method":244}],228:[function(_dereq_,module,exports){
  23891. module.exports = _dereq_('../../full/instance/bind');
  23892. },{"../../full/instance/bind":245}],229:[function(_dereq_,module,exports){
  23893. module.exports = _dereq_('../../full/instance/index-of');
  23894. },{"../../full/instance/index-of":246}],230:[function(_dereq_,module,exports){
  23895. module.exports = _dereq_('../../full/instance/slice');
  23896. },{"../../full/instance/slice":247}],231:[function(_dereq_,module,exports){
  23897. module.exports = _dereq_('../../full/map');
  23898. },{"../../full/map":248}],232:[function(_dereq_,module,exports){
  23899. module.exports = _dereq_('../../full/object/create');
  23900. },{"../../full/object/create":249}],233:[function(_dereq_,module,exports){
  23901. module.exports = _dereq_('../../full/object/define-property');
  23902. },{"../../full/object/define-property":250}],234:[function(_dereq_,module,exports){
  23903. module.exports = _dereq_('../../full/object/get-own-property-descriptor');
  23904. },{"../../full/object/get-own-property-descriptor":251}],235:[function(_dereq_,module,exports){
  23905. module.exports = _dereq_('../../full/object/get-prototype-of');
  23906. },{"../../full/object/get-prototype-of":252}],236:[function(_dereq_,module,exports){
  23907. module.exports = _dereq_('../../full/object/set-prototype-of');
  23908. },{"../../full/object/set-prototype-of":253}],237:[function(_dereq_,module,exports){
  23909. module.exports = _dereq_('../../full/promise');
  23910. },{"../../full/promise":254}],238:[function(_dereq_,module,exports){
  23911. module.exports = _dereq_('../../full/reflect/construct');
  23912. },{"../../full/reflect/construct":255}],239:[function(_dereq_,module,exports){
  23913. module.exports = _dereq_('../../full/reflect/get');
  23914. },{"../../full/reflect/get":256}],240:[function(_dereq_,module,exports){
  23915. module.exports = _dereq_('../../full/symbol');
  23916. },{"../../full/symbol":257}],241:[function(_dereq_,module,exports){
  23917. module.exports = _dereq_('../../full/symbol/iterator');
  23918. },{"../../full/symbol/iterator":258}],242:[function(_dereq_,module,exports){
  23919. var parent = _dereq_('../../actual/array/from');
  23920. module.exports = parent;
  23921. },{"../../actual/array/from":147}],243:[function(_dereq_,module,exports){
  23922. var parent = _dereq_('../../actual/array/is-array');
  23923. module.exports = parent;
  23924. },{"../../actual/array/is-array":148}],244:[function(_dereq_,module,exports){
  23925. var parent = _dereq_('../actual/get-iterator-method');
  23926. module.exports = parent;
  23927. },{"../actual/get-iterator-method":149}],245:[function(_dereq_,module,exports){
  23928. var parent = _dereq_('../../actual/instance/bind');
  23929. module.exports = parent;
  23930. },{"../../actual/instance/bind":150}],246:[function(_dereq_,module,exports){
  23931. var parent = _dereq_('../../actual/instance/index-of');
  23932. module.exports = parent;
  23933. },{"../../actual/instance/index-of":151}],247:[function(_dereq_,module,exports){
  23934. var parent = _dereq_('../../actual/instance/slice');
  23935. module.exports = parent;
  23936. },{"../../actual/instance/slice":152}],248:[function(_dereq_,module,exports){
  23937. var parent = _dereq_('../../actual/map');
  23938. _dereq_('../../modules/esnext.map.from');
  23939. _dereq_('../../modules/esnext.map.of');
  23940. _dereq_('../../modules/esnext.map.delete-all');
  23941. _dereq_('../../modules/esnext.map.emplace');
  23942. _dereq_('../../modules/esnext.map.every');
  23943. _dereq_('../../modules/esnext.map.filter');
  23944. _dereq_('../../modules/esnext.map.find');
  23945. _dereq_('../../modules/esnext.map.find-key');
  23946. _dereq_('../../modules/esnext.map.group-by');
  23947. _dereq_('../../modules/esnext.map.includes');
  23948. _dereq_('../../modules/esnext.map.key-by');
  23949. _dereq_('../../modules/esnext.map.key-of');
  23950. _dereq_('../../modules/esnext.map.map-keys');
  23951. _dereq_('../../modules/esnext.map.map-values');
  23952. _dereq_('../../modules/esnext.map.merge');
  23953. _dereq_('../../modules/esnext.map.reduce');
  23954. _dereq_('../../modules/esnext.map.some');
  23955. _dereq_('../../modules/esnext.map.update');
  23956. // TODO: remove from `core-js@4`
  23957. _dereq_('../../modules/esnext.map.upsert');
  23958. // TODO: remove from `core-js@4`
  23959. _dereq_('../../modules/esnext.map.update-or-insert');
  23960. module.exports = parent;
  23961. },{"../../actual/map":153,"../../modules/esnext.map.delete-all":511,"../../modules/esnext.map.emplace":512,"../../modules/esnext.map.every":513,"../../modules/esnext.map.filter":514,"../../modules/esnext.map.find":516,"../../modules/esnext.map.find-key":515,"../../modules/esnext.map.from":517,"../../modules/esnext.map.group-by":518,"../../modules/esnext.map.includes":519,"../../modules/esnext.map.key-by":520,"../../modules/esnext.map.key-of":521,"../../modules/esnext.map.map-keys":522,"../../modules/esnext.map.map-values":523,"../../modules/esnext.map.merge":524,"../../modules/esnext.map.of":525,"../../modules/esnext.map.reduce":526,"../../modules/esnext.map.some":527,"../../modules/esnext.map.update":529,"../../modules/esnext.map.update-or-insert":528,"../../modules/esnext.map.upsert":530}],249:[function(_dereq_,module,exports){
  23962. var parent = _dereq_('../../actual/object/create');
  23963. module.exports = parent;
  23964. },{"../../actual/object/create":154}],250:[function(_dereq_,module,exports){
  23965. var parent = _dereq_('../../actual/object/define-property');
  23966. module.exports = parent;
  23967. },{"../../actual/object/define-property":155}],251:[function(_dereq_,module,exports){
  23968. var parent = _dereq_('../../actual/object/get-own-property-descriptor');
  23969. module.exports = parent;
  23970. },{"../../actual/object/get-own-property-descriptor":156}],252:[function(_dereq_,module,exports){
  23971. var parent = _dereq_('../../actual/object/get-prototype-of');
  23972. module.exports = parent;
  23973. },{"../../actual/object/get-prototype-of":157}],253:[function(_dereq_,module,exports){
  23974. var parent = _dereq_('../../actual/object/set-prototype-of');
  23975. module.exports = parent;
  23976. },{"../../actual/object/set-prototype-of":158}],254:[function(_dereq_,module,exports){
  23977. var parent = _dereq_('../../actual/promise');
  23978. _dereq_('../../modules/esnext.aggregate-error');
  23979. // TODO: Remove from `core-js@4`
  23980. _dereq_('../../modules/esnext.promise.all-settled');
  23981. _dereq_('../../modules/esnext.promise.try');
  23982. _dereq_('../../modules/esnext.promise.any');
  23983. module.exports = parent;
  23984. },{"../../actual/promise":159,"../../modules/esnext.aggregate-error":510,"../../modules/esnext.promise.all-settled":531,"../../modules/esnext.promise.any":532,"../../modules/esnext.promise.try":533}],255:[function(_dereq_,module,exports){
  23985. var parent = _dereq_('../../actual/reflect/construct');
  23986. module.exports = parent;
  23987. },{"../../actual/reflect/construct":160}],256:[function(_dereq_,module,exports){
  23988. var parent = _dereq_('../../actual/reflect/get');
  23989. module.exports = parent;
  23990. },{"../../actual/reflect/get":161}],257:[function(_dereq_,module,exports){
  23991. var parent = _dereq_('../../actual/symbol');
  23992. _dereq_('../../modules/esnext.symbol.async-dispose');
  23993. _dereq_('../../modules/esnext.symbol.dispose');
  23994. _dereq_('../../modules/esnext.symbol.matcher');
  23995. _dereq_('../../modules/esnext.symbol.metadata-key');
  23996. _dereq_('../../modules/esnext.symbol.observable');
  23997. // TODO: Remove from `core-js@4`
  23998. _dereq_('../../modules/esnext.symbol.metadata');
  23999. _dereq_('../../modules/esnext.symbol.pattern-match');
  24000. _dereq_('../../modules/esnext.symbol.replace-all');
  24001. module.exports = parent;
  24002. },{"../../actual/symbol":162,"../../modules/esnext.symbol.async-dispose":534,"../../modules/esnext.symbol.dispose":535,"../../modules/esnext.symbol.matcher":536,"../../modules/esnext.symbol.metadata":538,"../../modules/esnext.symbol.metadata-key":537,"../../modules/esnext.symbol.observable":539,"../../modules/esnext.symbol.pattern-match":540,"../../modules/esnext.symbol.replace-all":541}],258:[function(_dereq_,module,exports){
  24003. var parent = _dereq_('../../actual/symbol/iterator');
  24004. module.exports = parent;
  24005. },{"../../actual/symbol/iterator":163}],259:[function(_dereq_,module,exports){
  24006. var isCallable = _dereq_('../internals/is-callable');
  24007. var tryToString = _dereq_('../internals/try-to-string');
  24008. var $TypeError = TypeError;
  24009. // `Assert: IsCallable(argument) is true`
  24010. module.exports = function (argument) {
  24011. if (isCallable(argument)) return argument;
  24012. throw $TypeError(tryToString(argument) + ' is not a function');
  24013. };
  24014. },{"../internals/is-callable":347,"../internals/try-to-string":422}],260:[function(_dereq_,module,exports){
  24015. var isConstructor = _dereq_('../internals/is-constructor');
  24016. var tryToString = _dereq_('../internals/try-to-string');
  24017. var $TypeError = TypeError;
  24018. // `Assert: IsConstructor(argument) is true`
  24019. module.exports = function (argument) {
  24020. if (isConstructor(argument)) return argument;
  24021. throw $TypeError(tryToString(argument) + ' is not a constructor');
  24022. };
  24023. },{"../internals/is-constructor":348,"../internals/try-to-string":422}],261:[function(_dereq_,module,exports){
  24024. var isCallable = _dereq_('../internals/is-callable');
  24025. var $String = String;
  24026. var $TypeError = TypeError;
  24027. module.exports = function (argument) {
  24028. if (typeof argument == 'object' || isCallable(argument)) return argument;
  24029. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  24030. };
  24031. },{"../internals/is-callable":347}],262:[function(_dereq_,module,exports){
  24032. module.exports = function () { /* empty */ };
  24033. },{}],263:[function(_dereq_,module,exports){
  24034. var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
  24035. var $TypeError = TypeError;
  24036. module.exports = function (it, Prototype) {
  24037. if (isPrototypeOf(Prototype, it)) return it;
  24038. throw $TypeError('Incorrect invocation');
  24039. };
  24040. },{"../internals/object-is-prototype-of":382}],264:[function(_dereq_,module,exports){
  24041. var isObject = _dereq_('../internals/is-object');
  24042. var $String = String;
  24043. var $TypeError = TypeError;
  24044. // `Assert: Type(argument) is Object`
  24045. module.exports = function (argument) {
  24046. if (isObject(argument)) return argument;
  24047. throw $TypeError($String(argument) + ' is not an object');
  24048. };
  24049. },{"../internals/is-object":353}],265:[function(_dereq_,module,exports){
  24050. // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
  24051. var fails = _dereq_('../internals/fails');
  24052. module.exports = fails(function () {
  24053. if (typeof ArrayBuffer == 'function') {
  24054. var buffer = new ArrayBuffer(8);
  24055. // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
  24056. if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
  24057. }
  24058. });
  24059. },{"../internals/fails":320}],266:[function(_dereq_,module,exports){
  24060. 'use strict';
  24061. var $forEach = _dereq_('../internals/array-iteration').forEach;
  24062. var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
  24063. var STRICT_METHOD = arrayMethodIsStrict('forEach');
  24064. // `Array.prototype.forEach` method implementation
  24065. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  24066. module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
  24067. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  24068. // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
  24069. } : [].forEach;
  24070. },{"../internals/array-iteration":269,"../internals/array-method-is-strict":271}],267:[function(_dereq_,module,exports){
  24071. 'use strict';
  24072. var bind = _dereq_('../internals/function-bind-context');
  24073. var call = _dereq_('../internals/function-call');
  24074. var toObject = _dereq_('../internals/to-object');
  24075. var callWithSafeIterationClosing = _dereq_('../internals/call-with-safe-iteration-closing');
  24076. var isArrayIteratorMethod = _dereq_('../internals/is-array-iterator-method');
  24077. var isConstructor = _dereq_('../internals/is-constructor');
  24078. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  24079. var createProperty = _dereq_('../internals/create-property');
  24080. var getIterator = _dereq_('../internals/get-iterator');
  24081. var getIteratorMethod = _dereq_('../internals/get-iterator-method');
  24082. var $Array = Array;
  24083. // `Array.from` method implementation
  24084. // https://tc39.es/ecma262/#sec-array.from
  24085. module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  24086. var O = toObject(arrayLike);
  24087. var IS_CONSTRUCTOR = isConstructor(this);
  24088. var argumentsLength = arguments.length;
  24089. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  24090. var mapping = mapfn !== undefined;
  24091. if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
  24092. var iteratorMethod = getIteratorMethod(O);
  24093. var index = 0;
  24094. var length, result, step, iterator, next, value;
  24095. // if the target is not iterable or it's an array with the default iterator - use a simple case
  24096. if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
  24097. iterator = getIterator(O, iteratorMethod);
  24098. next = iterator.next;
  24099. result = IS_CONSTRUCTOR ? new this() : [];
  24100. for (;!(step = call(next, iterator)).done; index++) {
  24101. value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
  24102. createProperty(result, index, value);
  24103. }
  24104. } else {
  24105. length = lengthOfArrayLike(O);
  24106. result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
  24107. for (;length > index; index++) {
  24108. value = mapping ? mapfn(O[index], index) : O[index];
  24109. createProperty(result, index, value);
  24110. }
  24111. }
  24112. result.length = index;
  24113. return result;
  24114. };
  24115. },{"../internals/call-with-safe-iteration-closing":279,"../internals/create-property":295,"../internals/function-bind-context":323,"../internals/function-call":326,"../internals/get-iterator":331,"../internals/get-iterator-method":330,"../internals/is-array-iterator-method":345,"../internals/is-constructor":348,"../internals/length-of-array-like":363,"../internals/to-object":417}],268:[function(_dereq_,module,exports){
  24116. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  24117. var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
  24118. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  24119. // `Array.prototype.{ indexOf, includes }` methods implementation
  24120. var createMethod = function (IS_INCLUDES) {
  24121. return function ($this, el, fromIndex) {
  24122. var O = toIndexedObject($this);
  24123. var length = lengthOfArrayLike(O);
  24124. var index = toAbsoluteIndex(fromIndex, length);
  24125. var value;
  24126. // Array#includes uses SameValueZero equality algorithm
  24127. // eslint-disable-next-line no-self-compare -- NaN check
  24128. if (IS_INCLUDES && el != el) while (length > index) {
  24129. value = O[index++];
  24130. // eslint-disable-next-line no-self-compare -- NaN check
  24131. if (value != value) return true;
  24132. // Array#indexOf ignores holes, Array#includes - not
  24133. } else for (;length > index; index++) {
  24134. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  24135. } return !IS_INCLUDES && -1;
  24136. };
  24137. };
  24138. module.exports = {
  24139. // `Array.prototype.includes` method
  24140. // https://tc39.es/ecma262/#sec-array.prototype.includes
  24141. includes: createMethod(true),
  24142. // `Array.prototype.indexOf` method
  24143. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  24144. indexOf: createMethod(false)
  24145. };
  24146. },{"../internals/length-of-array-like":363,"../internals/to-absolute-index":413,"../internals/to-indexed-object":414}],269:[function(_dereq_,module,exports){
  24147. var bind = _dereq_('../internals/function-bind-context');
  24148. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  24149. var IndexedObject = _dereq_('../internals/indexed-object');
  24150. var toObject = _dereq_('../internals/to-object');
  24151. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  24152. var arraySpeciesCreate = _dereq_('../internals/array-species-create');
  24153. var push = uncurryThis([].push);
  24154. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
  24155. var createMethod = function (TYPE) {
  24156. var IS_MAP = TYPE == 1;
  24157. var IS_FILTER = TYPE == 2;
  24158. var IS_SOME = TYPE == 3;
  24159. var IS_EVERY = TYPE == 4;
  24160. var IS_FIND_INDEX = TYPE == 6;
  24161. var IS_FILTER_REJECT = TYPE == 7;
  24162. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  24163. return function ($this, callbackfn, that, specificCreate) {
  24164. var O = toObject($this);
  24165. var self = IndexedObject(O);
  24166. var boundFunction = bind(callbackfn, that);
  24167. var length = lengthOfArrayLike(self);
  24168. var index = 0;
  24169. var create = specificCreate || arraySpeciesCreate;
  24170. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
  24171. var value, result;
  24172. for (;length > index; index++) if (NO_HOLES || index in self) {
  24173. value = self[index];
  24174. result = boundFunction(value, index, O);
  24175. if (TYPE) {
  24176. if (IS_MAP) target[index] = result; // map
  24177. else if (result) switch (TYPE) {
  24178. case 3: return true; // some
  24179. case 5: return value; // find
  24180. case 6: return index; // findIndex
  24181. case 2: push(target, value); // filter
  24182. } else switch (TYPE) {
  24183. case 4: return false; // every
  24184. case 7: push(target, value); // filterReject
  24185. }
  24186. }
  24187. }
  24188. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  24189. };
  24190. };
  24191. module.exports = {
  24192. // `Array.prototype.forEach` method
  24193. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  24194. forEach: createMethod(0),
  24195. // `Array.prototype.map` method
  24196. // https://tc39.es/ecma262/#sec-array.prototype.map
  24197. map: createMethod(1),
  24198. // `Array.prototype.filter` method
  24199. // https://tc39.es/ecma262/#sec-array.prototype.filter
  24200. filter: createMethod(2),
  24201. // `Array.prototype.some` method
  24202. // https://tc39.es/ecma262/#sec-array.prototype.some
  24203. some: createMethod(3),
  24204. // `Array.prototype.every` method
  24205. // https://tc39.es/ecma262/#sec-array.prototype.every
  24206. every: createMethod(4),
  24207. // `Array.prototype.find` method
  24208. // https://tc39.es/ecma262/#sec-array.prototype.find
  24209. find: createMethod(5),
  24210. // `Array.prototype.findIndex` method
  24211. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  24212. findIndex: createMethod(6),
  24213. // `Array.prototype.filterReject` method
  24214. // https://github.com/tc39/proposal-array-filtering
  24215. filterReject: createMethod(7)
  24216. };
  24217. },{"../internals/array-species-create":278,"../internals/function-bind-context":323,"../internals/function-uncurry-this":328,"../internals/indexed-object":340,"../internals/length-of-array-like":363,"../internals/to-object":417}],270:[function(_dereq_,module,exports){
  24218. var fails = _dereq_('../internals/fails');
  24219. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  24220. var V8_VERSION = _dereq_('../internals/engine-v8-version');
  24221. var SPECIES = wellKnownSymbol('species');
  24222. module.exports = function (METHOD_NAME) {
  24223. // We can't use this feature detection in V8 since it causes
  24224. // deoptimization and serious performance degradation
  24225. // https://github.com/zloirock/core-js/issues/677
  24226. return V8_VERSION >= 51 || !fails(function () {
  24227. var array = [];
  24228. var constructor = array.constructor = {};
  24229. constructor[SPECIES] = function () {
  24230. return { foo: 1 };
  24231. };
  24232. return array[METHOD_NAME](Boolean).foo !== 1;
  24233. });
  24234. };
  24235. },{"../internals/engine-v8-version":313,"../internals/fails":320,"../internals/well-known-symbol":430}],271:[function(_dereq_,module,exports){
  24236. 'use strict';
  24237. var fails = _dereq_('../internals/fails');
  24238. module.exports = function (METHOD_NAME, argument) {
  24239. var method = [][METHOD_NAME];
  24240. return !!method && fails(function () {
  24241. // eslint-disable-next-line no-useless-call -- required for testing
  24242. method.call(null, argument || function () { return 1; }, 1);
  24243. });
  24244. };
  24245. },{"../internals/fails":320}],272:[function(_dereq_,module,exports){
  24246. var aCallable = _dereq_('../internals/a-callable');
  24247. var toObject = _dereq_('../internals/to-object');
  24248. var IndexedObject = _dereq_('../internals/indexed-object');
  24249. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  24250. var $TypeError = TypeError;
  24251. // `Array.prototype.{ reduce, reduceRight }` methods implementation
  24252. var createMethod = function (IS_RIGHT) {
  24253. return function (that, callbackfn, argumentsLength, memo) {
  24254. aCallable(callbackfn);
  24255. var O = toObject(that);
  24256. var self = IndexedObject(O);
  24257. var length = lengthOfArrayLike(O);
  24258. var index = IS_RIGHT ? length - 1 : 0;
  24259. var i = IS_RIGHT ? -1 : 1;
  24260. if (argumentsLength < 2) while (true) {
  24261. if (index in self) {
  24262. memo = self[index];
  24263. index += i;
  24264. break;
  24265. }
  24266. index += i;
  24267. if (IS_RIGHT ? index < 0 : length <= index) {
  24268. throw $TypeError('Reduce of empty array with no initial value');
  24269. }
  24270. }
  24271. for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
  24272. memo = callbackfn(memo, self[index], index, O);
  24273. }
  24274. return memo;
  24275. };
  24276. };
  24277. module.exports = {
  24278. // `Array.prototype.reduce` method
  24279. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  24280. left: createMethod(false),
  24281. // `Array.prototype.reduceRight` method
  24282. // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  24283. right: createMethod(true)
  24284. };
  24285. },{"../internals/a-callable":259,"../internals/indexed-object":340,"../internals/length-of-array-like":363,"../internals/to-object":417}],273:[function(_dereq_,module,exports){
  24286. 'use strict';
  24287. var DESCRIPTORS = _dereq_('../internals/descriptors');
  24288. var isArray = _dereq_('../internals/is-array');
  24289. var $TypeError = TypeError;
  24290. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  24291. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  24292. // Safari < 13 does not throw an error in this case
  24293. var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
  24294. // makes no sense without proper strict mode support
  24295. if (this !== undefined) return true;
  24296. try {
  24297. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  24298. Object.defineProperty([], 'length', { writable: false }).length = 1;
  24299. } catch (error) {
  24300. return error instanceof TypeError;
  24301. }
  24302. }();
  24303. module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
  24304. if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
  24305. throw $TypeError('Cannot set read only .length');
  24306. } return O.length = length;
  24307. } : function (O, length) {
  24308. return O.length = length;
  24309. };
  24310. },{"../internals/descriptors":300,"../internals/is-array":346}],274:[function(_dereq_,module,exports){
  24311. var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
  24312. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  24313. var createProperty = _dereq_('../internals/create-property');
  24314. var $Array = Array;
  24315. var max = Math.max;
  24316. module.exports = function (O, start, end) {
  24317. var length = lengthOfArrayLike(O);
  24318. var k = toAbsoluteIndex(start, length);
  24319. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  24320. var result = $Array(max(fin - k, 0));
  24321. for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
  24322. result.length = n;
  24323. return result;
  24324. };
  24325. },{"../internals/create-property":295,"../internals/length-of-array-like":363,"../internals/to-absolute-index":413}],275:[function(_dereq_,module,exports){
  24326. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  24327. module.exports = uncurryThis([].slice);
  24328. },{"../internals/function-uncurry-this":328}],276:[function(_dereq_,module,exports){
  24329. var arraySlice = _dereq_('../internals/array-slice-simple');
  24330. var floor = Math.floor;
  24331. var mergeSort = function (array, comparefn) {
  24332. var length = array.length;
  24333. var middle = floor(length / 2);
  24334. return length < 8 ? insertionSort(array, comparefn) : merge(
  24335. array,
  24336. mergeSort(arraySlice(array, 0, middle), comparefn),
  24337. mergeSort(arraySlice(array, middle), comparefn),
  24338. comparefn
  24339. );
  24340. };
  24341. var insertionSort = function (array, comparefn) {
  24342. var length = array.length;
  24343. var i = 1;
  24344. var element, j;
  24345. while (i < length) {
  24346. j = i;
  24347. element = array[i];
  24348. while (j && comparefn(array[j - 1], element) > 0) {
  24349. array[j] = array[--j];
  24350. }
  24351. if (j !== i++) array[j] = element;
  24352. } return array;
  24353. };
  24354. var merge = function (array, left, right, comparefn) {
  24355. var llength = left.length;
  24356. var rlength = right.length;
  24357. var lindex = 0;
  24358. var rindex = 0;
  24359. while (lindex < llength || rindex < rlength) {
  24360. array[lindex + rindex] = (lindex < llength && rindex < rlength)
  24361. ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
  24362. : lindex < llength ? left[lindex++] : right[rindex++];
  24363. } return array;
  24364. };
  24365. module.exports = mergeSort;
  24366. },{"../internals/array-slice-simple":274}],277:[function(_dereq_,module,exports){
  24367. var isArray = _dereq_('../internals/is-array');
  24368. var isConstructor = _dereq_('../internals/is-constructor');
  24369. var isObject = _dereq_('../internals/is-object');
  24370. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  24371. var SPECIES = wellKnownSymbol('species');
  24372. var $Array = Array;
  24373. // a part of `ArraySpeciesCreate` abstract operation
  24374. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  24375. module.exports = function (originalArray) {
  24376. var C;
  24377. if (isArray(originalArray)) {
  24378. C = originalArray.constructor;
  24379. // cross-realm fallback
  24380. if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
  24381. else if (isObject(C)) {
  24382. C = C[SPECIES];
  24383. if (C === null) C = undefined;
  24384. }
  24385. } return C === undefined ? $Array : C;
  24386. };
  24387. },{"../internals/is-array":346,"../internals/is-constructor":348,"../internals/is-object":353,"../internals/well-known-symbol":430}],278:[function(_dereq_,module,exports){
  24388. var arraySpeciesConstructor = _dereq_('../internals/array-species-constructor');
  24389. // `ArraySpeciesCreate` abstract operation
  24390. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  24391. module.exports = function (originalArray, length) {
  24392. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  24393. };
  24394. },{"../internals/array-species-constructor":277}],279:[function(_dereq_,module,exports){
  24395. var anObject = _dereq_('../internals/an-object');
  24396. var iteratorClose = _dereq_('../internals/iterator-close');
  24397. // call something on iterator step with safe closing on error
  24398. module.exports = function (iterator, fn, value, ENTRIES) {
  24399. try {
  24400. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  24401. } catch (error) {
  24402. iteratorClose(iterator, 'throw', error);
  24403. }
  24404. };
  24405. },{"../internals/an-object":264,"../internals/iterator-close":358}],280:[function(_dereq_,module,exports){
  24406. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  24407. var ITERATOR = wellKnownSymbol('iterator');
  24408. var SAFE_CLOSING = false;
  24409. try {
  24410. var called = 0;
  24411. var iteratorWithReturn = {
  24412. next: function () {
  24413. return { done: !!called++ };
  24414. },
  24415. 'return': function () {
  24416. SAFE_CLOSING = true;
  24417. }
  24418. };
  24419. iteratorWithReturn[ITERATOR] = function () {
  24420. return this;
  24421. };
  24422. // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
  24423. Array.from(iteratorWithReturn, function () { throw 2; });
  24424. } catch (error) { /* empty */ }
  24425. module.exports = function (exec, SKIP_CLOSING) {
  24426. if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  24427. var ITERATION_SUPPORT = false;
  24428. try {
  24429. var object = {};
  24430. object[ITERATOR] = function () {
  24431. return {
  24432. next: function () {
  24433. return { done: ITERATION_SUPPORT = true };
  24434. }
  24435. };
  24436. };
  24437. exec(object);
  24438. } catch (error) { /* empty */ }
  24439. return ITERATION_SUPPORT;
  24440. };
  24441. },{"../internals/well-known-symbol":430}],281:[function(_dereq_,module,exports){
  24442. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  24443. var toString = uncurryThis({}.toString);
  24444. var stringSlice = uncurryThis(''.slice);
  24445. module.exports = function (it) {
  24446. return stringSlice(toString(it), 8, -1);
  24447. };
  24448. },{"../internals/function-uncurry-this":328}],282:[function(_dereq_,module,exports){
  24449. var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
  24450. var isCallable = _dereq_('../internals/is-callable');
  24451. var classofRaw = _dereq_('../internals/classof-raw');
  24452. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  24453. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  24454. var $Object = Object;
  24455. // ES3 wrong here
  24456. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  24457. // fallback for IE11 Script Access Denied error
  24458. var tryGet = function (it, key) {
  24459. try {
  24460. return it[key];
  24461. } catch (error) { /* empty */ }
  24462. };
  24463. // getting tag from ES6+ `Object.prototype.toString`
  24464. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  24465. var O, tag, result;
  24466. return it === undefined ? 'Undefined' : it === null ? 'Null'
  24467. // @@toStringTag case
  24468. : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
  24469. // builtinTag case
  24470. : CORRECT_ARGUMENTS ? classofRaw(O)
  24471. // ES3 arguments fallback
  24472. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  24473. };
  24474. },{"../internals/classof-raw":281,"../internals/is-callable":347,"../internals/to-string-tag-support":420,"../internals/well-known-symbol":430}],283:[function(_dereq_,module,exports){
  24475. 'use strict';
  24476. var call = _dereq_('../internals/function-call');
  24477. var aCallable = _dereq_('../internals/a-callable');
  24478. var anObject = _dereq_('../internals/an-object');
  24479. // https://github.com/tc39/collection-methods
  24480. module.exports = function deleteAll(/* ...elements */) {
  24481. var collection = anObject(this);
  24482. var remover = aCallable(collection['delete']);
  24483. var allDeleted = true;
  24484. var wasDeleted;
  24485. for (var k = 0, len = arguments.length; k < len; k++) {
  24486. wasDeleted = call(remover, collection, arguments[k]);
  24487. allDeleted = allDeleted && wasDeleted;
  24488. }
  24489. return !!allDeleted;
  24490. };
  24491. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/function-call":326}],284:[function(_dereq_,module,exports){
  24492. 'use strict';
  24493. // https://tc39.github.io/proposal-setmap-offrom/
  24494. var bind = _dereq_('../internals/function-bind-context');
  24495. var call = _dereq_('../internals/function-call');
  24496. var aCallable = _dereq_('../internals/a-callable');
  24497. var aConstructor = _dereq_('../internals/a-constructor');
  24498. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  24499. var iterate = _dereq_('../internals/iterate');
  24500. var push = [].push;
  24501. module.exports = function from(source /* , mapFn, thisArg */) {
  24502. var length = arguments.length;
  24503. var mapFn = length > 1 ? arguments[1] : undefined;
  24504. var mapping, array, n, boundFunction;
  24505. aConstructor(this);
  24506. mapping = mapFn !== undefined;
  24507. if (mapping) aCallable(mapFn);
  24508. if (isNullOrUndefined(source)) return new this();
  24509. array = [];
  24510. if (mapping) {
  24511. n = 0;
  24512. boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined);
  24513. iterate(source, function (nextItem) {
  24514. call(push, array, boundFunction(nextItem, n++));
  24515. });
  24516. } else {
  24517. iterate(source, push, { that: array });
  24518. }
  24519. return new this(array);
  24520. };
  24521. },{"../internals/a-callable":259,"../internals/a-constructor":260,"../internals/function-bind-context":323,"../internals/function-call":326,"../internals/is-null-or-undefined":352,"../internals/iterate":357}],285:[function(_dereq_,module,exports){
  24522. 'use strict';
  24523. var arraySlice = _dereq_('../internals/array-slice');
  24524. // https://tc39.github.io/proposal-setmap-offrom/
  24525. module.exports = function of() {
  24526. return new this(arraySlice(arguments));
  24527. };
  24528. },{"../internals/array-slice":275}],286:[function(_dereq_,module,exports){
  24529. 'use strict';
  24530. var defineProperty = _dereq_('../internals/object-define-property').f;
  24531. var create = _dereq_('../internals/object-create');
  24532. var defineBuiltIns = _dereq_('../internals/define-built-ins');
  24533. var bind = _dereq_('../internals/function-bind-context');
  24534. var anInstance = _dereq_('../internals/an-instance');
  24535. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  24536. var iterate = _dereq_('../internals/iterate');
  24537. var defineIterator = _dereq_('../internals/iterator-define');
  24538. var createIterResultObject = _dereq_('../internals/create-iter-result-object');
  24539. var setSpecies = _dereq_('../internals/set-species');
  24540. var DESCRIPTORS = _dereq_('../internals/descriptors');
  24541. var fastKey = _dereq_('../internals/internal-metadata').fastKey;
  24542. var InternalStateModule = _dereq_('../internals/internal-state');
  24543. var setInternalState = InternalStateModule.set;
  24544. var internalStateGetterFor = InternalStateModule.getterFor;
  24545. module.exports = {
  24546. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  24547. var Constructor = wrapper(function (that, iterable) {
  24548. anInstance(that, Prototype);
  24549. setInternalState(that, {
  24550. type: CONSTRUCTOR_NAME,
  24551. index: create(null),
  24552. first: undefined,
  24553. last: undefined,
  24554. size: 0
  24555. });
  24556. if (!DESCRIPTORS) that.size = 0;
  24557. if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
  24558. });
  24559. var Prototype = Constructor.prototype;
  24560. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  24561. var define = function (that, key, value) {
  24562. var state = getInternalState(that);
  24563. var entry = getEntry(that, key);
  24564. var previous, index;
  24565. // change existing entry
  24566. if (entry) {
  24567. entry.value = value;
  24568. // create new entry
  24569. } else {
  24570. state.last = entry = {
  24571. index: index = fastKey(key, true),
  24572. key: key,
  24573. value: value,
  24574. previous: previous = state.last,
  24575. next: undefined,
  24576. removed: false
  24577. };
  24578. if (!state.first) state.first = entry;
  24579. if (previous) previous.next = entry;
  24580. if (DESCRIPTORS) state.size++;
  24581. else that.size++;
  24582. // add to index
  24583. if (index !== 'F') state.index[index] = entry;
  24584. } return that;
  24585. };
  24586. var getEntry = function (that, key) {
  24587. var state = getInternalState(that);
  24588. // fast case
  24589. var index = fastKey(key);
  24590. var entry;
  24591. if (index !== 'F') return state.index[index];
  24592. // frozen object case
  24593. for (entry = state.first; entry; entry = entry.next) {
  24594. if (entry.key == key) return entry;
  24595. }
  24596. };
  24597. defineBuiltIns(Prototype, {
  24598. // `{ Map, Set }.prototype.clear()` methods
  24599. // https://tc39.es/ecma262/#sec-map.prototype.clear
  24600. // https://tc39.es/ecma262/#sec-set.prototype.clear
  24601. clear: function clear() {
  24602. var that = this;
  24603. var state = getInternalState(that);
  24604. var data = state.index;
  24605. var entry = state.first;
  24606. while (entry) {
  24607. entry.removed = true;
  24608. if (entry.previous) entry.previous = entry.previous.next = undefined;
  24609. delete data[entry.index];
  24610. entry = entry.next;
  24611. }
  24612. state.first = state.last = undefined;
  24613. if (DESCRIPTORS) state.size = 0;
  24614. else that.size = 0;
  24615. },
  24616. // `{ Map, Set }.prototype.delete(key)` methods
  24617. // https://tc39.es/ecma262/#sec-map.prototype.delete
  24618. // https://tc39.es/ecma262/#sec-set.prototype.delete
  24619. 'delete': function (key) {
  24620. var that = this;
  24621. var state = getInternalState(that);
  24622. var entry = getEntry(that, key);
  24623. if (entry) {
  24624. var next = entry.next;
  24625. var prev = entry.previous;
  24626. delete state.index[entry.index];
  24627. entry.removed = true;
  24628. if (prev) prev.next = next;
  24629. if (next) next.previous = prev;
  24630. if (state.first == entry) state.first = next;
  24631. if (state.last == entry) state.last = prev;
  24632. if (DESCRIPTORS) state.size--;
  24633. else that.size--;
  24634. } return !!entry;
  24635. },
  24636. // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
  24637. // https://tc39.es/ecma262/#sec-map.prototype.foreach
  24638. // https://tc39.es/ecma262/#sec-set.prototype.foreach
  24639. forEach: function forEach(callbackfn /* , that = undefined */) {
  24640. var state = getInternalState(this);
  24641. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  24642. var entry;
  24643. while (entry = entry ? entry.next : state.first) {
  24644. boundFunction(entry.value, entry.key, this);
  24645. // revert to the last existing entry
  24646. while (entry && entry.removed) entry = entry.previous;
  24647. }
  24648. },
  24649. // `{ Map, Set}.prototype.has(key)` methods
  24650. // https://tc39.es/ecma262/#sec-map.prototype.has
  24651. // https://tc39.es/ecma262/#sec-set.prototype.has
  24652. has: function has(key) {
  24653. return !!getEntry(this, key);
  24654. }
  24655. });
  24656. defineBuiltIns(Prototype, IS_MAP ? {
  24657. // `Map.prototype.get(key)` method
  24658. // https://tc39.es/ecma262/#sec-map.prototype.get
  24659. get: function get(key) {
  24660. var entry = getEntry(this, key);
  24661. return entry && entry.value;
  24662. },
  24663. // `Map.prototype.set(key, value)` method
  24664. // https://tc39.es/ecma262/#sec-map.prototype.set
  24665. set: function set(key, value) {
  24666. return define(this, key === 0 ? 0 : key, value);
  24667. }
  24668. } : {
  24669. // `Set.prototype.add(value)` method
  24670. // https://tc39.es/ecma262/#sec-set.prototype.add
  24671. add: function add(value) {
  24672. return define(this, value = value === 0 ? 0 : value, value);
  24673. }
  24674. });
  24675. if (DESCRIPTORS) defineProperty(Prototype, 'size', {
  24676. get: function () {
  24677. return getInternalState(this).size;
  24678. }
  24679. });
  24680. return Constructor;
  24681. },
  24682. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  24683. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  24684. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  24685. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  24686. // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
  24687. // https://tc39.es/ecma262/#sec-map.prototype.entries
  24688. // https://tc39.es/ecma262/#sec-map.prototype.keys
  24689. // https://tc39.es/ecma262/#sec-map.prototype.values
  24690. // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
  24691. // https://tc39.es/ecma262/#sec-set.prototype.entries
  24692. // https://tc39.es/ecma262/#sec-set.prototype.keys
  24693. // https://tc39.es/ecma262/#sec-set.prototype.values
  24694. // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
  24695. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  24696. setInternalState(this, {
  24697. type: ITERATOR_NAME,
  24698. target: iterated,
  24699. state: getInternalCollectionState(iterated),
  24700. kind: kind,
  24701. last: undefined
  24702. });
  24703. }, function () {
  24704. var state = getInternalIteratorState(this);
  24705. var kind = state.kind;
  24706. var entry = state.last;
  24707. // revert to the last existing entry
  24708. while (entry && entry.removed) entry = entry.previous;
  24709. // get next entry
  24710. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  24711. // or finish the iteration
  24712. state.target = undefined;
  24713. return createIterResultObject(undefined, true);
  24714. }
  24715. // return step by kind
  24716. if (kind == 'keys') return createIterResultObject(entry.key, false);
  24717. if (kind == 'values') return createIterResultObject(entry.value, false);
  24718. return createIterResultObject([entry.key, entry.value], false);
  24719. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  24720. // `{ Map, Set }.prototype[@@species]` accessors
  24721. // https://tc39.es/ecma262/#sec-get-map-@@species
  24722. // https://tc39.es/ecma262/#sec-get-set-@@species
  24723. setSpecies(CONSTRUCTOR_NAME);
  24724. }
  24725. };
  24726. },{"../internals/an-instance":263,"../internals/create-iter-result-object":292,"../internals/define-built-ins":297,"../internals/descriptors":300,"../internals/function-bind-context":323,"../internals/internal-metadata":343,"../internals/internal-state":344,"../internals/is-null-or-undefined":352,"../internals/iterate":357,"../internals/iterator-define":360,"../internals/object-create":373,"../internals/object-define-property":375,"../internals/set-species":401}],287:[function(_dereq_,module,exports){
  24727. 'use strict';
  24728. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  24729. var defineBuiltIns = _dereq_('../internals/define-built-ins');
  24730. var getWeakData = _dereq_('../internals/internal-metadata').getWeakData;
  24731. var anInstance = _dereq_('../internals/an-instance');
  24732. var anObject = _dereq_('../internals/an-object');
  24733. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  24734. var isObject = _dereq_('../internals/is-object');
  24735. var iterate = _dereq_('../internals/iterate');
  24736. var ArrayIterationModule = _dereq_('../internals/array-iteration');
  24737. var hasOwn = _dereq_('../internals/has-own-property');
  24738. var InternalStateModule = _dereq_('../internals/internal-state');
  24739. var setInternalState = InternalStateModule.set;
  24740. var internalStateGetterFor = InternalStateModule.getterFor;
  24741. var find = ArrayIterationModule.find;
  24742. var findIndex = ArrayIterationModule.findIndex;
  24743. var splice = uncurryThis([].splice);
  24744. var id = 0;
  24745. // fallback for uncaught frozen keys
  24746. var uncaughtFrozenStore = function (store) {
  24747. return store.frozen || (store.frozen = new UncaughtFrozenStore());
  24748. };
  24749. var UncaughtFrozenStore = function () {
  24750. this.entries = [];
  24751. };
  24752. var findUncaughtFrozen = function (store, key) {
  24753. return find(store.entries, function (it) {
  24754. return it[0] === key;
  24755. });
  24756. };
  24757. UncaughtFrozenStore.prototype = {
  24758. get: function (key) {
  24759. var entry = findUncaughtFrozen(this, key);
  24760. if (entry) return entry[1];
  24761. },
  24762. has: function (key) {
  24763. return !!findUncaughtFrozen(this, key);
  24764. },
  24765. set: function (key, value) {
  24766. var entry = findUncaughtFrozen(this, key);
  24767. if (entry) entry[1] = value;
  24768. else this.entries.push([key, value]);
  24769. },
  24770. 'delete': function (key) {
  24771. var index = findIndex(this.entries, function (it) {
  24772. return it[0] === key;
  24773. });
  24774. if (~index) splice(this.entries, index, 1);
  24775. return !!~index;
  24776. }
  24777. };
  24778. module.exports = {
  24779. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  24780. var Constructor = wrapper(function (that, iterable) {
  24781. anInstance(that, Prototype);
  24782. setInternalState(that, {
  24783. type: CONSTRUCTOR_NAME,
  24784. id: id++,
  24785. frozen: undefined
  24786. });
  24787. if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
  24788. });
  24789. var Prototype = Constructor.prototype;
  24790. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  24791. var define = function (that, key, value) {
  24792. var state = getInternalState(that);
  24793. var data = getWeakData(anObject(key), true);
  24794. if (data === true) uncaughtFrozenStore(state).set(key, value);
  24795. else data[state.id] = value;
  24796. return that;
  24797. };
  24798. defineBuiltIns(Prototype, {
  24799. // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
  24800. // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
  24801. // https://tc39.es/ecma262/#sec-weakset.prototype.delete
  24802. 'delete': function (key) {
  24803. var state = getInternalState(this);
  24804. if (!isObject(key)) return false;
  24805. var data = getWeakData(key);
  24806. if (data === true) return uncaughtFrozenStore(state)['delete'](key);
  24807. return data && hasOwn(data, state.id) && delete data[state.id];
  24808. },
  24809. // `{ WeakMap, WeakSet }.prototype.has(key)` methods
  24810. // https://tc39.es/ecma262/#sec-weakmap.prototype.has
  24811. // https://tc39.es/ecma262/#sec-weakset.prototype.has
  24812. has: function has(key) {
  24813. var state = getInternalState(this);
  24814. if (!isObject(key)) return false;
  24815. var data = getWeakData(key);
  24816. if (data === true) return uncaughtFrozenStore(state).has(key);
  24817. return data && hasOwn(data, state.id);
  24818. }
  24819. });
  24820. defineBuiltIns(Prototype, IS_MAP ? {
  24821. // `WeakMap.prototype.get(key)` method
  24822. // https://tc39.es/ecma262/#sec-weakmap.prototype.get
  24823. get: function get(key) {
  24824. var state = getInternalState(this);
  24825. if (isObject(key)) {
  24826. var data = getWeakData(key);
  24827. if (data === true) return uncaughtFrozenStore(state).get(key);
  24828. return data ? data[state.id] : undefined;
  24829. }
  24830. },
  24831. // `WeakMap.prototype.set(key, value)` method
  24832. // https://tc39.es/ecma262/#sec-weakmap.prototype.set
  24833. set: function set(key, value) {
  24834. return define(this, key, value);
  24835. }
  24836. } : {
  24837. // `WeakSet.prototype.add(value)` method
  24838. // https://tc39.es/ecma262/#sec-weakset.prototype.add
  24839. add: function add(value) {
  24840. return define(this, value, true);
  24841. }
  24842. });
  24843. return Constructor;
  24844. }
  24845. };
  24846. },{"../internals/an-instance":263,"../internals/an-object":264,"../internals/array-iteration":269,"../internals/define-built-ins":297,"../internals/function-uncurry-this":328,"../internals/has-own-property":335,"../internals/internal-metadata":343,"../internals/internal-state":344,"../internals/is-null-or-undefined":352,"../internals/is-object":353,"../internals/iterate":357}],288:[function(_dereq_,module,exports){
  24847. 'use strict';
  24848. var $ = _dereq_('../internals/export');
  24849. var global = _dereq_('../internals/global');
  24850. var InternalMetadataModule = _dereq_('../internals/internal-metadata');
  24851. var fails = _dereq_('../internals/fails');
  24852. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  24853. var iterate = _dereq_('../internals/iterate');
  24854. var anInstance = _dereq_('../internals/an-instance');
  24855. var isCallable = _dereq_('../internals/is-callable');
  24856. var isObject = _dereq_('../internals/is-object');
  24857. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  24858. var defineProperty = _dereq_('../internals/object-define-property').f;
  24859. var forEach = _dereq_('../internals/array-iteration').forEach;
  24860. var DESCRIPTORS = _dereq_('../internals/descriptors');
  24861. var InternalStateModule = _dereq_('../internals/internal-state');
  24862. var setInternalState = InternalStateModule.set;
  24863. var internalStateGetterFor = InternalStateModule.getterFor;
  24864. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  24865. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  24866. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  24867. var ADDER = IS_MAP ? 'set' : 'add';
  24868. var NativeConstructor = global[CONSTRUCTOR_NAME];
  24869. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  24870. var exported = {};
  24871. var Constructor;
  24872. if (!DESCRIPTORS || !isCallable(NativeConstructor)
  24873. || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
  24874. ) {
  24875. // create collection constructor
  24876. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  24877. InternalMetadataModule.enable();
  24878. } else {
  24879. Constructor = wrapper(function (target, iterable) {
  24880. setInternalState(anInstance(target, Prototype), {
  24881. type: CONSTRUCTOR_NAME,
  24882. collection: new NativeConstructor()
  24883. });
  24884. if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
  24885. });
  24886. var Prototype = Constructor.prototype;
  24887. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  24888. forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
  24889. var IS_ADDER = KEY == 'add' || KEY == 'set';
  24890. if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
  24891. createNonEnumerableProperty(Prototype, KEY, function (a, b) {
  24892. var collection = getInternalState(this).collection;
  24893. if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
  24894. var result = collection[KEY](a === 0 ? 0 : a, b);
  24895. return IS_ADDER ? this : result;
  24896. });
  24897. }
  24898. });
  24899. IS_WEAK || defineProperty(Prototype, 'size', {
  24900. configurable: true,
  24901. get: function () {
  24902. return getInternalState(this).collection.size;
  24903. }
  24904. });
  24905. }
  24906. setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
  24907. exported[CONSTRUCTOR_NAME] = Constructor;
  24908. $({ global: true, forced: true }, exported);
  24909. if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  24910. return Constructor;
  24911. };
  24912. },{"../internals/an-instance":263,"../internals/array-iteration":269,"../internals/create-non-enumerable-property":293,"../internals/descriptors":300,"../internals/export":319,"../internals/fails":320,"../internals/global":334,"../internals/internal-metadata":343,"../internals/internal-state":344,"../internals/is-callable":347,"../internals/is-object":353,"../internals/iterate":357,"../internals/object-define-property":375,"../internals/set-to-string-tag":402}],289:[function(_dereq_,module,exports){
  24913. var hasOwn = _dereq_('../internals/has-own-property');
  24914. var ownKeys = _dereq_('../internals/own-keys');
  24915. var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
  24916. var definePropertyModule = _dereq_('../internals/object-define-property');
  24917. module.exports = function (target, source, exceptions) {
  24918. var keys = ownKeys(source);
  24919. var defineProperty = definePropertyModule.f;
  24920. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  24921. for (var i = 0; i < keys.length; i++) {
  24922. var key = keys[i];
  24923. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  24924. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  24925. }
  24926. }
  24927. };
  24928. },{"../internals/has-own-property":335,"../internals/object-define-property":375,"../internals/object-get-own-property-descriptor":376,"../internals/own-keys":390}],290:[function(_dereq_,module,exports){
  24929. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  24930. var MATCH = wellKnownSymbol('match');
  24931. module.exports = function (METHOD_NAME) {
  24932. var regexp = /./;
  24933. try {
  24934. '/./'[METHOD_NAME](regexp);
  24935. } catch (error1) {
  24936. try {
  24937. regexp[MATCH] = false;
  24938. return '/./'[METHOD_NAME](regexp);
  24939. } catch (error2) { /* empty */ }
  24940. } return false;
  24941. };
  24942. },{"../internals/well-known-symbol":430}],291:[function(_dereq_,module,exports){
  24943. var fails = _dereq_('../internals/fails');
  24944. module.exports = !fails(function () {
  24945. function F() { /* empty */ }
  24946. F.prototype.constructor = null;
  24947. // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
  24948. return Object.getPrototypeOf(new F()) !== F.prototype;
  24949. });
  24950. },{"../internals/fails":320}],292:[function(_dereq_,module,exports){
  24951. // `CreateIterResultObject` abstract operation
  24952. // https://tc39.es/ecma262/#sec-createiterresultobject
  24953. module.exports = function (value, done) {
  24954. return { value: value, done: done };
  24955. };
  24956. },{}],293:[function(_dereq_,module,exports){
  24957. var DESCRIPTORS = _dereq_('../internals/descriptors');
  24958. var definePropertyModule = _dereq_('../internals/object-define-property');
  24959. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  24960. module.exports = DESCRIPTORS ? function (object, key, value) {
  24961. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  24962. } : function (object, key, value) {
  24963. object[key] = value;
  24964. return object;
  24965. };
  24966. },{"../internals/create-property-descriptor":294,"../internals/descriptors":300,"../internals/object-define-property":375}],294:[function(_dereq_,module,exports){
  24967. module.exports = function (bitmap, value) {
  24968. return {
  24969. enumerable: !(bitmap & 1),
  24970. configurable: !(bitmap & 2),
  24971. writable: !(bitmap & 4),
  24972. value: value
  24973. };
  24974. };
  24975. },{}],295:[function(_dereq_,module,exports){
  24976. 'use strict';
  24977. var toPropertyKey = _dereq_('../internals/to-property-key');
  24978. var definePropertyModule = _dereq_('../internals/object-define-property');
  24979. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  24980. module.exports = function (object, key, value) {
  24981. var propertyKey = toPropertyKey(key);
  24982. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  24983. else object[propertyKey] = value;
  24984. };
  24985. },{"../internals/create-property-descriptor":294,"../internals/object-define-property":375,"../internals/to-property-key":419}],296:[function(_dereq_,module,exports){
  24986. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  24987. module.exports = function (target, key, value, options) {
  24988. if (options && options.enumerable) target[key] = value;
  24989. else createNonEnumerableProperty(target, key, value);
  24990. return target;
  24991. };
  24992. },{"../internals/create-non-enumerable-property":293}],297:[function(_dereq_,module,exports){
  24993. var defineBuiltIn = _dereq_('../internals/define-built-in');
  24994. module.exports = function (target, src, options) {
  24995. for (var key in src) {
  24996. if (options && options.unsafe && target[key]) target[key] = src[key];
  24997. else defineBuiltIn(target, key, src[key], options);
  24998. } return target;
  24999. };
  25000. },{"../internals/define-built-in":296}],298:[function(_dereq_,module,exports){
  25001. var global = _dereq_('../internals/global');
  25002. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  25003. var defineProperty = Object.defineProperty;
  25004. module.exports = function (key, value) {
  25005. try {
  25006. defineProperty(global, key, { value: value, configurable: true, writable: true });
  25007. } catch (error) {
  25008. global[key] = value;
  25009. } return value;
  25010. };
  25011. },{"../internals/global":334}],299:[function(_dereq_,module,exports){
  25012. 'use strict';
  25013. var tryToString = _dereq_('../internals/try-to-string');
  25014. var $TypeError = TypeError;
  25015. module.exports = function (O, P) {
  25016. if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
  25017. };
  25018. },{"../internals/try-to-string":422}],300:[function(_dereq_,module,exports){
  25019. var fails = _dereq_('../internals/fails');
  25020. // Detect IE8's incomplete defineProperty implementation
  25021. module.exports = !fails(function () {
  25022. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  25023. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  25024. });
  25025. },{"../internals/fails":320}],301:[function(_dereq_,module,exports){
  25026. var global = _dereq_('../internals/global');
  25027. var isObject = _dereq_('../internals/is-object');
  25028. var document = global.document;
  25029. // typeof document.createElement is 'object' in old IE
  25030. var EXISTS = isObject(document) && isObject(document.createElement);
  25031. module.exports = function (it) {
  25032. return EXISTS ? document.createElement(it) : {};
  25033. };
  25034. },{"../internals/global":334,"../internals/is-object":353}],302:[function(_dereq_,module,exports){
  25035. var $TypeError = TypeError;
  25036. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
  25037. module.exports = function (it) {
  25038. if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
  25039. return it;
  25040. };
  25041. },{}],303:[function(_dereq_,module,exports){
  25042. // iterable DOM collections
  25043. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  25044. module.exports = {
  25045. CSSRuleList: 0,
  25046. CSSStyleDeclaration: 0,
  25047. CSSValueList: 0,
  25048. ClientRectList: 0,
  25049. DOMRectList: 0,
  25050. DOMStringList: 0,
  25051. DOMTokenList: 1,
  25052. DataTransferItemList: 0,
  25053. FileList: 0,
  25054. HTMLAllCollection: 0,
  25055. HTMLCollection: 0,
  25056. HTMLFormElement: 0,
  25057. HTMLSelectElement: 0,
  25058. MediaList: 0,
  25059. MimeTypeArray: 0,
  25060. NamedNodeMap: 0,
  25061. NodeList: 1,
  25062. PaintRequestList: 0,
  25063. Plugin: 0,
  25064. PluginArray: 0,
  25065. SVGLengthList: 0,
  25066. SVGNumberList: 0,
  25067. SVGPathSegList: 0,
  25068. SVGPointList: 0,
  25069. SVGStringList: 0,
  25070. SVGTransformList: 0,
  25071. SourceBufferList: 0,
  25072. StyleSheetList: 0,
  25073. TextTrackCueList: 0,
  25074. TextTrackList: 0,
  25075. TouchList: 0
  25076. };
  25077. },{}],304:[function(_dereq_,module,exports){
  25078. var userAgent = _dereq_('../internals/engine-user-agent');
  25079. var firefox = userAgent.match(/firefox\/(\d+)/i);
  25080. module.exports = !!firefox && +firefox[1];
  25081. },{"../internals/engine-user-agent":312}],305:[function(_dereq_,module,exports){
  25082. var IS_DENO = _dereq_('../internals/engine-is-deno');
  25083. var IS_NODE = _dereq_('../internals/engine-is-node');
  25084. module.exports = !IS_DENO && !IS_NODE
  25085. && typeof window == 'object'
  25086. && typeof document == 'object';
  25087. },{"../internals/engine-is-deno":306,"../internals/engine-is-node":310}],306:[function(_dereq_,module,exports){
  25088. /* global Deno -- Deno case */
  25089. module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
  25090. },{}],307:[function(_dereq_,module,exports){
  25091. var UA = _dereq_('../internals/engine-user-agent');
  25092. module.exports = /MSIE|Trident/.test(UA);
  25093. },{"../internals/engine-user-agent":312}],308:[function(_dereq_,module,exports){
  25094. var userAgent = _dereq_('../internals/engine-user-agent');
  25095. var global = _dereq_('../internals/global');
  25096. module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
  25097. },{"../internals/engine-user-agent":312,"../internals/global":334}],309:[function(_dereq_,module,exports){
  25098. var userAgent = _dereq_('../internals/engine-user-agent');
  25099. module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
  25100. },{"../internals/engine-user-agent":312}],310:[function(_dereq_,module,exports){
  25101. var classof = _dereq_('../internals/classof-raw');
  25102. var global = _dereq_('../internals/global');
  25103. module.exports = classof(global.process) == 'process';
  25104. },{"../internals/classof-raw":281,"../internals/global":334}],311:[function(_dereq_,module,exports){
  25105. var userAgent = _dereq_('../internals/engine-user-agent');
  25106. module.exports = /web0s(?!.*chrome)/i.test(userAgent);
  25107. },{"../internals/engine-user-agent":312}],312:[function(_dereq_,module,exports){
  25108. var getBuiltIn = _dereq_('../internals/get-built-in');
  25109. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  25110. },{"../internals/get-built-in":329}],313:[function(_dereq_,module,exports){
  25111. var global = _dereq_('../internals/global');
  25112. var userAgent = _dereq_('../internals/engine-user-agent');
  25113. var process = global.process;
  25114. var Deno = global.Deno;
  25115. var versions = process && process.versions || Deno && Deno.version;
  25116. var v8 = versions && versions.v8;
  25117. var match, version;
  25118. if (v8) {
  25119. match = v8.split('.');
  25120. // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  25121. // but their correct versions are not interesting for us
  25122. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  25123. }
  25124. // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
  25125. // so check `userAgent` even if `.v8` exists, but 0
  25126. if (!version && userAgent) {
  25127. match = userAgent.match(/Edge\/(\d+)/);
  25128. if (!match || match[1] >= 74) {
  25129. match = userAgent.match(/Chrome\/(\d+)/);
  25130. if (match) version = +match[1];
  25131. }
  25132. }
  25133. module.exports = version;
  25134. },{"../internals/engine-user-agent":312,"../internals/global":334}],314:[function(_dereq_,module,exports){
  25135. var userAgent = _dereq_('../internals/engine-user-agent');
  25136. var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
  25137. module.exports = !!webkit && +webkit[1];
  25138. },{"../internals/engine-user-agent":312}],315:[function(_dereq_,module,exports){
  25139. var path = _dereq_('../internals/path');
  25140. module.exports = function (CONSTRUCTOR) {
  25141. return path[CONSTRUCTOR + 'Prototype'];
  25142. };
  25143. },{"../internals/path":391}],316:[function(_dereq_,module,exports){
  25144. // IE8- don't enum bug keys
  25145. module.exports = [
  25146. 'constructor',
  25147. 'hasOwnProperty',
  25148. 'isPrototypeOf',
  25149. 'propertyIsEnumerable',
  25150. 'toLocaleString',
  25151. 'toString',
  25152. 'valueOf'
  25153. ];
  25154. },{}],317:[function(_dereq_,module,exports){
  25155. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25156. var $Error = Error;
  25157. var replace = uncurryThis(''.replace);
  25158. var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
  25159. var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
  25160. var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
  25161. module.exports = function (stack, dropEntries) {
  25162. if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
  25163. while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
  25164. } return stack;
  25165. };
  25166. },{"../internals/function-uncurry-this":328}],318:[function(_dereq_,module,exports){
  25167. var fails = _dereq_('../internals/fails');
  25168. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  25169. module.exports = !fails(function () {
  25170. var error = Error('a');
  25171. if (!('stack' in error)) return true;
  25172. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  25173. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  25174. return error.stack !== 7;
  25175. });
  25176. },{"../internals/create-property-descriptor":294,"../internals/fails":320}],319:[function(_dereq_,module,exports){
  25177. 'use strict';
  25178. var global = _dereq_('../internals/global');
  25179. var apply = _dereq_('../internals/function-apply');
  25180. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25181. var isCallable = _dereq_('../internals/is-callable');
  25182. var getOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
  25183. var isForced = _dereq_('../internals/is-forced');
  25184. var path = _dereq_('../internals/path');
  25185. var bind = _dereq_('../internals/function-bind-context');
  25186. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  25187. var hasOwn = _dereq_('../internals/has-own-property');
  25188. var wrapConstructor = function (NativeConstructor) {
  25189. var Wrapper = function (a, b, c) {
  25190. if (this instanceof Wrapper) {
  25191. switch (arguments.length) {
  25192. case 0: return new NativeConstructor();
  25193. case 1: return new NativeConstructor(a);
  25194. case 2: return new NativeConstructor(a, b);
  25195. } return new NativeConstructor(a, b, c);
  25196. } return apply(NativeConstructor, this, arguments);
  25197. };
  25198. Wrapper.prototype = NativeConstructor.prototype;
  25199. return Wrapper;
  25200. };
  25201. /*
  25202. options.target - name of the target object
  25203. options.global - target is the global object
  25204. options.stat - export as static methods of target
  25205. options.proto - export as prototype methods of target
  25206. options.real - real prototype method for the `pure` version
  25207. options.forced - export even if the native feature is available
  25208. options.bind - bind methods to the target, required for the `pure` version
  25209. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  25210. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  25211. options.sham - add a flag to not completely full polyfills
  25212. options.enumerable - export as enumerable property
  25213. options.dontCallGetSet - prevent calling a getter on target
  25214. options.name - the .name of the function if it does not match the key
  25215. */
  25216. module.exports = function (options, source) {
  25217. var TARGET = options.target;
  25218. var GLOBAL = options.global;
  25219. var STATIC = options.stat;
  25220. var PROTO = options.proto;
  25221. var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
  25222. var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
  25223. var targetPrototype = target.prototype;
  25224. var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
  25225. var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
  25226. for (key in source) {
  25227. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  25228. // contains in native
  25229. USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
  25230. targetProperty = target[key];
  25231. if (USE_NATIVE) if (options.dontCallGetSet) {
  25232. descriptor = getOwnPropertyDescriptor(nativeSource, key);
  25233. nativeProperty = descriptor && descriptor.value;
  25234. } else nativeProperty = nativeSource[key];
  25235. // export native or implementation
  25236. sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
  25237. if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
  25238. // bind timers to global for call from export context
  25239. if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
  25240. // wrap global constructors for prevent changs in this version
  25241. else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
  25242. // make static versions for prototype methods
  25243. else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
  25244. // default case
  25245. else resultProperty = sourceProperty;
  25246. // add a flag to not completely full polyfills
  25247. if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
  25248. createNonEnumerableProperty(resultProperty, 'sham', true);
  25249. }
  25250. createNonEnumerableProperty(target, key, resultProperty);
  25251. if (PROTO) {
  25252. VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
  25253. if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
  25254. createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
  25255. }
  25256. // export virtual prototype methods
  25257. createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
  25258. // export real prototype methods
  25259. if (options.real && targetPrototype && !targetPrototype[key]) {
  25260. createNonEnumerableProperty(targetPrototype, key, sourceProperty);
  25261. }
  25262. }
  25263. }
  25264. };
  25265. },{"../internals/create-non-enumerable-property":293,"../internals/function-apply":322,"../internals/function-bind-context":323,"../internals/function-uncurry-this":328,"../internals/global":334,"../internals/has-own-property":335,"../internals/is-callable":347,"../internals/is-forced":350,"../internals/object-get-own-property-descriptor":376,"../internals/path":391}],320:[function(_dereq_,module,exports){
  25266. module.exports = function (exec) {
  25267. try {
  25268. return !!exec();
  25269. } catch (error) {
  25270. return true;
  25271. }
  25272. };
  25273. },{}],321:[function(_dereq_,module,exports){
  25274. var fails = _dereq_('../internals/fails');
  25275. module.exports = !fails(function () {
  25276. // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
  25277. return Object.isExtensible(Object.preventExtensions({}));
  25278. });
  25279. },{"../internals/fails":320}],322:[function(_dereq_,module,exports){
  25280. var NATIVE_BIND = _dereq_('../internals/function-bind-native');
  25281. var FunctionPrototype = Function.prototype;
  25282. var apply = FunctionPrototype.apply;
  25283. var call = FunctionPrototype.call;
  25284. // eslint-disable-next-line es-x/no-reflect -- safe
  25285. module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
  25286. return call.apply(apply, arguments);
  25287. });
  25288. },{"../internals/function-bind-native":324}],323:[function(_dereq_,module,exports){
  25289. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25290. var aCallable = _dereq_('../internals/a-callable');
  25291. var NATIVE_BIND = _dereq_('../internals/function-bind-native');
  25292. var bind = uncurryThis(uncurryThis.bind);
  25293. // optional / simple context binding
  25294. module.exports = function (fn, that) {
  25295. aCallable(fn);
  25296. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
  25297. return fn.apply(that, arguments);
  25298. };
  25299. };
  25300. },{"../internals/a-callable":259,"../internals/function-bind-native":324,"../internals/function-uncurry-this":328}],324:[function(_dereq_,module,exports){
  25301. var fails = _dereq_('../internals/fails');
  25302. module.exports = !fails(function () {
  25303. // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
  25304. var test = (function () { /* empty */ }).bind();
  25305. // eslint-disable-next-line no-prototype-builtins -- safe
  25306. return typeof test != 'function' || test.hasOwnProperty('prototype');
  25307. });
  25308. },{"../internals/fails":320}],325:[function(_dereq_,module,exports){
  25309. 'use strict';
  25310. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25311. var aCallable = _dereq_('../internals/a-callable');
  25312. var isObject = _dereq_('../internals/is-object');
  25313. var hasOwn = _dereq_('../internals/has-own-property');
  25314. var arraySlice = _dereq_('../internals/array-slice');
  25315. var NATIVE_BIND = _dereq_('../internals/function-bind-native');
  25316. var $Function = Function;
  25317. var concat = uncurryThis([].concat);
  25318. var join = uncurryThis([].join);
  25319. var factories = {};
  25320. var construct = function (C, argsLength, args) {
  25321. if (!hasOwn(factories, argsLength)) {
  25322. for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
  25323. factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
  25324. } return factories[argsLength](C, args);
  25325. };
  25326. // `Function.prototype.bind` method implementation
  25327. // https://tc39.es/ecma262/#sec-function.prototype.bind
  25328. module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
  25329. var F = aCallable(this);
  25330. var Prototype = F.prototype;
  25331. var partArgs = arraySlice(arguments, 1);
  25332. var boundFunction = function bound(/* args... */) {
  25333. var args = concat(partArgs, arraySlice(arguments));
  25334. return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
  25335. };
  25336. if (isObject(Prototype)) boundFunction.prototype = Prototype;
  25337. return boundFunction;
  25338. };
  25339. },{"../internals/a-callable":259,"../internals/array-slice":275,"../internals/function-bind-native":324,"../internals/function-uncurry-this":328,"../internals/has-own-property":335,"../internals/is-object":353}],326:[function(_dereq_,module,exports){
  25340. var NATIVE_BIND = _dereq_('../internals/function-bind-native');
  25341. var call = Function.prototype.call;
  25342. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  25343. return call.apply(call, arguments);
  25344. };
  25345. },{"../internals/function-bind-native":324}],327:[function(_dereq_,module,exports){
  25346. var DESCRIPTORS = _dereq_('../internals/descriptors');
  25347. var hasOwn = _dereq_('../internals/has-own-property');
  25348. var FunctionPrototype = Function.prototype;
  25349. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  25350. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  25351. var EXISTS = hasOwn(FunctionPrototype, 'name');
  25352. // additional protection from minified / mangled / dropped function names
  25353. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  25354. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
  25355. module.exports = {
  25356. EXISTS: EXISTS,
  25357. PROPER: PROPER,
  25358. CONFIGURABLE: CONFIGURABLE
  25359. };
  25360. },{"../internals/descriptors":300,"../internals/has-own-property":335}],328:[function(_dereq_,module,exports){
  25361. var NATIVE_BIND = _dereq_('../internals/function-bind-native');
  25362. var FunctionPrototype = Function.prototype;
  25363. var bind = FunctionPrototype.bind;
  25364. var call = FunctionPrototype.call;
  25365. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  25366. module.exports = NATIVE_BIND ? function (fn) {
  25367. return fn && uncurryThis(fn);
  25368. } : function (fn) {
  25369. return fn && function () {
  25370. return call.apply(fn, arguments);
  25371. };
  25372. };
  25373. },{"../internals/function-bind-native":324}],329:[function(_dereq_,module,exports){
  25374. var path = _dereq_('../internals/path');
  25375. var global = _dereq_('../internals/global');
  25376. var isCallable = _dereq_('../internals/is-callable');
  25377. var aFunction = function (variable) {
  25378. return isCallable(variable) ? variable : undefined;
  25379. };
  25380. module.exports = function (namespace, method) {
  25381. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
  25382. : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  25383. };
  25384. },{"../internals/global":334,"../internals/is-callable":347,"../internals/path":391}],330:[function(_dereq_,module,exports){
  25385. var classof = _dereq_('../internals/classof');
  25386. var getMethod = _dereq_('../internals/get-method');
  25387. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  25388. var Iterators = _dereq_('../internals/iterators');
  25389. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  25390. var ITERATOR = wellKnownSymbol('iterator');
  25391. module.exports = function (it) {
  25392. if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
  25393. || getMethod(it, '@@iterator')
  25394. || Iterators[classof(it)];
  25395. };
  25396. },{"../internals/classof":282,"../internals/get-method":333,"../internals/is-null-or-undefined":352,"../internals/iterators":362,"../internals/well-known-symbol":430}],331:[function(_dereq_,module,exports){
  25397. var call = _dereq_('../internals/function-call');
  25398. var aCallable = _dereq_('../internals/a-callable');
  25399. var anObject = _dereq_('../internals/an-object');
  25400. var tryToString = _dereq_('../internals/try-to-string');
  25401. var getIteratorMethod = _dereq_('../internals/get-iterator-method');
  25402. var $TypeError = TypeError;
  25403. module.exports = function (argument, usingIterator) {
  25404. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  25405. if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
  25406. throw $TypeError(tryToString(argument) + ' is not iterable');
  25407. };
  25408. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/function-call":326,"../internals/get-iterator-method":330,"../internals/try-to-string":422}],332:[function(_dereq_,module,exports){
  25409. var getIterator = _dereq_('../internals/get-iterator');
  25410. module.exports = getIterator;
  25411. },{"../internals/get-iterator":331}],333:[function(_dereq_,module,exports){
  25412. var aCallable = _dereq_('../internals/a-callable');
  25413. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  25414. // `GetMethod` abstract operation
  25415. // https://tc39.es/ecma262/#sec-getmethod
  25416. module.exports = function (V, P) {
  25417. var func = V[P];
  25418. return isNullOrUndefined(func) ? undefined : aCallable(func);
  25419. };
  25420. },{"../internals/a-callable":259,"../internals/is-null-or-undefined":352}],334:[function(_dereq_,module,exports){
  25421. (function (global){(function (){
  25422. var check = function (it) {
  25423. return it && it.Math == Math && it;
  25424. };
  25425. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  25426. module.exports =
  25427. // eslint-disable-next-line es-x/no-global-this -- safe
  25428. check(typeof globalThis == 'object' && globalThis) ||
  25429. check(typeof window == 'object' && window) ||
  25430. // eslint-disable-next-line no-restricted-globals -- safe
  25431. check(typeof self == 'object' && self) ||
  25432. check(typeof global == 'object' && global) ||
  25433. // eslint-disable-next-line no-new-func -- fallback
  25434. (function () { return this; })() || Function('return this')();
  25435. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  25436. },{}],335:[function(_dereq_,module,exports){
  25437. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25438. var toObject = _dereq_('../internals/to-object');
  25439. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  25440. // `HasOwnProperty` abstract operation
  25441. // https://tc39.es/ecma262/#sec-hasownproperty
  25442. // eslint-disable-next-line es-x/no-object-hasown -- safe
  25443. module.exports = Object.hasOwn || function hasOwn(it, key) {
  25444. return hasOwnProperty(toObject(it), key);
  25445. };
  25446. },{"../internals/function-uncurry-this":328,"../internals/to-object":417}],336:[function(_dereq_,module,exports){
  25447. module.exports = {};
  25448. },{}],337:[function(_dereq_,module,exports){
  25449. var global = _dereq_('../internals/global');
  25450. module.exports = function (a, b) {
  25451. var console = global.console;
  25452. if (console && console.error) {
  25453. arguments.length == 1 ? console.error(a) : console.error(a, b);
  25454. }
  25455. };
  25456. },{"../internals/global":334}],338:[function(_dereq_,module,exports){
  25457. var getBuiltIn = _dereq_('../internals/get-built-in');
  25458. module.exports = getBuiltIn('document', 'documentElement');
  25459. },{"../internals/get-built-in":329}],339:[function(_dereq_,module,exports){
  25460. var DESCRIPTORS = _dereq_('../internals/descriptors');
  25461. var fails = _dereq_('../internals/fails');
  25462. var createElement = _dereq_('../internals/document-create-element');
  25463. // Thanks to IE8 for its funny defineProperty
  25464. module.exports = !DESCRIPTORS && !fails(function () {
  25465. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  25466. return Object.defineProperty(createElement('div'), 'a', {
  25467. get: function () { return 7; }
  25468. }).a != 7;
  25469. });
  25470. },{"../internals/descriptors":300,"../internals/document-create-element":301,"../internals/fails":320}],340:[function(_dereq_,module,exports){
  25471. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25472. var fails = _dereq_('../internals/fails');
  25473. var classof = _dereq_('../internals/classof-raw');
  25474. var $Object = Object;
  25475. var split = uncurryThis(''.split);
  25476. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  25477. module.exports = fails(function () {
  25478. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  25479. // eslint-disable-next-line no-prototype-builtins -- safe
  25480. return !$Object('z').propertyIsEnumerable(0);
  25481. }) ? function (it) {
  25482. return classof(it) == 'String' ? split(it, '') : $Object(it);
  25483. } : $Object;
  25484. },{"../internals/classof-raw":281,"../internals/fails":320,"../internals/function-uncurry-this":328}],341:[function(_dereq_,module,exports){
  25485. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25486. var isCallable = _dereq_('../internals/is-callable');
  25487. var store = _dereq_('../internals/shared-store');
  25488. var functionToString = uncurryThis(Function.toString);
  25489. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  25490. if (!isCallable(store.inspectSource)) {
  25491. store.inspectSource = function (it) {
  25492. return functionToString(it);
  25493. };
  25494. }
  25495. module.exports = store.inspectSource;
  25496. },{"../internals/function-uncurry-this":328,"../internals/is-callable":347,"../internals/shared-store":404}],342:[function(_dereq_,module,exports){
  25497. var isObject = _dereq_('../internals/is-object');
  25498. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  25499. // `InstallErrorCause` abstract operation
  25500. // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
  25501. module.exports = function (O, options) {
  25502. if (isObject(options) && 'cause' in options) {
  25503. createNonEnumerableProperty(O, 'cause', options.cause);
  25504. }
  25505. };
  25506. },{"../internals/create-non-enumerable-property":293,"../internals/is-object":353}],343:[function(_dereq_,module,exports){
  25507. var $ = _dereq_('../internals/export');
  25508. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25509. var hiddenKeys = _dereq_('../internals/hidden-keys');
  25510. var isObject = _dereq_('../internals/is-object');
  25511. var hasOwn = _dereq_('../internals/has-own-property');
  25512. var defineProperty = _dereq_('../internals/object-define-property').f;
  25513. var getOwnPropertyNamesModule = _dereq_('../internals/object-get-own-property-names');
  25514. var getOwnPropertyNamesExternalModule = _dereq_('../internals/object-get-own-property-names-external');
  25515. var isExtensible = _dereq_('../internals/object-is-extensible');
  25516. var uid = _dereq_('../internals/uid');
  25517. var FREEZING = _dereq_('../internals/freezing');
  25518. var REQUIRED = false;
  25519. var METADATA = uid('meta');
  25520. var id = 0;
  25521. var setMetadata = function (it) {
  25522. defineProperty(it, METADATA, { value: {
  25523. objectID: 'O' + id++, // object ID
  25524. weakData: {} // weak collections IDs
  25525. } });
  25526. };
  25527. var fastKey = function (it, create) {
  25528. // return a primitive with prefix
  25529. if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  25530. if (!hasOwn(it, METADATA)) {
  25531. // can't set metadata to uncaught frozen object
  25532. if (!isExtensible(it)) return 'F';
  25533. // not necessary to add metadata
  25534. if (!create) return 'E';
  25535. // add missing metadata
  25536. setMetadata(it);
  25537. // return object ID
  25538. } return it[METADATA].objectID;
  25539. };
  25540. var getWeakData = function (it, create) {
  25541. if (!hasOwn(it, METADATA)) {
  25542. // can't set metadata to uncaught frozen object
  25543. if (!isExtensible(it)) return true;
  25544. // not necessary to add metadata
  25545. if (!create) return false;
  25546. // add missing metadata
  25547. setMetadata(it);
  25548. // return the store of weak collections IDs
  25549. } return it[METADATA].weakData;
  25550. };
  25551. // add metadata on freeze-family methods calling
  25552. var onFreeze = function (it) {
  25553. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
  25554. return it;
  25555. };
  25556. var enable = function () {
  25557. meta.enable = function () { /* empty */ };
  25558. REQUIRED = true;
  25559. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  25560. var splice = uncurryThis([].splice);
  25561. var test = {};
  25562. test[METADATA] = 1;
  25563. // prevent exposing of metadata key
  25564. if (getOwnPropertyNames(test).length) {
  25565. getOwnPropertyNamesModule.f = function (it) {
  25566. var result = getOwnPropertyNames(it);
  25567. for (var i = 0, length = result.length; i < length; i++) {
  25568. if (result[i] === METADATA) {
  25569. splice(result, i, 1);
  25570. break;
  25571. }
  25572. } return result;
  25573. };
  25574. $({ target: 'Object', stat: true, forced: true }, {
  25575. getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
  25576. });
  25577. }
  25578. };
  25579. var meta = module.exports = {
  25580. enable: enable,
  25581. fastKey: fastKey,
  25582. getWeakData: getWeakData,
  25583. onFreeze: onFreeze
  25584. };
  25585. hiddenKeys[METADATA] = true;
  25586. },{"../internals/export":319,"../internals/freezing":321,"../internals/function-uncurry-this":328,"../internals/has-own-property":335,"../internals/hidden-keys":336,"../internals/is-object":353,"../internals/object-define-property":375,"../internals/object-get-own-property-names":378,"../internals/object-get-own-property-names-external":377,"../internals/object-is-extensible":381,"../internals/uid":423}],344:[function(_dereq_,module,exports){
  25587. var NATIVE_WEAK_MAP = _dereq_('../internals/weak-map-basic-detection');
  25588. var global = _dereq_('../internals/global');
  25589. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25590. var isObject = _dereq_('../internals/is-object');
  25591. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  25592. var hasOwn = _dereq_('../internals/has-own-property');
  25593. var shared = _dereq_('../internals/shared-store');
  25594. var sharedKey = _dereq_('../internals/shared-key');
  25595. var hiddenKeys = _dereq_('../internals/hidden-keys');
  25596. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  25597. var TypeError = global.TypeError;
  25598. var WeakMap = global.WeakMap;
  25599. var set, get, has;
  25600. var enforce = function (it) {
  25601. return has(it) ? get(it) : set(it, {});
  25602. };
  25603. var getterFor = function (TYPE) {
  25604. return function (it) {
  25605. var state;
  25606. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  25607. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  25608. } return state;
  25609. };
  25610. };
  25611. if (NATIVE_WEAK_MAP || shared.state) {
  25612. var store = shared.state || (shared.state = new WeakMap());
  25613. var wmget = uncurryThis(store.get);
  25614. var wmhas = uncurryThis(store.has);
  25615. var wmset = uncurryThis(store.set);
  25616. set = function (it, metadata) {
  25617. if (wmhas(store, it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
  25618. metadata.facade = it;
  25619. wmset(store, it, metadata);
  25620. return metadata;
  25621. };
  25622. get = function (it) {
  25623. return wmget(store, it) || {};
  25624. };
  25625. has = function (it) {
  25626. return wmhas(store, it);
  25627. };
  25628. } else {
  25629. var STATE = sharedKey('state');
  25630. hiddenKeys[STATE] = true;
  25631. set = function (it, metadata) {
  25632. if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
  25633. metadata.facade = it;
  25634. createNonEnumerableProperty(it, STATE, metadata);
  25635. return metadata;
  25636. };
  25637. get = function (it) {
  25638. return hasOwn(it, STATE) ? it[STATE] : {};
  25639. };
  25640. has = function (it) {
  25641. return hasOwn(it, STATE);
  25642. };
  25643. }
  25644. module.exports = {
  25645. set: set,
  25646. get: get,
  25647. has: has,
  25648. enforce: enforce,
  25649. getterFor: getterFor
  25650. };
  25651. },{"../internals/create-non-enumerable-property":293,"../internals/function-uncurry-this":328,"../internals/global":334,"../internals/has-own-property":335,"../internals/hidden-keys":336,"../internals/is-object":353,"../internals/shared-key":403,"../internals/shared-store":404,"../internals/weak-map-basic-detection":427}],345:[function(_dereq_,module,exports){
  25652. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  25653. var Iterators = _dereq_('../internals/iterators');
  25654. var ITERATOR = wellKnownSymbol('iterator');
  25655. var ArrayPrototype = Array.prototype;
  25656. // check on default Array iterator
  25657. module.exports = function (it) {
  25658. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  25659. };
  25660. },{"../internals/iterators":362,"../internals/well-known-symbol":430}],346:[function(_dereq_,module,exports){
  25661. var classof = _dereq_('../internals/classof-raw');
  25662. // `IsArray` abstract operation
  25663. // https://tc39.es/ecma262/#sec-isarray
  25664. // eslint-disable-next-line es-x/no-array-isarray -- safe
  25665. module.exports = Array.isArray || function isArray(argument) {
  25666. return classof(argument) == 'Array';
  25667. };
  25668. },{"../internals/classof-raw":281}],347:[function(_dereq_,module,exports){
  25669. // `IsCallable` abstract operation
  25670. // https://tc39.es/ecma262/#sec-iscallable
  25671. module.exports = function (argument) {
  25672. return typeof argument == 'function';
  25673. };
  25674. },{}],348:[function(_dereq_,module,exports){
  25675. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  25676. var fails = _dereq_('../internals/fails');
  25677. var isCallable = _dereq_('../internals/is-callable');
  25678. var classof = _dereq_('../internals/classof');
  25679. var getBuiltIn = _dereq_('../internals/get-built-in');
  25680. var inspectSource = _dereq_('../internals/inspect-source');
  25681. var noop = function () { /* empty */ };
  25682. var empty = [];
  25683. var construct = getBuiltIn('Reflect', 'construct');
  25684. var constructorRegExp = /^\s*(?:class|function)\b/;
  25685. var exec = uncurryThis(constructorRegExp.exec);
  25686. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  25687. var isConstructorModern = function isConstructor(argument) {
  25688. if (!isCallable(argument)) return false;
  25689. try {
  25690. construct(noop, empty, argument);
  25691. return true;
  25692. } catch (error) {
  25693. return false;
  25694. }
  25695. };
  25696. var isConstructorLegacy = function isConstructor(argument) {
  25697. if (!isCallable(argument)) return false;
  25698. switch (classof(argument)) {
  25699. case 'AsyncFunction':
  25700. case 'GeneratorFunction':
  25701. case 'AsyncGeneratorFunction': return false;
  25702. }
  25703. try {
  25704. // we can't check .prototype since constructors produced by .bind haven't it
  25705. // `Function#toString` throws on some built-it function in some legacy engines
  25706. // (for example, `DOMQuad` and similar in FF41-)
  25707. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  25708. } catch (error) {
  25709. return true;
  25710. }
  25711. };
  25712. isConstructorLegacy.sham = true;
  25713. // `IsConstructor` abstract operation
  25714. // https://tc39.es/ecma262/#sec-isconstructor
  25715. module.exports = !construct || fails(function () {
  25716. var called;
  25717. return isConstructorModern(isConstructorModern.call)
  25718. || !isConstructorModern(Object)
  25719. || !isConstructorModern(function () { called = true; })
  25720. || called;
  25721. }) ? isConstructorLegacy : isConstructorModern;
  25722. },{"../internals/classof":282,"../internals/fails":320,"../internals/function-uncurry-this":328,"../internals/get-built-in":329,"../internals/inspect-source":341,"../internals/is-callable":347}],349:[function(_dereq_,module,exports){
  25723. var hasOwn = _dereq_('../internals/has-own-property');
  25724. module.exports = function (descriptor) {
  25725. return descriptor !== undefined && (hasOwn(descriptor, 'value') || hasOwn(descriptor, 'writable'));
  25726. };
  25727. },{"../internals/has-own-property":335}],350:[function(_dereq_,module,exports){
  25728. var fails = _dereq_('../internals/fails');
  25729. var isCallable = _dereq_('../internals/is-callable');
  25730. var replacement = /#|\.prototype\./;
  25731. var isForced = function (feature, detection) {
  25732. var value = data[normalize(feature)];
  25733. return value == POLYFILL ? true
  25734. : value == NATIVE ? false
  25735. : isCallable(detection) ? fails(detection)
  25736. : !!detection;
  25737. };
  25738. var normalize = isForced.normalize = function (string) {
  25739. return String(string).replace(replacement, '.').toLowerCase();
  25740. };
  25741. var data = isForced.data = {};
  25742. var NATIVE = isForced.NATIVE = 'N';
  25743. var POLYFILL = isForced.POLYFILL = 'P';
  25744. module.exports = isForced;
  25745. },{"../internals/fails":320,"../internals/is-callable":347}],351:[function(_dereq_,module,exports){
  25746. var isObject = _dereq_('../internals/is-object');
  25747. var floor = Math.floor;
  25748. // `IsIntegralNumber` abstract operation
  25749. // https://tc39.es/ecma262/#sec-isintegralnumber
  25750. // eslint-disable-next-line es-x/no-number-isinteger -- safe
  25751. module.exports = Number.isInteger || function isInteger(it) {
  25752. return !isObject(it) && isFinite(it) && floor(it) === it;
  25753. };
  25754. },{"../internals/is-object":353}],352:[function(_dereq_,module,exports){
  25755. // we can't use just `it == null` since of `document.all` special case
  25756. // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
  25757. module.exports = function (it) {
  25758. return it === null || it === undefined;
  25759. };
  25760. },{}],353:[function(_dereq_,module,exports){
  25761. var isCallable = _dereq_('../internals/is-callable');
  25762. var documentAll = typeof document == 'object' && document.all;
  25763. // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
  25764. var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
  25765. module.exports = SPECIAL_DOCUMENT_ALL ? function (it) {
  25766. return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
  25767. } : function (it) {
  25768. return typeof it == 'object' ? it !== null : isCallable(it);
  25769. };
  25770. },{"../internals/is-callable":347}],354:[function(_dereq_,module,exports){
  25771. module.exports = true;
  25772. },{}],355:[function(_dereq_,module,exports){
  25773. var isObject = _dereq_('../internals/is-object');
  25774. var classof = _dereq_('../internals/classof-raw');
  25775. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  25776. var MATCH = wellKnownSymbol('match');
  25777. // `IsRegExp` abstract operation
  25778. // https://tc39.es/ecma262/#sec-isregexp
  25779. module.exports = function (it) {
  25780. var isRegExp;
  25781. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
  25782. };
  25783. },{"../internals/classof-raw":281,"../internals/is-object":353,"../internals/well-known-symbol":430}],356:[function(_dereq_,module,exports){
  25784. var getBuiltIn = _dereq_('../internals/get-built-in');
  25785. var isCallable = _dereq_('../internals/is-callable');
  25786. var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
  25787. var USE_SYMBOL_AS_UID = _dereq_('../internals/use-symbol-as-uid');
  25788. var $Object = Object;
  25789. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  25790. return typeof it == 'symbol';
  25791. } : function (it) {
  25792. var $Symbol = getBuiltIn('Symbol');
  25793. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  25794. };
  25795. },{"../internals/get-built-in":329,"../internals/is-callable":347,"../internals/object-is-prototype-of":382,"../internals/use-symbol-as-uid":424}],357:[function(_dereq_,module,exports){
  25796. var bind = _dereq_('../internals/function-bind-context');
  25797. var call = _dereq_('../internals/function-call');
  25798. var anObject = _dereq_('../internals/an-object');
  25799. var tryToString = _dereq_('../internals/try-to-string');
  25800. var isArrayIteratorMethod = _dereq_('../internals/is-array-iterator-method');
  25801. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  25802. var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
  25803. var getIterator = _dereq_('../internals/get-iterator');
  25804. var getIteratorMethod = _dereq_('../internals/get-iterator-method');
  25805. var iteratorClose = _dereq_('../internals/iterator-close');
  25806. var $TypeError = TypeError;
  25807. var Result = function (stopped, result) {
  25808. this.stopped = stopped;
  25809. this.result = result;
  25810. };
  25811. var ResultPrototype = Result.prototype;
  25812. module.exports = function (iterable, unboundFunction, options) {
  25813. var that = options && options.that;
  25814. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  25815. var IS_RECORD = !!(options && options.IS_RECORD);
  25816. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  25817. var INTERRUPTED = !!(options && options.INTERRUPTED);
  25818. var fn = bind(unboundFunction, that);
  25819. var iterator, iterFn, index, length, result, next, step;
  25820. var stop = function (condition) {
  25821. if (iterator) iteratorClose(iterator, 'normal', condition);
  25822. return new Result(true, condition);
  25823. };
  25824. var callFn = function (value) {
  25825. if (AS_ENTRIES) {
  25826. anObject(value);
  25827. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  25828. } return INTERRUPTED ? fn(value, stop) : fn(value);
  25829. };
  25830. if (IS_RECORD) {
  25831. iterator = iterable.iterator;
  25832. } else if (IS_ITERATOR) {
  25833. iterator = iterable;
  25834. } else {
  25835. iterFn = getIteratorMethod(iterable);
  25836. if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
  25837. // optimisation for array iterators
  25838. if (isArrayIteratorMethod(iterFn)) {
  25839. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  25840. result = callFn(iterable[index]);
  25841. if (result && isPrototypeOf(ResultPrototype, result)) return result;
  25842. } return new Result(false);
  25843. }
  25844. iterator = getIterator(iterable, iterFn);
  25845. }
  25846. next = IS_RECORD ? iterable.next : iterator.next;
  25847. while (!(step = call(next, iterator)).done) {
  25848. try {
  25849. result = callFn(step.value);
  25850. } catch (error) {
  25851. iteratorClose(iterator, 'throw', error);
  25852. }
  25853. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
  25854. } return new Result(false);
  25855. };
  25856. },{"../internals/an-object":264,"../internals/function-bind-context":323,"../internals/function-call":326,"../internals/get-iterator":331,"../internals/get-iterator-method":330,"../internals/is-array-iterator-method":345,"../internals/iterator-close":358,"../internals/length-of-array-like":363,"../internals/object-is-prototype-of":382,"../internals/try-to-string":422}],358:[function(_dereq_,module,exports){
  25857. var call = _dereq_('../internals/function-call');
  25858. var anObject = _dereq_('../internals/an-object');
  25859. var getMethod = _dereq_('../internals/get-method');
  25860. module.exports = function (iterator, kind, value) {
  25861. var innerResult, innerError;
  25862. anObject(iterator);
  25863. try {
  25864. innerResult = getMethod(iterator, 'return');
  25865. if (!innerResult) {
  25866. if (kind === 'throw') throw value;
  25867. return value;
  25868. }
  25869. innerResult = call(innerResult, iterator);
  25870. } catch (error) {
  25871. innerError = true;
  25872. innerResult = error;
  25873. }
  25874. if (kind === 'throw') throw value;
  25875. if (innerError) throw innerResult;
  25876. anObject(innerResult);
  25877. return value;
  25878. };
  25879. },{"../internals/an-object":264,"../internals/function-call":326,"../internals/get-method":333}],359:[function(_dereq_,module,exports){
  25880. 'use strict';
  25881. var IteratorPrototype = _dereq_('../internals/iterators-core').IteratorPrototype;
  25882. var create = _dereq_('../internals/object-create');
  25883. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  25884. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  25885. var Iterators = _dereq_('../internals/iterators');
  25886. var returnThis = function () { return this; };
  25887. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  25888. var TO_STRING_TAG = NAME + ' Iterator';
  25889. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  25890. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  25891. Iterators[TO_STRING_TAG] = returnThis;
  25892. return IteratorConstructor;
  25893. };
  25894. },{"../internals/create-property-descriptor":294,"../internals/iterators":362,"../internals/iterators-core":361,"../internals/object-create":373,"../internals/set-to-string-tag":402}],360:[function(_dereq_,module,exports){
  25895. 'use strict';
  25896. var $ = _dereq_('../internals/export');
  25897. var call = _dereq_('../internals/function-call');
  25898. var IS_PURE = _dereq_('../internals/is-pure');
  25899. var FunctionName = _dereq_('../internals/function-name');
  25900. var isCallable = _dereq_('../internals/is-callable');
  25901. var createIteratorConstructor = _dereq_('../internals/iterator-create-constructor');
  25902. var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
  25903. var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
  25904. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  25905. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  25906. var defineBuiltIn = _dereq_('../internals/define-built-in');
  25907. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  25908. var Iterators = _dereq_('../internals/iterators');
  25909. var IteratorsCore = _dereq_('../internals/iterators-core');
  25910. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  25911. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  25912. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  25913. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  25914. var ITERATOR = wellKnownSymbol('iterator');
  25915. var KEYS = 'keys';
  25916. var VALUES = 'values';
  25917. var ENTRIES = 'entries';
  25918. var returnThis = function () { return this; };
  25919. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  25920. createIteratorConstructor(IteratorConstructor, NAME, next);
  25921. var getIterationMethod = function (KIND) {
  25922. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  25923. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  25924. switch (KIND) {
  25925. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  25926. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  25927. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  25928. } return function () { return new IteratorConstructor(this); };
  25929. };
  25930. var TO_STRING_TAG = NAME + ' Iterator';
  25931. var INCORRECT_VALUES_NAME = false;
  25932. var IterablePrototype = Iterable.prototype;
  25933. var nativeIterator = IterablePrototype[ITERATOR]
  25934. || IterablePrototype['@@iterator']
  25935. || DEFAULT && IterablePrototype[DEFAULT];
  25936. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  25937. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  25938. var CurrentIteratorPrototype, methods, KEY;
  25939. // fix native
  25940. if (anyNativeIterator) {
  25941. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  25942. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  25943. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  25944. if (setPrototypeOf) {
  25945. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  25946. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  25947. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  25948. }
  25949. }
  25950. // Set @@toStringTag to native iterators
  25951. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  25952. if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
  25953. }
  25954. }
  25955. // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  25956. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  25957. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  25958. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  25959. } else {
  25960. INCORRECT_VALUES_NAME = true;
  25961. defaultIterator = function values() { return call(nativeIterator, this); };
  25962. }
  25963. }
  25964. // export additional methods
  25965. if (DEFAULT) {
  25966. methods = {
  25967. values: getIterationMethod(VALUES),
  25968. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  25969. entries: getIterationMethod(ENTRIES)
  25970. };
  25971. if (FORCED) for (KEY in methods) {
  25972. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  25973. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  25974. }
  25975. } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  25976. }
  25977. // define iterator
  25978. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  25979. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  25980. }
  25981. Iterators[NAME] = defaultIterator;
  25982. return methods;
  25983. };
  25984. },{"../internals/create-non-enumerable-property":293,"../internals/define-built-in":296,"../internals/export":319,"../internals/function-call":326,"../internals/function-name":327,"../internals/is-callable":347,"../internals/is-pure":354,"../internals/iterator-create-constructor":359,"../internals/iterators":362,"../internals/iterators-core":361,"../internals/object-get-prototype-of":380,"../internals/object-set-prototype-of":386,"../internals/set-to-string-tag":402,"../internals/well-known-symbol":430}],361:[function(_dereq_,module,exports){
  25985. 'use strict';
  25986. var fails = _dereq_('../internals/fails');
  25987. var isCallable = _dereq_('../internals/is-callable');
  25988. var isObject = _dereq_('../internals/is-object');
  25989. var create = _dereq_('../internals/object-create');
  25990. var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
  25991. var defineBuiltIn = _dereq_('../internals/define-built-in');
  25992. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  25993. var IS_PURE = _dereq_('../internals/is-pure');
  25994. var ITERATOR = wellKnownSymbol('iterator');
  25995. var BUGGY_SAFARI_ITERATORS = false;
  25996. // `%IteratorPrototype%` object
  25997. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  25998. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  25999. /* eslint-disable es-x/no-array-prototype-keys -- safe */
  26000. if ([].keys) {
  26001. arrayIterator = [].keys();
  26002. // Safari 8 has buggy iterators w/o `next`
  26003. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  26004. else {
  26005. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  26006. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  26007. }
  26008. }
  26009. var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
  26010. var test = {};
  26011. // FF44- legacy iterators case
  26012. return IteratorPrototype[ITERATOR].call(test) !== test;
  26013. });
  26014. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
  26015. else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
  26016. // `%IteratorPrototype%[@@iterator]()` method
  26017. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  26018. if (!isCallable(IteratorPrototype[ITERATOR])) {
  26019. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  26020. return this;
  26021. });
  26022. }
  26023. module.exports = {
  26024. IteratorPrototype: IteratorPrototype,
  26025. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  26026. };
  26027. },{"../internals/define-built-in":296,"../internals/fails":320,"../internals/is-callable":347,"../internals/is-object":353,"../internals/is-pure":354,"../internals/object-create":373,"../internals/object-get-prototype-of":380,"../internals/well-known-symbol":430}],362:[function(_dereq_,module,exports){
  26028. arguments[4][336][0].apply(exports,arguments)
  26029. },{"dup":336}],363:[function(_dereq_,module,exports){
  26030. var toLength = _dereq_('../internals/to-length');
  26031. // `LengthOfArrayLike` abstract operation
  26032. // https://tc39.es/ecma262/#sec-lengthofarraylike
  26033. module.exports = function (obj) {
  26034. return toLength(obj.length);
  26035. };
  26036. },{"../internals/to-length":416}],364:[function(_dereq_,module,exports){
  26037. 'use strict';
  26038. var call = _dereq_('../internals/function-call');
  26039. var aCallable = _dereq_('../internals/a-callable');
  26040. var anObject = _dereq_('../internals/an-object');
  26041. // `Map.prototype.emplace` method
  26042. // https://github.com/thumbsupep/proposal-upsert
  26043. module.exports = function emplace(key, handler) {
  26044. var map = anObject(this);
  26045. var get = aCallable(map.get);
  26046. var has = aCallable(map.has);
  26047. var set = aCallable(map.set);
  26048. var value, inserted;
  26049. if (call(has, map, key)) {
  26050. value = call(get, map, key);
  26051. if ('update' in handler) {
  26052. value = handler.update(value, key, map);
  26053. call(set, map, key, value);
  26054. } return value;
  26055. }
  26056. inserted = handler.insert(key, map);
  26057. call(set, map, key, inserted);
  26058. return inserted;
  26059. };
  26060. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/function-call":326}],365:[function(_dereq_,module,exports){
  26061. 'use strict';
  26062. var call = _dereq_('../internals/function-call');
  26063. var aCallable = _dereq_('../internals/a-callable');
  26064. var isCallable = _dereq_('../internals/is-callable');
  26065. var anObject = _dereq_('../internals/an-object');
  26066. var $TypeError = TypeError;
  26067. // `Map.prototype.upsert` method
  26068. // https://github.com/thumbsupep/proposal-upsert
  26069. module.exports = function upsert(key, updateFn /* , insertFn */) {
  26070. var map = anObject(this);
  26071. var get = aCallable(map.get);
  26072. var has = aCallable(map.has);
  26073. var set = aCallable(map.set);
  26074. var insertFn = arguments.length > 2 ? arguments[2] : undefined;
  26075. var value;
  26076. if (!isCallable(updateFn) && !isCallable(insertFn)) {
  26077. throw $TypeError('At least one callback required');
  26078. }
  26079. if (call(has, map, key)) {
  26080. value = call(get, map, key);
  26081. if (isCallable(updateFn)) {
  26082. value = updateFn(value);
  26083. call(set, map, key, value);
  26084. }
  26085. } else if (isCallable(insertFn)) {
  26086. value = insertFn();
  26087. call(set, map, key, value);
  26088. } return value;
  26089. };
  26090. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/function-call":326,"../internals/is-callable":347}],366:[function(_dereq_,module,exports){
  26091. var ceil = Math.ceil;
  26092. var floor = Math.floor;
  26093. // `Math.trunc` method
  26094. // https://tc39.es/ecma262/#sec-math.trunc
  26095. // eslint-disable-next-line es-x/no-math-trunc -- safe
  26096. module.exports = Math.trunc || function trunc(x) {
  26097. var n = +x;
  26098. return (n > 0 ? floor : ceil)(n);
  26099. };
  26100. },{}],367:[function(_dereq_,module,exports){
  26101. var global = _dereq_('../internals/global');
  26102. var bind = _dereq_('../internals/function-bind-context');
  26103. var getOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
  26104. var macrotask = _dereq_('../internals/task').set;
  26105. var IS_IOS = _dereq_('../internals/engine-is-ios');
  26106. var IS_IOS_PEBBLE = _dereq_('../internals/engine-is-ios-pebble');
  26107. var IS_WEBOS_WEBKIT = _dereq_('../internals/engine-is-webos-webkit');
  26108. var IS_NODE = _dereq_('../internals/engine-is-node');
  26109. var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
  26110. var document = global.document;
  26111. var process = global.process;
  26112. var Promise = global.Promise;
  26113. // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
  26114. var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
  26115. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  26116. var flush, head, last, notify, toggle, node, promise, then;
  26117. // modern engines have queueMicrotask method
  26118. if (!queueMicrotask) {
  26119. flush = function () {
  26120. var parent, fn;
  26121. if (IS_NODE && (parent = process.domain)) parent.exit();
  26122. while (head) {
  26123. fn = head.fn;
  26124. head = head.next;
  26125. try {
  26126. fn();
  26127. } catch (error) {
  26128. if (head) notify();
  26129. else last = undefined;
  26130. throw error;
  26131. }
  26132. } last = undefined;
  26133. if (parent) parent.enter();
  26134. };
  26135. // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  26136. // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  26137. if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
  26138. toggle = true;
  26139. node = document.createTextNode('');
  26140. new MutationObserver(flush).observe(node, { characterData: true });
  26141. notify = function () {
  26142. node.data = toggle = !toggle;
  26143. };
  26144. // environments with maybe non-completely correct, but existent Promise
  26145. } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
  26146. // Promise.resolve without an argument throws an error in LG WebOS 2
  26147. promise = Promise.resolve(undefined);
  26148. // workaround of WebKit ~ iOS Safari 10.1 bug
  26149. promise.constructor = Promise;
  26150. then = bind(promise.then, promise);
  26151. notify = function () {
  26152. then(flush);
  26153. };
  26154. // Node.js without promises
  26155. } else if (IS_NODE) {
  26156. notify = function () {
  26157. process.nextTick(flush);
  26158. };
  26159. // for other environments - macrotask based on:
  26160. // - setImmediate
  26161. // - MessageChannel
  26162. // - window.postMessage
  26163. // - onreadystatechange
  26164. // - setTimeout
  26165. } else {
  26166. // strange IE + webpack dev server bug - use .bind(global)
  26167. macrotask = bind(macrotask, global);
  26168. notify = function () {
  26169. macrotask(flush);
  26170. };
  26171. }
  26172. }
  26173. module.exports = queueMicrotask || function (fn) {
  26174. var task = { fn: fn, next: undefined };
  26175. if (last) last.next = task;
  26176. if (!head) {
  26177. head = task;
  26178. notify();
  26179. } last = task;
  26180. };
  26181. },{"../internals/engine-is-ios":309,"../internals/engine-is-ios-pebble":308,"../internals/engine-is-node":310,"../internals/engine-is-webos-webkit":311,"../internals/function-bind-context":323,"../internals/global":334,"../internals/object-get-own-property-descriptor":376,"../internals/task":412}],368:[function(_dereq_,module,exports){
  26182. 'use strict';
  26183. var aCallable = _dereq_('../internals/a-callable');
  26184. var $TypeError = TypeError;
  26185. var PromiseCapability = function (C) {
  26186. var resolve, reject;
  26187. this.promise = new C(function ($$resolve, $$reject) {
  26188. if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
  26189. resolve = $$resolve;
  26190. reject = $$reject;
  26191. });
  26192. this.resolve = aCallable(resolve);
  26193. this.reject = aCallable(reject);
  26194. };
  26195. // `NewPromiseCapability` abstract operation
  26196. // https://tc39.es/ecma262/#sec-newpromisecapability
  26197. module.exports.f = function (C) {
  26198. return new PromiseCapability(C);
  26199. };
  26200. },{"../internals/a-callable":259}],369:[function(_dereq_,module,exports){
  26201. var toString = _dereq_('../internals/to-string');
  26202. module.exports = function (argument, $default) {
  26203. return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
  26204. };
  26205. },{"../internals/to-string":421}],370:[function(_dereq_,module,exports){
  26206. var isRegExp = _dereq_('../internals/is-regexp');
  26207. var $TypeError = TypeError;
  26208. module.exports = function (it) {
  26209. if (isRegExp(it)) {
  26210. throw $TypeError("The method doesn't accept regular expressions");
  26211. } return it;
  26212. };
  26213. },{"../internals/is-regexp":355}],371:[function(_dereq_,module,exports){
  26214. var global = _dereq_('../internals/global');
  26215. var fails = _dereq_('../internals/fails');
  26216. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26217. var toString = _dereq_('../internals/to-string');
  26218. var trim = _dereq_('../internals/string-trim').trim;
  26219. var whitespaces = _dereq_('../internals/whitespaces');
  26220. var $parseInt = global.parseInt;
  26221. var Symbol = global.Symbol;
  26222. var ITERATOR = Symbol && Symbol.iterator;
  26223. var hex = /^[+-]?0x/i;
  26224. var exec = uncurryThis(hex.exec);
  26225. var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
  26226. // MS Edge 18- broken with boxed symbols
  26227. || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));
  26228. // `parseInt` method
  26229. // https://tc39.es/ecma262/#sec-parseint-string-radix
  26230. module.exports = FORCED ? function parseInt(string, radix) {
  26231. var S = trim(toString(string));
  26232. return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
  26233. } : $parseInt;
  26234. },{"../internals/fails":320,"../internals/function-uncurry-this":328,"../internals/global":334,"../internals/string-trim":408,"../internals/to-string":421,"../internals/whitespaces":431}],372:[function(_dereq_,module,exports){
  26235. 'use strict';
  26236. var DESCRIPTORS = _dereq_('../internals/descriptors');
  26237. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26238. var call = _dereq_('../internals/function-call');
  26239. var fails = _dereq_('../internals/fails');
  26240. var objectKeys = _dereq_('../internals/object-keys');
  26241. var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
  26242. var propertyIsEnumerableModule = _dereq_('../internals/object-property-is-enumerable');
  26243. var toObject = _dereq_('../internals/to-object');
  26244. var IndexedObject = _dereq_('../internals/indexed-object');
  26245. // eslint-disable-next-line es-x/no-object-assign -- safe
  26246. var $assign = Object.assign;
  26247. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  26248. var defineProperty = Object.defineProperty;
  26249. var concat = uncurryThis([].concat);
  26250. // `Object.assign` method
  26251. // https://tc39.es/ecma262/#sec-object.assign
  26252. module.exports = !$assign || fails(function () {
  26253. // should have correct order of operations (Edge bug)
  26254. if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
  26255. enumerable: true,
  26256. get: function () {
  26257. defineProperty(this, 'b', {
  26258. value: 3,
  26259. enumerable: false
  26260. });
  26261. }
  26262. }), { b: 2 })).b !== 1) return true;
  26263. // should work with symbols and should have deterministic property order (V8 bug)
  26264. var A = {};
  26265. var B = {};
  26266. // eslint-disable-next-line es-x/no-symbol -- safe
  26267. var symbol = Symbol();
  26268. var alphabet = 'abcdefghijklmnopqrst';
  26269. A[symbol] = 7;
  26270. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  26271. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  26272. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  26273. var T = toObject(target);
  26274. var argumentsLength = arguments.length;
  26275. var index = 1;
  26276. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  26277. var propertyIsEnumerable = propertyIsEnumerableModule.f;
  26278. while (argumentsLength > index) {
  26279. var S = IndexedObject(arguments[index++]);
  26280. var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
  26281. var length = keys.length;
  26282. var j = 0;
  26283. var key;
  26284. while (length > j) {
  26285. key = keys[j++];
  26286. if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
  26287. }
  26288. } return T;
  26289. } : $assign;
  26290. },{"../internals/descriptors":300,"../internals/fails":320,"../internals/function-call":326,"../internals/function-uncurry-this":328,"../internals/indexed-object":340,"../internals/object-get-own-property-symbols":379,"../internals/object-keys":384,"../internals/object-property-is-enumerable":385,"../internals/to-object":417}],373:[function(_dereq_,module,exports){
  26291. /* global ActiveXObject -- old IE, WSH */
  26292. var anObject = _dereq_('../internals/an-object');
  26293. var definePropertiesModule = _dereq_('../internals/object-define-properties');
  26294. var enumBugKeys = _dereq_('../internals/enum-bug-keys');
  26295. var hiddenKeys = _dereq_('../internals/hidden-keys');
  26296. var html = _dereq_('../internals/html');
  26297. var documentCreateElement = _dereq_('../internals/document-create-element');
  26298. var sharedKey = _dereq_('../internals/shared-key');
  26299. var GT = '>';
  26300. var LT = '<';
  26301. var PROTOTYPE = 'prototype';
  26302. var SCRIPT = 'script';
  26303. var IE_PROTO = sharedKey('IE_PROTO');
  26304. var EmptyConstructor = function () { /* empty */ };
  26305. var scriptTag = function (content) {
  26306. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  26307. };
  26308. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  26309. var NullProtoObjectViaActiveX = function (activeXDocument) {
  26310. activeXDocument.write(scriptTag(''));
  26311. activeXDocument.close();
  26312. var temp = activeXDocument.parentWindow.Object;
  26313. activeXDocument = null; // avoid memory leak
  26314. return temp;
  26315. };
  26316. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  26317. var NullProtoObjectViaIFrame = function () {
  26318. // Thrash, waste and sodomy: IE GC bug
  26319. var iframe = documentCreateElement('iframe');
  26320. var JS = 'java' + SCRIPT + ':';
  26321. var iframeDocument;
  26322. iframe.style.display = 'none';
  26323. html.appendChild(iframe);
  26324. // https://github.com/zloirock/core-js/issues/475
  26325. iframe.src = String(JS);
  26326. iframeDocument = iframe.contentWindow.document;
  26327. iframeDocument.open();
  26328. iframeDocument.write(scriptTag('document.F=Object'));
  26329. iframeDocument.close();
  26330. return iframeDocument.F;
  26331. };
  26332. // Check for document.domain and active x support
  26333. // No need to use active x approach when document.domain is not set
  26334. // see https://github.com/es-shims/es5-shim/issues/150
  26335. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  26336. // avoid IE GC bug
  26337. var activeXDocument;
  26338. var NullProtoObject = function () {
  26339. try {
  26340. activeXDocument = new ActiveXObject('htmlfile');
  26341. } catch (error) { /* ignore */ }
  26342. NullProtoObject = typeof document != 'undefined'
  26343. ? document.domain && activeXDocument
  26344. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  26345. : NullProtoObjectViaIFrame()
  26346. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  26347. var length = enumBugKeys.length;
  26348. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  26349. return NullProtoObject();
  26350. };
  26351. hiddenKeys[IE_PROTO] = true;
  26352. // `Object.create` method
  26353. // https://tc39.es/ecma262/#sec-object.create
  26354. // eslint-disable-next-line es-x/no-object-create -- safe
  26355. module.exports = Object.create || function create(O, Properties) {
  26356. var result;
  26357. if (O !== null) {
  26358. EmptyConstructor[PROTOTYPE] = anObject(O);
  26359. result = new EmptyConstructor();
  26360. EmptyConstructor[PROTOTYPE] = null;
  26361. // add "__proto__" for Object.getPrototypeOf polyfill
  26362. result[IE_PROTO] = O;
  26363. } else result = NullProtoObject();
  26364. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  26365. };
  26366. },{"../internals/an-object":264,"../internals/document-create-element":301,"../internals/enum-bug-keys":316,"../internals/hidden-keys":336,"../internals/html":338,"../internals/object-define-properties":374,"../internals/shared-key":403}],374:[function(_dereq_,module,exports){
  26367. var DESCRIPTORS = _dereq_('../internals/descriptors');
  26368. var V8_PROTOTYPE_DEFINE_BUG = _dereq_('../internals/v8-prototype-define-bug');
  26369. var definePropertyModule = _dereq_('../internals/object-define-property');
  26370. var anObject = _dereq_('../internals/an-object');
  26371. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  26372. var objectKeys = _dereq_('../internals/object-keys');
  26373. // `Object.defineProperties` method
  26374. // https://tc39.es/ecma262/#sec-object.defineproperties
  26375. // eslint-disable-next-line es-x/no-object-defineproperties -- safe
  26376. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  26377. anObject(O);
  26378. var props = toIndexedObject(Properties);
  26379. var keys = objectKeys(Properties);
  26380. var length = keys.length;
  26381. var index = 0;
  26382. var key;
  26383. while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
  26384. return O;
  26385. };
  26386. },{"../internals/an-object":264,"../internals/descriptors":300,"../internals/object-define-property":375,"../internals/object-keys":384,"../internals/to-indexed-object":414,"../internals/v8-prototype-define-bug":425}],375:[function(_dereq_,module,exports){
  26387. var DESCRIPTORS = _dereq_('../internals/descriptors');
  26388. var IE8_DOM_DEFINE = _dereq_('../internals/ie8-dom-define');
  26389. var V8_PROTOTYPE_DEFINE_BUG = _dereq_('../internals/v8-prototype-define-bug');
  26390. var anObject = _dereq_('../internals/an-object');
  26391. var toPropertyKey = _dereq_('../internals/to-property-key');
  26392. var $TypeError = TypeError;
  26393. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  26394. var $defineProperty = Object.defineProperty;
  26395. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  26396. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  26397. var ENUMERABLE = 'enumerable';
  26398. var CONFIGURABLE = 'configurable';
  26399. var WRITABLE = 'writable';
  26400. // `Object.defineProperty` method
  26401. // https://tc39.es/ecma262/#sec-object.defineproperty
  26402. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  26403. anObject(O);
  26404. P = toPropertyKey(P);
  26405. anObject(Attributes);
  26406. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  26407. var current = $getOwnPropertyDescriptor(O, P);
  26408. if (current && current[WRITABLE]) {
  26409. O[P] = Attributes.value;
  26410. Attributes = {
  26411. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  26412. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  26413. writable: false
  26414. };
  26415. }
  26416. } return $defineProperty(O, P, Attributes);
  26417. } : $defineProperty : function defineProperty(O, P, Attributes) {
  26418. anObject(O);
  26419. P = toPropertyKey(P);
  26420. anObject(Attributes);
  26421. if (IE8_DOM_DEFINE) try {
  26422. return $defineProperty(O, P, Attributes);
  26423. } catch (error) { /* empty */ }
  26424. if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
  26425. if ('value' in Attributes) O[P] = Attributes.value;
  26426. return O;
  26427. };
  26428. },{"../internals/an-object":264,"../internals/descriptors":300,"../internals/ie8-dom-define":339,"../internals/to-property-key":419,"../internals/v8-prototype-define-bug":425}],376:[function(_dereq_,module,exports){
  26429. var DESCRIPTORS = _dereq_('../internals/descriptors');
  26430. var call = _dereq_('../internals/function-call');
  26431. var propertyIsEnumerableModule = _dereq_('../internals/object-property-is-enumerable');
  26432. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  26433. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  26434. var toPropertyKey = _dereq_('../internals/to-property-key');
  26435. var hasOwn = _dereq_('../internals/has-own-property');
  26436. var IE8_DOM_DEFINE = _dereq_('../internals/ie8-dom-define');
  26437. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  26438. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  26439. // `Object.getOwnPropertyDescriptor` method
  26440. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  26441. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  26442. O = toIndexedObject(O);
  26443. P = toPropertyKey(P);
  26444. if (IE8_DOM_DEFINE) try {
  26445. return $getOwnPropertyDescriptor(O, P);
  26446. } catch (error) { /* empty */ }
  26447. if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  26448. };
  26449. },{"../internals/create-property-descriptor":294,"../internals/descriptors":300,"../internals/function-call":326,"../internals/has-own-property":335,"../internals/ie8-dom-define":339,"../internals/object-property-is-enumerable":385,"../internals/to-indexed-object":414,"../internals/to-property-key":419}],377:[function(_dereq_,module,exports){
  26450. /* eslint-disable es-x/no-object-getownpropertynames -- safe */
  26451. var classof = _dereq_('../internals/classof-raw');
  26452. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  26453. var $getOwnPropertyNames = _dereq_('../internals/object-get-own-property-names').f;
  26454. var arraySlice = _dereq_('../internals/array-slice-simple');
  26455. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  26456. ? Object.getOwnPropertyNames(window) : [];
  26457. var getWindowNames = function (it) {
  26458. try {
  26459. return $getOwnPropertyNames(it);
  26460. } catch (error) {
  26461. return arraySlice(windowNames);
  26462. }
  26463. };
  26464. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  26465. module.exports.f = function getOwnPropertyNames(it) {
  26466. return windowNames && classof(it) == 'Window'
  26467. ? getWindowNames(it)
  26468. : $getOwnPropertyNames(toIndexedObject(it));
  26469. };
  26470. },{"../internals/array-slice-simple":274,"../internals/classof-raw":281,"../internals/object-get-own-property-names":378,"../internals/to-indexed-object":414}],378:[function(_dereq_,module,exports){
  26471. var internalObjectKeys = _dereq_('../internals/object-keys-internal');
  26472. var enumBugKeys = _dereq_('../internals/enum-bug-keys');
  26473. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  26474. // `Object.getOwnPropertyNames` method
  26475. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  26476. // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
  26477. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  26478. return internalObjectKeys(O, hiddenKeys);
  26479. };
  26480. },{"../internals/enum-bug-keys":316,"../internals/object-keys-internal":383}],379:[function(_dereq_,module,exports){
  26481. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
  26482. exports.f = Object.getOwnPropertySymbols;
  26483. },{}],380:[function(_dereq_,module,exports){
  26484. var hasOwn = _dereq_('../internals/has-own-property');
  26485. var isCallable = _dereq_('../internals/is-callable');
  26486. var toObject = _dereq_('../internals/to-object');
  26487. var sharedKey = _dereq_('../internals/shared-key');
  26488. var CORRECT_PROTOTYPE_GETTER = _dereq_('../internals/correct-prototype-getter');
  26489. var IE_PROTO = sharedKey('IE_PROTO');
  26490. var $Object = Object;
  26491. var ObjectPrototype = $Object.prototype;
  26492. // `Object.getPrototypeOf` method
  26493. // https://tc39.es/ecma262/#sec-object.getprototypeof
  26494. // eslint-disable-next-line es-x/no-object-getprototypeof -- safe
  26495. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  26496. var object = toObject(O);
  26497. if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
  26498. var constructor = object.constructor;
  26499. if (isCallable(constructor) && object instanceof constructor) {
  26500. return constructor.prototype;
  26501. } return object instanceof $Object ? ObjectPrototype : null;
  26502. };
  26503. },{"../internals/correct-prototype-getter":291,"../internals/has-own-property":335,"../internals/is-callable":347,"../internals/shared-key":403,"../internals/to-object":417}],381:[function(_dereq_,module,exports){
  26504. var fails = _dereq_('../internals/fails');
  26505. var isObject = _dereq_('../internals/is-object');
  26506. var classof = _dereq_('../internals/classof-raw');
  26507. var ARRAY_BUFFER_NON_EXTENSIBLE = _dereq_('../internals/array-buffer-non-extensible');
  26508. // eslint-disable-next-line es-x/no-object-isextensible -- safe
  26509. var $isExtensible = Object.isExtensible;
  26510. var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
  26511. // `Object.isExtensible` method
  26512. // https://tc39.es/ecma262/#sec-object.isextensible
  26513. module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
  26514. if (!isObject(it)) return false;
  26515. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
  26516. return $isExtensible ? $isExtensible(it) : true;
  26517. } : $isExtensible;
  26518. },{"../internals/array-buffer-non-extensible":265,"../internals/classof-raw":281,"../internals/fails":320,"../internals/is-object":353}],382:[function(_dereq_,module,exports){
  26519. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26520. module.exports = uncurryThis({}.isPrototypeOf);
  26521. },{"../internals/function-uncurry-this":328}],383:[function(_dereq_,module,exports){
  26522. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26523. var hasOwn = _dereq_('../internals/has-own-property');
  26524. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  26525. var indexOf = _dereq_('../internals/array-includes').indexOf;
  26526. var hiddenKeys = _dereq_('../internals/hidden-keys');
  26527. var push = uncurryThis([].push);
  26528. module.exports = function (object, names) {
  26529. var O = toIndexedObject(object);
  26530. var i = 0;
  26531. var result = [];
  26532. var key;
  26533. for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  26534. // Don't enum bug & hidden keys
  26535. while (names.length > i) if (hasOwn(O, key = names[i++])) {
  26536. ~indexOf(result, key) || push(result, key);
  26537. }
  26538. return result;
  26539. };
  26540. },{"../internals/array-includes":268,"../internals/function-uncurry-this":328,"../internals/has-own-property":335,"../internals/hidden-keys":336,"../internals/to-indexed-object":414}],384:[function(_dereq_,module,exports){
  26541. var internalObjectKeys = _dereq_('../internals/object-keys-internal');
  26542. var enumBugKeys = _dereq_('../internals/enum-bug-keys');
  26543. // `Object.keys` method
  26544. // https://tc39.es/ecma262/#sec-object.keys
  26545. // eslint-disable-next-line es-x/no-object-keys -- safe
  26546. module.exports = Object.keys || function keys(O) {
  26547. return internalObjectKeys(O, enumBugKeys);
  26548. };
  26549. },{"../internals/enum-bug-keys":316,"../internals/object-keys-internal":383}],385:[function(_dereq_,module,exports){
  26550. 'use strict';
  26551. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  26552. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  26553. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  26554. // Nashorn ~ JDK8 bug
  26555. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  26556. // `Object.prototype.propertyIsEnumerable` method implementation
  26557. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  26558. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  26559. var descriptor = getOwnPropertyDescriptor(this, V);
  26560. return !!descriptor && descriptor.enumerable;
  26561. } : $propertyIsEnumerable;
  26562. },{}],386:[function(_dereq_,module,exports){
  26563. /* eslint-disable no-proto -- safe */
  26564. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26565. var anObject = _dereq_('../internals/an-object');
  26566. var aPossiblePrototype = _dereq_('../internals/a-possible-prototype');
  26567. // `Object.setPrototypeOf` method
  26568. // https://tc39.es/ecma262/#sec-object.setprototypeof
  26569. // Works with __proto__ only. Old v8 can't work with null proto objects.
  26570. // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
  26571. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  26572. var CORRECT_SETTER = false;
  26573. var test = {};
  26574. var setter;
  26575. try {
  26576. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  26577. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  26578. setter(test, []);
  26579. CORRECT_SETTER = test instanceof Array;
  26580. } catch (error) { /* empty */ }
  26581. return function setPrototypeOf(O, proto) {
  26582. anObject(O);
  26583. aPossiblePrototype(proto);
  26584. if (CORRECT_SETTER) setter(O, proto);
  26585. else O.__proto__ = proto;
  26586. return O;
  26587. };
  26588. }() : undefined);
  26589. },{"../internals/a-possible-prototype":261,"../internals/an-object":264,"../internals/function-uncurry-this":328}],387:[function(_dereq_,module,exports){
  26590. var DESCRIPTORS = _dereq_('../internals/descriptors');
  26591. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26592. var objectKeys = _dereq_('../internals/object-keys');
  26593. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  26594. var $propertyIsEnumerable = _dereq_('../internals/object-property-is-enumerable').f;
  26595. var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
  26596. var push = uncurryThis([].push);
  26597. // `Object.{ entries, values }` methods implementation
  26598. var createMethod = function (TO_ENTRIES) {
  26599. return function (it) {
  26600. var O = toIndexedObject(it);
  26601. var keys = objectKeys(O);
  26602. var length = keys.length;
  26603. var i = 0;
  26604. var result = [];
  26605. var key;
  26606. while (length > i) {
  26607. key = keys[i++];
  26608. if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
  26609. push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
  26610. }
  26611. }
  26612. return result;
  26613. };
  26614. };
  26615. module.exports = {
  26616. // `Object.entries` method
  26617. // https://tc39.es/ecma262/#sec-object.entries
  26618. entries: createMethod(true),
  26619. // `Object.values` method
  26620. // https://tc39.es/ecma262/#sec-object.values
  26621. values: createMethod(false)
  26622. };
  26623. },{"../internals/descriptors":300,"../internals/function-uncurry-this":328,"../internals/object-keys":384,"../internals/object-property-is-enumerable":385,"../internals/to-indexed-object":414}],388:[function(_dereq_,module,exports){
  26624. 'use strict';
  26625. var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
  26626. var classof = _dereq_('../internals/classof');
  26627. // `Object.prototype.toString` method implementation
  26628. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  26629. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  26630. return '[object ' + classof(this) + ']';
  26631. };
  26632. },{"../internals/classof":282,"../internals/to-string-tag-support":420}],389:[function(_dereq_,module,exports){
  26633. var call = _dereq_('../internals/function-call');
  26634. var isCallable = _dereq_('../internals/is-callable');
  26635. var isObject = _dereq_('../internals/is-object');
  26636. var $TypeError = TypeError;
  26637. // `OrdinaryToPrimitive` abstract operation
  26638. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  26639. module.exports = function (input, pref) {
  26640. var fn, val;
  26641. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  26642. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
  26643. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  26644. throw $TypeError("Can't convert object to primitive value");
  26645. };
  26646. },{"../internals/function-call":326,"../internals/is-callable":347,"../internals/is-object":353}],390:[function(_dereq_,module,exports){
  26647. var getBuiltIn = _dereq_('../internals/get-built-in');
  26648. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26649. var getOwnPropertyNamesModule = _dereq_('../internals/object-get-own-property-names');
  26650. var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
  26651. var anObject = _dereq_('../internals/an-object');
  26652. var concat = uncurryThis([].concat);
  26653. // all object keys, includes non-enumerable and symbols
  26654. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  26655. var keys = getOwnPropertyNamesModule.f(anObject(it));
  26656. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  26657. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  26658. };
  26659. },{"../internals/an-object":264,"../internals/function-uncurry-this":328,"../internals/get-built-in":329,"../internals/object-get-own-property-names":378,"../internals/object-get-own-property-symbols":379}],391:[function(_dereq_,module,exports){
  26660. arguments[4][336][0].apply(exports,arguments)
  26661. },{"dup":336}],392:[function(_dereq_,module,exports){
  26662. module.exports = function (exec) {
  26663. try {
  26664. return { error: false, value: exec() };
  26665. } catch (error) {
  26666. return { error: true, value: error };
  26667. }
  26668. };
  26669. },{}],393:[function(_dereq_,module,exports){
  26670. var global = _dereq_('../internals/global');
  26671. var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
  26672. var isCallable = _dereq_('../internals/is-callable');
  26673. var isForced = _dereq_('../internals/is-forced');
  26674. var inspectSource = _dereq_('../internals/inspect-source');
  26675. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  26676. var IS_BROWSER = _dereq_('../internals/engine-is-browser');
  26677. var IS_DENO = _dereq_('../internals/engine-is-deno');
  26678. var IS_PURE = _dereq_('../internals/is-pure');
  26679. var V8_VERSION = _dereq_('../internals/engine-v8-version');
  26680. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  26681. var SPECIES = wellKnownSymbol('species');
  26682. var SUBCLASSING = false;
  26683. var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
  26684. var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
  26685. var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
  26686. var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
  26687. // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  26688. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  26689. // We can't detect it synchronously, so just check versions
  26690. if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
  26691. // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
  26692. if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
  26693. // We can't use @@species feature detection in V8 since it causes
  26694. // deoptimization and performance degradation
  26695. // https://github.com/zloirock/core-js/issues/679
  26696. if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
  26697. // Detect correctness of subclassing with @@species support
  26698. var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
  26699. var FakePromise = function (exec) {
  26700. exec(function () { /* empty */ }, function () { /* empty */ });
  26701. };
  26702. var constructor = promise.constructor = {};
  26703. constructor[SPECIES] = FakePromise;
  26704. SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
  26705. if (!SUBCLASSING) return true;
  26706. // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  26707. } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT;
  26708. });
  26709. module.exports = {
  26710. CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
  26711. REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
  26712. SUBCLASSING: SUBCLASSING
  26713. };
  26714. },{"../internals/engine-is-browser":305,"../internals/engine-is-deno":306,"../internals/engine-v8-version":313,"../internals/global":334,"../internals/inspect-source":341,"../internals/is-callable":347,"../internals/is-forced":350,"../internals/is-pure":354,"../internals/promise-native-constructor":394,"../internals/well-known-symbol":430}],394:[function(_dereq_,module,exports){
  26715. var global = _dereq_('../internals/global');
  26716. module.exports = global.Promise;
  26717. },{"../internals/global":334}],395:[function(_dereq_,module,exports){
  26718. var anObject = _dereq_('../internals/an-object');
  26719. var isObject = _dereq_('../internals/is-object');
  26720. var newPromiseCapability = _dereq_('../internals/new-promise-capability');
  26721. module.exports = function (C, x) {
  26722. anObject(C);
  26723. if (isObject(x) && x.constructor === C) return x;
  26724. var promiseCapability = newPromiseCapability.f(C);
  26725. var resolve = promiseCapability.resolve;
  26726. resolve(x);
  26727. return promiseCapability.promise;
  26728. };
  26729. },{"../internals/an-object":264,"../internals/is-object":353,"../internals/new-promise-capability":368}],396:[function(_dereq_,module,exports){
  26730. var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
  26731. var checkCorrectnessOfIteration = _dereq_('../internals/check-correctness-of-iteration');
  26732. var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
  26733. module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
  26734. NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
  26735. });
  26736. },{"../internals/check-correctness-of-iteration":280,"../internals/promise-constructor-detection":393,"../internals/promise-native-constructor":394}],397:[function(_dereq_,module,exports){
  26737. var Queue = function () {
  26738. this.head = null;
  26739. this.tail = null;
  26740. };
  26741. Queue.prototype = {
  26742. add: function (item) {
  26743. var entry = { item: item, next: null };
  26744. if (this.head) this.tail.next = entry;
  26745. else this.head = entry;
  26746. this.tail = entry;
  26747. },
  26748. get: function () {
  26749. var entry = this.head;
  26750. if (entry) {
  26751. this.head = entry.next;
  26752. if (this.tail === entry) this.tail = null;
  26753. return entry.item;
  26754. }
  26755. }
  26756. };
  26757. module.exports = Queue;
  26758. },{}],398:[function(_dereq_,module,exports){
  26759. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  26760. var $TypeError = TypeError;
  26761. // `RequireObjectCoercible` abstract operation
  26762. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  26763. module.exports = function (it) {
  26764. if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it);
  26765. return it;
  26766. };
  26767. },{"../internals/is-null-or-undefined":352}],399:[function(_dereq_,module,exports){
  26768. // `SameValueZero` abstract operation
  26769. // https://tc39.es/ecma262/#sec-samevaluezero
  26770. module.exports = function (x, y) {
  26771. // eslint-disable-next-line no-self-compare -- NaN check
  26772. return x === y || x != x && y != y;
  26773. };
  26774. },{}],400:[function(_dereq_,module,exports){
  26775. var global = _dereq_('../internals/global');
  26776. var apply = _dereq_('../internals/function-apply');
  26777. var isCallable = _dereq_('../internals/is-callable');
  26778. var userAgent = _dereq_('../internals/engine-user-agent');
  26779. var arraySlice = _dereq_('../internals/array-slice');
  26780. var validateArgumentsLength = _dereq_('../internals/validate-arguments-length');
  26781. var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
  26782. var Function = global.Function;
  26783. var wrap = function (scheduler) {
  26784. return MSIE ? function (handler, timeout /* , ...arguments */) {
  26785. var boundArgs = validateArgumentsLength(arguments.length, 1) > 2;
  26786. var fn = isCallable(handler) ? handler : Function(handler);
  26787. var args = boundArgs ? arraySlice(arguments, 2) : undefined;
  26788. return scheduler(boundArgs ? function () {
  26789. apply(fn, this, args);
  26790. } : fn, timeout);
  26791. } : scheduler;
  26792. };
  26793. // ie9- setTimeout & setInterval additional parameters fix
  26794. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
  26795. module.exports = {
  26796. // `setTimeout` method
  26797. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
  26798. setTimeout: wrap(global.setTimeout),
  26799. // `setInterval` method
  26800. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
  26801. setInterval: wrap(global.setInterval)
  26802. };
  26803. },{"../internals/array-slice":275,"../internals/engine-user-agent":312,"../internals/function-apply":322,"../internals/global":334,"../internals/is-callable":347,"../internals/validate-arguments-length":426}],401:[function(_dereq_,module,exports){
  26804. 'use strict';
  26805. var getBuiltIn = _dereq_('../internals/get-built-in');
  26806. var definePropertyModule = _dereq_('../internals/object-define-property');
  26807. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  26808. var DESCRIPTORS = _dereq_('../internals/descriptors');
  26809. var SPECIES = wellKnownSymbol('species');
  26810. module.exports = function (CONSTRUCTOR_NAME) {
  26811. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  26812. var defineProperty = definePropertyModule.f;
  26813. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  26814. defineProperty(Constructor, SPECIES, {
  26815. configurable: true,
  26816. get: function () { return this; }
  26817. });
  26818. }
  26819. };
  26820. },{"../internals/descriptors":300,"../internals/get-built-in":329,"../internals/object-define-property":375,"../internals/well-known-symbol":430}],402:[function(_dereq_,module,exports){
  26821. var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
  26822. var defineProperty = _dereq_('../internals/object-define-property').f;
  26823. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  26824. var hasOwn = _dereq_('../internals/has-own-property');
  26825. var toString = _dereq_('../internals/object-to-string');
  26826. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  26827. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  26828. module.exports = function (it, TAG, STATIC, SET_METHOD) {
  26829. if (it) {
  26830. var target = STATIC ? it : it.prototype;
  26831. if (!hasOwn(target, TO_STRING_TAG)) {
  26832. defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
  26833. }
  26834. if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
  26835. createNonEnumerableProperty(target, 'toString', toString);
  26836. }
  26837. }
  26838. };
  26839. },{"../internals/create-non-enumerable-property":293,"../internals/has-own-property":335,"../internals/object-define-property":375,"../internals/object-to-string":388,"../internals/to-string-tag-support":420,"../internals/well-known-symbol":430}],403:[function(_dereq_,module,exports){
  26840. var shared = _dereq_('../internals/shared');
  26841. var uid = _dereq_('../internals/uid');
  26842. var keys = shared('keys');
  26843. module.exports = function (key) {
  26844. return keys[key] || (keys[key] = uid(key));
  26845. };
  26846. },{"../internals/shared":405,"../internals/uid":423}],404:[function(_dereq_,module,exports){
  26847. var global = _dereq_('../internals/global');
  26848. var defineGlobalProperty = _dereq_('../internals/define-global-property');
  26849. var SHARED = '__core-js_shared__';
  26850. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  26851. module.exports = store;
  26852. },{"../internals/define-global-property":298,"../internals/global":334}],405:[function(_dereq_,module,exports){
  26853. var IS_PURE = _dereq_('../internals/is-pure');
  26854. var store = _dereq_('../internals/shared-store');
  26855. (module.exports = function (key, value) {
  26856. return store[key] || (store[key] = value !== undefined ? value : {});
  26857. })('versions', []).push({
  26858. version: '3.25.1',
  26859. mode: IS_PURE ? 'pure' : 'global',
  26860. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  26861. license: 'https://github.com/zloirock/core-js/blob/v3.25.1/LICENSE',
  26862. source: 'https://github.com/zloirock/core-js'
  26863. });
  26864. },{"../internals/is-pure":354,"../internals/shared-store":404}],406:[function(_dereq_,module,exports){
  26865. var anObject = _dereq_('../internals/an-object');
  26866. var aConstructor = _dereq_('../internals/a-constructor');
  26867. var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
  26868. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  26869. var SPECIES = wellKnownSymbol('species');
  26870. // `SpeciesConstructor` abstract operation
  26871. // https://tc39.es/ecma262/#sec-speciesconstructor
  26872. module.exports = function (O, defaultConstructor) {
  26873. var C = anObject(O).constructor;
  26874. var S;
  26875. return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S);
  26876. };
  26877. },{"../internals/a-constructor":260,"../internals/an-object":264,"../internals/is-null-or-undefined":352,"../internals/well-known-symbol":430}],407:[function(_dereq_,module,exports){
  26878. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26879. var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
  26880. var toString = _dereq_('../internals/to-string');
  26881. var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
  26882. var charAt = uncurryThis(''.charAt);
  26883. var charCodeAt = uncurryThis(''.charCodeAt);
  26884. var stringSlice = uncurryThis(''.slice);
  26885. var createMethod = function (CONVERT_TO_STRING) {
  26886. return function ($this, pos) {
  26887. var S = toString(requireObjectCoercible($this));
  26888. var position = toIntegerOrInfinity(pos);
  26889. var size = S.length;
  26890. var first, second;
  26891. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  26892. first = charCodeAt(S, position);
  26893. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  26894. || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
  26895. ? CONVERT_TO_STRING
  26896. ? charAt(S, position)
  26897. : first
  26898. : CONVERT_TO_STRING
  26899. ? stringSlice(S, position, position + 2)
  26900. : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  26901. };
  26902. };
  26903. module.exports = {
  26904. // `String.prototype.codePointAt` method
  26905. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  26906. codeAt: createMethod(false),
  26907. // `String.prototype.at` method
  26908. // https://github.com/mathiasbynens/String.prototype.at
  26909. charAt: createMethod(true)
  26910. };
  26911. },{"../internals/function-uncurry-this":328,"../internals/require-object-coercible":398,"../internals/to-integer-or-infinity":415,"../internals/to-string":421}],408:[function(_dereq_,module,exports){
  26912. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  26913. var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
  26914. var toString = _dereq_('../internals/to-string');
  26915. var whitespaces = _dereq_('../internals/whitespaces');
  26916. var replace = uncurryThis(''.replace);
  26917. var whitespace = '[' + whitespaces + ']';
  26918. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  26919. var rtrim = RegExp(whitespace + whitespace + '*$');
  26920. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  26921. var createMethod = function (TYPE) {
  26922. return function ($this) {
  26923. var string = toString(requireObjectCoercible($this));
  26924. if (TYPE & 1) string = replace(string, ltrim, '');
  26925. if (TYPE & 2) string = replace(string, rtrim, '');
  26926. return string;
  26927. };
  26928. };
  26929. module.exports = {
  26930. // `String.prototype.{ trimLeft, trimStart }` methods
  26931. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  26932. start: createMethod(1),
  26933. // `String.prototype.{ trimRight, trimEnd }` methods
  26934. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  26935. end: createMethod(2),
  26936. // `String.prototype.trim` method
  26937. // https://tc39.es/ecma262/#sec-string.prototype.trim
  26938. trim: createMethod(3)
  26939. };
  26940. },{"../internals/function-uncurry-this":328,"../internals/require-object-coercible":398,"../internals/to-string":421,"../internals/whitespaces":431}],409:[function(_dereq_,module,exports){
  26941. /* eslint-disable es-x/no-symbol -- required for testing */
  26942. var V8_VERSION = _dereq_('../internals/engine-v8-version');
  26943. var fails = _dereq_('../internals/fails');
  26944. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
  26945. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  26946. var symbol = Symbol();
  26947. // Chrome 38 Symbol has incorrect toString conversion
  26948. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  26949. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  26950. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  26951. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  26952. });
  26953. },{"../internals/engine-v8-version":313,"../internals/fails":320}],410:[function(_dereq_,module,exports){
  26954. var call = _dereq_('../internals/function-call');
  26955. var getBuiltIn = _dereq_('../internals/get-built-in');
  26956. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  26957. var defineBuiltIn = _dereq_('../internals/define-built-in');
  26958. module.exports = function () {
  26959. var Symbol = getBuiltIn('Symbol');
  26960. var SymbolPrototype = Symbol && Symbol.prototype;
  26961. var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
  26962. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  26963. if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
  26964. // `Symbol.prototype[@@toPrimitive]` method
  26965. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  26966. // eslint-disable-next-line no-unused-vars -- required for .length
  26967. defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
  26968. return call(valueOf, this);
  26969. }, { arity: 1 });
  26970. }
  26971. };
  26972. },{"../internals/define-built-in":296,"../internals/function-call":326,"../internals/get-built-in":329,"../internals/well-known-symbol":430}],411:[function(_dereq_,module,exports){
  26973. var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
  26974. /* eslint-disable es-x/no-symbol -- safe */
  26975. module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
  26976. },{"../internals/symbol-constructor-detection":409}],412:[function(_dereq_,module,exports){
  26977. var global = _dereq_('../internals/global');
  26978. var apply = _dereq_('../internals/function-apply');
  26979. var bind = _dereq_('../internals/function-bind-context');
  26980. var isCallable = _dereq_('../internals/is-callable');
  26981. var hasOwn = _dereq_('../internals/has-own-property');
  26982. var fails = _dereq_('../internals/fails');
  26983. var html = _dereq_('../internals/html');
  26984. var arraySlice = _dereq_('../internals/array-slice');
  26985. var createElement = _dereq_('../internals/document-create-element');
  26986. var validateArgumentsLength = _dereq_('../internals/validate-arguments-length');
  26987. var IS_IOS = _dereq_('../internals/engine-is-ios');
  26988. var IS_NODE = _dereq_('../internals/engine-is-node');
  26989. var set = global.setImmediate;
  26990. var clear = global.clearImmediate;
  26991. var process = global.process;
  26992. var Dispatch = global.Dispatch;
  26993. var Function = global.Function;
  26994. var MessageChannel = global.MessageChannel;
  26995. var String = global.String;
  26996. var counter = 0;
  26997. var queue = {};
  26998. var ONREADYSTATECHANGE = 'onreadystatechange';
  26999. var location, defer, channel, port;
  27000. try {
  27001. // Deno throws a ReferenceError on `location` access without `--location` flag
  27002. location = global.location;
  27003. } catch (error) { /* empty */ }
  27004. var run = function (id) {
  27005. if (hasOwn(queue, id)) {
  27006. var fn = queue[id];
  27007. delete queue[id];
  27008. fn();
  27009. }
  27010. };
  27011. var runner = function (id) {
  27012. return function () {
  27013. run(id);
  27014. };
  27015. };
  27016. var listener = function (event) {
  27017. run(event.data);
  27018. };
  27019. var post = function (id) {
  27020. // old engines have not location.origin
  27021. global.postMessage(String(id), location.protocol + '//' + location.host);
  27022. };
  27023. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  27024. if (!set || !clear) {
  27025. set = function setImmediate(handler) {
  27026. validateArgumentsLength(arguments.length, 1);
  27027. var fn = isCallable(handler) ? handler : Function(handler);
  27028. var args = arraySlice(arguments, 1);
  27029. queue[++counter] = function () {
  27030. apply(fn, undefined, args);
  27031. };
  27032. defer(counter);
  27033. return counter;
  27034. };
  27035. clear = function clearImmediate(id) {
  27036. delete queue[id];
  27037. };
  27038. // Node.js 0.8-
  27039. if (IS_NODE) {
  27040. defer = function (id) {
  27041. process.nextTick(runner(id));
  27042. };
  27043. // Sphere (JS game engine) Dispatch API
  27044. } else if (Dispatch && Dispatch.now) {
  27045. defer = function (id) {
  27046. Dispatch.now(runner(id));
  27047. };
  27048. // Browsers with MessageChannel, includes WebWorkers
  27049. // except iOS - https://github.com/zloirock/core-js/issues/624
  27050. } else if (MessageChannel && !IS_IOS) {
  27051. channel = new MessageChannel();
  27052. port = channel.port2;
  27053. channel.port1.onmessage = listener;
  27054. defer = bind(port.postMessage, port);
  27055. // Browsers with postMessage, skip WebWorkers
  27056. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  27057. } else if (
  27058. global.addEventListener &&
  27059. isCallable(global.postMessage) &&
  27060. !global.importScripts &&
  27061. location && location.protocol !== 'file:' &&
  27062. !fails(post)
  27063. ) {
  27064. defer = post;
  27065. global.addEventListener('message', listener, false);
  27066. // IE8-
  27067. } else if (ONREADYSTATECHANGE in createElement('script')) {
  27068. defer = function (id) {
  27069. html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
  27070. html.removeChild(this);
  27071. run(id);
  27072. };
  27073. };
  27074. // Rest old browsers
  27075. } else {
  27076. defer = function (id) {
  27077. setTimeout(runner(id), 0);
  27078. };
  27079. }
  27080. }
  27081. module.exports = {
  27082. set: set,
  27083. clear: clear
  27084. };
  27085. },{"../internals/array-slice":275,"../internals/document-create-element":301,"../internals/engine-is-ios":309,"../internals/engine-is-node":310,"../internals/fails":320,"../internals/function-apply":322,"../internals/function-bind-context":323,"../internals/global":334,"../internals/has-own-property":335,"../internals/html":338,"../internals/is-callable":347,"../internals/validate-arguments-length":426}],413:[function(_dereq_,module,exports){
  27086. var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
  27087. var max = Math.max;
  27088. var min = Math.min;
  27089. // Helper for a popular repeating case of the spec:
  27090. // Let integer be ? ToInteger(index).
  27091. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  27092. module.exports = function (index, length) {
  27093. var integer = toIntegerOrInfinity(index);
  27094. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  27095. };
  27096. },{"../internals/to-integer-or-infinity":415}],414:[function(_dereq_,module,exports){
  27097. // toObject with fallback for non-array-like ES3 strings
  27098. var IndexedObject = _dereq_('../internals/indexed-object');
  27099. var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
  27100. module.exports = function (it) {
  27101. return IndexedObject(requireObjectCoercible(it));
  27102. };
  27103. },{"../internals/indexed-object":340,"../internals/require-object-coercible":398}],415:[function(_dereq_,module,exports){
  27104. var trunc = _dereq_('../internals/math-trunc');
  27105. // `ToIntegerOrInfinity` abstract operation
  27106. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  27107. module.exports = function (argument) {
  27108. var number = +argument;
  27109. // eslint-disable-next-line no-self-compare -- NaN check
  27110. return number !== number || number === 0 ? 0 : trunc(number);
  27111. };
  27112. },{"../internals/math-trunc":366}],416:[function(_dereq_,module,exports){
  27113. var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
  27114. var min = Math.min;
  27115. // `ToLength` abstract operation
  27116. // https://tc39.es/ecma262/#sec-tolength
  27117. module.exports = function (argument) {
  27118. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  27119. };
  27120. },{"../internals/to-integer-or-infinity":415}],417:[function(_dereq_,module,exports){
  27121. var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
  27122. var $Object = Object;
  27123. // `ToObject` abstract operation
  27124. // https://tc39.es/ecma262/#sec-toobject
  27125. module.exports = function (argument) {
  27126. return $Object(requireObjectCoercible(argument));
  27127. };
  27128. },{"../internals/require-object-coercible":398}],418:[function(_dereq_,module,exports){
  27129. var call = _dereq_('../internals/function-call');
  27130. var isObject = _dereq_('../internals/is-object');
  27131. var isSymbol = _dereq_('../internals/is-symbol');
  27132. var getMethod = _dereq_('../internals/get-method');
  27133. var ordinaryToPrimitive = _dereq_('../internals/ordinary-to-primitive');
  27134. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  27135. var $TypeError = TypeError;
  27136. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  27137. // `ToPrimitive` abstract operation
  27138. // https://tc39.es/ecma262/#sec-toprimitive
  27139. module.exports = function (input, pref) {
  27140. if (!isObject(input) || isSymbol(input)) return input;
  27141. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  27142. var result;
  27143. if (exoticToPrim) {
  27144. if (pref === undefined) pref = 'default';
  27145. result = call(exoticToPrim, input, pref);
  27146. if (!isObject(result) || isSymbol(result)) return result;
  27147. throw $TypeError("Can't convert object to primitive value");
  27148. }
  27149. if (pref === undefined) pref = 'number';
  27150. return ordinaryToPrimitive(input, pref);
  27151. };
  27152. },{"../internals/function-call":326,"../internals/get-method":333,"../internals/is-object":353,"../internals/is-symbol":356,"../internals/ordinary-to-primitive":389,"../internals/well-known-symbol":430}],419:[function(_dereq_,module,exports){
  27153. var toPrimitive = _dereq_('../internals/to-primitive');
  27154. var isSymbol = _dereq_('../internals/is-symbol');
  27155. // `ToPropertyKey` abstract operation
  27156. // https://tc39.es/ecma262/#sec-topropertykey
  27157. module.exports = function (argument) {
  27158. var key = toPrimitive(argument, 'string');
  27159. return isSymbol(key) ? key : key + '';
  27160. };
  27161. },{"../internals/is-symbol":356,"../internals/to-primitive":418}],420:[function(_dereq_,module,exports){
  27162. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  27163. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  27164. var test = {};
  27165. test[TO_STRING_TAG] = 'z';
  27166. module.exports = String(test) === '[object z]';
  27167. },{"../internals/well-known-symbol":430}],421:[function(_dereq_,module,exports){
  27168. var classof = _dereq_('../internals/classof');
  27169. var $String = String;
  27170. module.exports = function (argument) {
  27171. if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  27172. return $String(argument);
  27173. };
  27174. },{"../internals/classof":282}],422:[function(_dereq_,module,exports){
  27175. var $String = String;
  27176. module.exports = function (argument) {
  27177. try {
  27178. return $String(argument);
  27179. } catch (error) {
  27180. return 'Object';
  27181. }
  27182. };
  27183. },{}],423:[function(_dereq_,module,exports){
  27184. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  27185. var id = 0;
  27186. var postfix = Math.random();
  27187. var toString = uncurryThis(1.0.toString);
  27188. module.exports = function (key) {
  27189. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  27190. };
  27191. },{"../internals/function-uncurry-this":328}],424:[function(_dereq_,module,exports){
  27192. /* eslint-disable es-x/no-symbol -- required for testing */
  27193. var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
  27194. module.exports = NATIVE_SYMBOL
  27195. && !Symbol.sham
  27196. && typeof Symbol.iterator == 'symbol';
  27197. },{"../internals/symbol-constructor-detection":409}],425:[function(_dereq_,module,exports){
  27198. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27199. var fails = _dereq_('../internals/fails');
  27200. // V8 ~ Chrome 36-
  27201. // https://bugs.chromium.org/p/v8/issues/detail?id=3334
  27202. module.exports = DESCRIPTORS && fails(function () {
  27203. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  27204. return Object.defineProperty(function () { /* empty */ }, 'prototype', {
  27205. value: 42,
  27206. writable: false
  27207. }).prototype != 42;
  27208. });
  27209. },{"../internals/descriptors":300,"../internals/fails":320}],426:[function(_dereq_,module,exports){
  27210. var $TypeError = TypeError;
  27211. module.exports = function (passed, required) {
  27212. if (passed < required) throw $TypeError('Not enough arguments');
  27213. return passed;
  27214. };
  27215. },{}],427:[function(_dereq_,module,exports){
  27216. var global = _dereq_('../internals/global');
  27217. var isCallable = _dereq_('../internals/is-callable');
  27218. var WeakMap = global.WeakMap;
  27219. module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
  27220. },{"../internals/global":334,"../internals/is-callable":347}],428:[function(_dereq_,module,exports){
  27221. var path = _dereq_('../internals/path');
  27222. var hasOwn = _dereq_('../internals/has-own-property');
  27223. var wrappedWellKnownSymbolModule = _dereq_('../internals/well-known-symbol-wrapped');
  27224. var defineProperty = _dereq_('../internals/object-define-property').f;
  27225. module.exports = function (NAME) {
  27226. var Symbol = path.Symbol || (path.Symbol = {});
  27227. if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
  27228. value: wrappedWellKnownSymbolModule.f(NAME)
  27229. });
  27230. };
  27231. },{"../internals/has-own-property":335,"../internals/object-define-property":375,"../internals/path":391,"../internals/well-known-symbol-wrapped":429}],429:[function(_dereq_,module,exports){
  27232. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  27233. exports.f = wellKnownSymbol;
  27234. },{"../internals/well-known-symbol":430}],430:[function(_dereq_,module,exports){
  27235. var global = _dereq_('../internals/global');
  27236. var shared = _dereq_('../internals/shared');
  27237. var hasOwn = _dereq_('../internals/has-own-property');
  27238. var uid = _dereq_('../internals/uid');
  27239. var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
  27240. var USE_SYMBOL_AS_UID = _dereq_('../internals/use-symbol-as-uid');
  27241. var WellKnownSymbolsStore = shared('wks');
  27242. var Symbol = global.Symbol;
  27243. var symbolFor = Symbol && Symbol['for'];
  27244. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  27245. module.exports = function (name) {
  27246. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  27247. var description = 'Symbol.' + name;
  27248. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  27249. WellKnownSymbolsStore[name] = Symbol[name];
  27250. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  27251. WellKnownSymbolsStore[name] = symbolFor(description);
  27252. } else {
  27253. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  27254. }
  27255. } return WellKnownSymbolsStore[name];
  27256. };
  27257. },{"../internals/global":334,"../internals/has-own-property":335,"../internals/shared":405,"../internals/symbol-constructor-detection":409,"../internals/uid":423,"../internals/use-symbol-as-uid":424}],431:[function(_dereq_,module,exports){
  27258. // a string of all valid unicode whitespaces
  27259. module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  27260. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  27261. },{}],432:[function(_dereq_,module,exports){
  27262. 'use strict';
  27263. var $ = _dereq_('../internals/export');
  27264. var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
  27265. var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
  27266. var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
  27267. var copyConstructorProperties = _dereq_('../internals/copy-constructor-properties');
  27268. var create = _dereq_('../internals/object-create');
  27269. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  27270. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  27271. var clearErrorStack = _dereq_('../internals/error-stack-clear');
  27272. var installErrorCause = _dereq_('../internals/install-error-cause');
  27273. var iterate = _dereq_('../internals/iterate');
  27274. var normalizeStringArgument = _dereq_('../internals/normalize-string-argument');
  27275. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  27276. var ERROR_STACK_INSTALLABLE = _dereq_('../internals/error-stack-installable');
  27277. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  27278. var $Error = Error;
  27279. var push = [].push;
  27280. var $AggregateError = function AggregateError(errors, message /* , options */) {
  27281. var options = arguments.length > 2 ? arguments[2] : undefined;
  27282. var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
  27283. var that;
  27284. if (setPrototypeOf) {
  27285. that = setPrototypeOf($Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
  27286. } else {
  27287. that = isInstance ? this : create(AggregateErrorPrototype);
  27288. createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
  27289. }
  27290. if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
  27291. if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
  27292. installErrorCause(that, options);
  27293. var errorsArray = [];
  27294. iterate(errors, push, { that: errorsArray });
  27295. createNonEnumerableProperty(that, 'errors', errorsArray);
  27296. return that;
  27297. };
  27298. if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
  27299. else copyConstructorProperties($AggregateError, $Error, { name: true });
  27300. var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
  27301. constructor: createPropertyDescriptor(1, $AggregateError),
  27302. message: createPropertyDescriptor(1, ''),
  27303. name: createPropertyDescriptor(1, 'AggregateError')
  27304. });
  27305. // `AggregateError` constructor
  27306. // https://tc39.es/ecma262/#sec-aggregate-error-constructor
  27307. $({ global: true, constructor: true, arity: 2 }, {
  27308. AggregateError: $AggregateError
  27309. });
  27310. },{"../internals/copy-constructor-properties":289,"../internals/create-non-enumerable-property":293,"../internals/create-property-descriptor":294,"../internals/error-stack-clear":317,"../internals/error-stack-installable":318,"../internals/export":319,"../internals/install-error-cause":342,"../internals/iterate":357,"../internals/normalize-string-argument":369,"../internals/object-create":373,"../internals/object-get-prototype-of":380,"../internals/object-is-prototype-of":382,"../internals/object-set-prototype-of":386,"../internals/well-known-symbol":430}],433:[function(_dereq_,module,exports){
  27311. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  27312. _dereq_('../modules/es.aggregate-error.constructor');
  27313. },{"../modules/es.aggregate-error.constructor":432}],434:[function(_dereq_,module,exports){
  27314. 'use strict';
  27315. var $ = _dereq_('../internals/export');
  27316. var fails = _dereq_('../internals/fails');
  27317. var isArray = _dereq_('../internals/is-array');
  27318. var isObject = _dereq_('../internals/is-object');
  27319. var toObject = _dereq_('../internals/to-object');
  27320. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  27321. var doesNotExceedSafeInteger = _dereq_('../internals/does-not-exceed-safe-integer');
  27322. var createProperty = _dereq_('../internals/create-property');
  27323. var arraySpeciesCreate = _dereq_('../internals/array-species-create');
  27324. var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
  27325. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  27326. var V8_VERSION = _dereq_('../internals/engine-v8-version');
  27327. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  27328. // We can't use this feature detection in V8 since it causes
  27329. // deoptimization and serious performance degradation
  27330. // https://github.com/zloirock/core-js/issues/679
  27331. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  27332. var array = [];
  27333. array[IS_CONCAT_SPREADABLE] = false;
  27334. return array.concat()[0] !== array;
  27335. });
  27336. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  27337. var isConcatSpreadable = function (O) {
  27338. if (!isObject(O)) return false;
  27339. var spreadable = O[IS_CONCAT_SPREADABLE];
  27340. return spreadable !== undefined ? !!spreadable : isArray(O);
  27341. };
  27342. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  27343. // `Array.prototype.concat` method
  27344. // https://tc39.es/ecma262/#sec-array.prototype.concat
  27345. // with adding support of @@isConcatSpreadable and @@species
  27346. $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
  27347. // eslint-disable-next-line no-unused-vars -- required for `.length`
  27348. concat: function concat(arg) {
  27349. var O = toObject(this);
  27350. var A = arraySpeciesCreate(O, 0);
  27351. var n = 0;
  27352. var i, k, length, len, E;
  27353. for (i = -1, length = arguments.length; i < length; i++) {
  27354. E = i === -1 ? O : arguments[i];
  27355. if (isConcatSpreadable(E)) {
  27356. len = lengthOfArrayLike(E);
  27357. doesNotExceedSafeInteger(n + len);
  27358. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  27359. } else {
  27360. doesNotExceedSafeInteger(n + 1);
  27361. createProperty(A, n++, E);
  27362. }
  27363. }
  27364. A.length = n;
  27365. return A;
  27366. }
  27367. });
  27368. },{"../internals/array-method-has-species-support":270,"../internals/array-species-create":278,"../internals/create-property":295,"../internals/does-not-exceed-safe-integer":302,"../internals/engine-v8-version":313,"../internals/export":319,"../internals/fails":320,"../internals/is-array":346,"../internals/is-object":353,"../internals/length-of-array-like":363,"../internals/to-object":417,"../internals/well-known-symbol":430}],435:[function(_dereq_,module,exports){
  27369. 'use strict';
  27370. var $ = _dereq_('../internals/export');
  27371. var $every = _dereq_('../internals/array-iteration').every;
  27372. var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
  27373. var STRICT_METHOD = arrayMethodIsStrict('every');
  27374. // `Array.prototype.every` method
  27375. // https://tc39.es/ecma262/#sec-array.prototype.every
  27376. $({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
  27377. every: function every(callbackfn /* , thisArg */) {
  27378. return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  27379. }
  27380. });
  27381. },{"../internals/array-iteration":269,"../internals/array-method-is-strict":271,"../internals/export":319}],436:[function(_dereq_,module,exports){
  27382. 'use strict';
  27383. var $ = _dereq_('../internals/export');
  27384. var $filter = _dereq_('../internals/array-iteration').filter;
  27385. var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
  27386. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  27387. // `Array.prototype.filter` method
  27388. // https://tc39.es/ecma262/#sec-array.prototype.filter
  27389. // with adding support of @@species
  27390. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  27391. filter: function filter(callbackfn /* , thisArg */) {
  27392. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  27393. }
  27394. });
  27395. },{"../internals/array-iteration":269,"../internals/array-method-has-species-support":270,"../internals/export":319}],437:[function(_dereq_,module,exports){
  27396. 'use strict';
  27397. var $ = _dereq_('../internals/export');
  27398. var $findIndex = _dereq_('../internals/array-iteration').findIndex;
  27399. var addToUnscopables = _dereq_('../internals/add-to-unscopables');
  27400. var FIND_INDEX = 'findIndex';
  27401. var SKIPS_HOLES = true;
  27402. // Shouldn't skip holes
  27403. if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
  27404. // `Array.prototype.findIndex` method
  27405. // https://tc39.es/ecma262/#sec-array.prototype.findindex
  27406. $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  27407. findIndex: function findIndex(callbackfn /* , that = undefined */) {
  27408. return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  27409. }
  27410. });
  27411. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  27412. addToUnscopables(FIND_INDEX);
  27413. },{"../internals/add-to-unscopables":262,"../internals/array-iteration":269,"../internals/export":319}],438:[function(_dereq_,module,exports){
  27414. 'use strict';
  27415. var $ = _dereq_('../internals/export');
  27416. var $find = _dereq_('../internals/array-iteration').find;
  27417. var addToUnscopables = _dereq_('../internals/add-to-unscopables');
  27418. var FIND = 'find';
  27419. var SKIPS_HOLES = true;
  27420. // Shouldn't skip holes
  27421. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  27422. // `Array.prototype.find` method
  27423. // https://tc39.es/ecma262/#sec-array.prototype.find
  27424. $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  27425. find: function find(callbackfn /* , that = undefined */) {
  27426. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  27427. }
  27428. });
  27429. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  27430. addToUnscopables(FIND);
  27431. },{"../internals/add-to-unscopables":262,"../internals/array-iteration":269,"../internals/export":319}],439:[function(_dereq_,module,exports){
  27432. 'use strict';
  27433. var $ = _dereq_('../internals/export');
  27434. var forEach = _dereq_('../internals/array-for-each');
  27435. // `Array.prototype.forEach` method
  27436. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  27437. // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
  27438. $({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
  27439. forEach: forEach
  27440. });
  27441. },{"../internals/array-for-each":266,"../internals/export":319}],440:[function(_dereq_,module,exports){
  27442. var $ = _dereq_('../internals/export');
  27443. var from = _dereq_('../internals/array-from');
  27444. var checkCorrectnessOfIteration = _dereq_('../internals/check-correctness-of-iteration');
  27445. var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
  27446. // eslint-disable-next-line es-x/no-array-from -- required for testing
  27447. Array.from(iterable);
  27448. });
  27449. // `Array.from` method
  27450. // https://tc39.es/ecma262/#sec-array.from
  27451. $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
  27452. from: from
  27453. });
  27454. },{"../internals/array-from":267,"../internals/check-correctness-of-iteration":280,"../internals/export":319}],441:[function(_dereq_,module,exports){
  27455. 'use strict';
  27456. var $ = _dereq_('../internals/export');
  27457. var $includes = _dereq_('../internals/array-includes').includes;
  27458. var fails = _dereq_('../internals/fails');
  27459. var addToUnscopables = _dereq_('../internals/add-to-unscopables');
  27460. // FF99+ bug
  27461. var BROKEN_ON_SPARSE = fails(function () {
  27462. return !Array(1).includes();
  27463. });
  27464. // `Array.prototype.includes` method
  27465. // https://tc39.es/ecma262/#sec-array.prototype.includes
  27466. $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
  27467. includes: function includes(el /* , fromIndex = 0 */) {
  27468. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  27469. }
  27470. });
  27471. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  27472. addToUnscopables('includes');
  27473. },{"../internals/add-to-unscopables":262,"../internals/array-includes":268,"../internals/export":319,"../internals/fails":320}],442:[function(_dereq_,module,exports){
  27474. 'use strict';
  27475. /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
  27476. var $ = _dereq_('../internals/export');
  27477. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  27478. var $indexOf = _dereq_('../internals/array-includes').indexOf;
  27479. var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
  27480. var nativeIndexOf = uncurryThis([].indexOf);
  27481. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;
  27482. var STRICT_METHOD = arrayMethodIsStrict('indexOf');
  27483. // `Array.prototype.indexOf` method
  27484. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  27485. $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
  27486. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  27487. var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  27488. return NEGATIVE_ZERO
  27489. // convert -0 to +0
  27490. ? nativeIndexOf(this, searchElement, fromIndex) || 0
  27491. : $indexOf(this, searchElement, fromIndex);
  27492. }
  27493. });
  27494. },{"../internals/array-includes":268,"../internals/array-method-is-strict":271,"../internals/export":319,"../internals/function-uncurry-this":328}],443:[function(_dereq_,module,exports){
  27495. var $ = _dereq_('../internals/export');
  27496. var isArray = _dereq_('../internals/is-array');
  27497. // `Array.isArray` method
  27498. // https://tc39.es/ecma262/#sec-array.isarray
  27499. $({ target: 'Array', stat: true }, {
  27500. isArray: isArray
  27501. });
  27502. },{"../internals/export":319,"../internals/is-array":346}],444:[function(_dereq_,module,exports){
  27503. 'use strict';
  27504. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  27505. var addToUnscopables = _dereq_('../internals/add-to-unscopables');
  27506. var Iterators = _dereq_('../internals/iterators');
  27507. var InternalStateModule = _dereq_('../internals/internal-state');
  27508. var defineProperty = _dereq_('../internals/object-define-property').f;
  27509. var defineIterator = _dereq_('../internals/iterator-define');
  27510. var createIterResultObject = _dereq_('../internals/create-iter-result-object');
  27511. var IS_PURE = _dereq_('../internals/is-pure');
  27512. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27513. var ARRAY_ITERATOR = 'Array Iterator';
  27514. var setInternalState = InternalStateModule.set;
  27515. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  27516. // `Array.prototype.entries` method
  27517. // https://tc39.es/ecma262/#sec-array.prototype.entries
  27518. // `Array.prototype.keys` method
  27519. // https://tc39.es/ecma262/#sec-array.prototype.keys
  27520. // `Array.prototype.values` method
  27521. // https://tc39.es/ecma262/#sec-array.prototype.values
  27522. // `Array.prototype[@@iterator]` method
  27523. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  27524. // `CreateArrayIterator` internal method
  27525. // https://tc39.es/ecma262/#sec-createarrayiterator
  27526. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  27527. setInternalState(this, {
  27528. type: ARRAY_ITERATOR,
  27529. target: toIndexedObject(iterated), // target
  27530. index: 0, // next index
  27531. kind: kind // kind
  27532. });
  27533. // `%ArrayIteratorPrototype%.next` method
  27534. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  27535. }, function () {
  27536. var state = getInternalState(this);
  27537. var target = state.target;
  27538. var kind = state.kind;
  27539. var index = state.index++;
  27540. if (!target || index >= target.length) {
  27541. state.target = undefined;
  27542. return createIterResultObject(undefined, true);
  27543. }
  27544. if (kind == 'keys') return createIterResultObject(index, false);
  27545. if (kind == 'values') return createIterResultObject(target[index], false);
  27546. return createIterResultObject([index, target[index]], false);
  27547. }, 'values');
  27548. // argumentsList[@@iterator] is %ArrayProto_values%
  27549. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  27550. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  27551. var values = Iterators.Arguments = Iterators.Array;
  27552. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  27553. addToUnscopables('keys');
  27554. addToUnscopables('values');
  27555. addToUnscopables('entries');
  27556. // V8 ~ Chrome 45- bug
  27557. if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
  27558. defineProperty(values, 'name', { value: 'values' });
  27559. } catch (error) { /* empty */ }
  27560. },{"../internals/add-to-unscopables":262,"../internals/create-iter-result-object":292,"../internals/descriptors":300,"../internals/internal-state":344,"../internals/is-pure":354,"../internals/iterator-define":360,"../internals/iterators":362,"../internals/object-define-property":375,"../internals/to-indexed-object":414}],445:[function(_dereq_,module,exports){
  27561. 'use strict';
  27562. var $ = _dereq_('../internals/export');
  27563. var $map = _dereq_('../internals/array-iteration').map;
  27564. var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
  27565. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
  27566. // `Array.prototype.map` method
  27567. // https://tc39.es/ecma262/#sec-array.prototype.map
  27568. // with adding support of @@species
  27569. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  27570. map: function map(callbackfn /* , thisArg */) {
  27571. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  27572. }
  27573. });
  27574. },{"../internals/array-iteration":269,"../internals/array-method-has-species-support":270,"../internals/export":319}],446:[function(_dereq_,module,exports){
  27575. 'use strict';
  27576. var $ = _dereq_('../internals/export');
  27577. var $reduce = _dereq_('../internals/array-reduce').left;
  27578. var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
  27579. var CHROME_VERSION = _dereq_('../internals/engine-v8-version');
  27580. var IS_NODE = _dereq_('../internals/engine-is-node');
  27581. var STRICT_METHOD = arrayMethodIsStrict('reduce');
  27582. // Chrome 80-82 has a critical bug
  27583. // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
  27584. var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
  27585. // `Array.prototype.reduce` method
  27586. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  27587. $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
  27588. reduce: function reduce(callbackfn /* , initialValue */) {
  27589. var length = arguments.length;
  27590. return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
  27591. }
  27592. });
  27593. },{"../internals/array-method-is-strict":271,"../internals/array-reduce":272,"../internals/engine-is-node":310,"../internals/engine-v8-version":313,"../internals/export":319}],447:[function(_dereq_,module,exports){
  27594. 'use strict';
  27595. var $ = _dereq_('../internals/export');
  27596. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  27597. var isArray = _dereq_('../internals/is-array');
  27598. var nativeReverse = uncurryThis([].reverse);
  27599. var test = [1, 2];
  27600. // `Array.prototype.reverse` method
  27601. // https://tc39.es/ecma262/#sec-array.prototype.reverse
  27602. // fix for Safari 12.0 bug
  27603. // https://bugs.webkit.org/show_bug.cgi?id=188794
  27604. $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
  27605. reverse: function reverse() {
  27606. // eslint-disable-next-line no-self-assign -- dirty hack
  27607. if (isArray(this)) this.length = this.length;
  27608. return nativeReverse(this);
  27609. }
  27610. });
  27611. },{"../internals/export":319,"../internals/function-uncurry-this":328,"../internals/is-array":346}],448:[function(_dereq_,module,exports){
  27612. 'use strict';
  27613. var $ = _dereq_('../internals/export');
  27614. var isArray = _dereq_('../internals/is-array');
  27615. var isConstructor = _dereq_('../internals/is-constructor');
  27616. var isObject = _dereq_('../internals/is-object');
  27617. var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
  27618. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  27619. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  27620. var createProperty = _dereq_('../internals/create-property');
  27621. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  27622. var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
  27623. var nativeSlice = _dereq_('../internals/array-slice');
  27624. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
  27625. var SPECIES = wellKnownSymbol('species');
  27626. var $Array = Array;
  27627. var max = Math.max;
  27628. // `Array.prototype.slice` method
  27629. // https://tc39.es/ecma262/#sec-array.prototype.slice
  27630. // fallback for not array-like ES3 strings and DOM objects
  27631. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  27632. slice: function slice(start, end) {
  27633. var O = toIndexedObject(this);
  27634. var length = lengthOfArrayLike(O);
  27635. var k = toAbsoluteIndex(start, length);
  27636. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  27637. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  27638. var Constructor, result, n;
  27639. if (isArray(O)) {
  27640. Constructor = O.constructor;
  27641. // cross-realm fallback
  27642. if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
  27643. Constructor = undefined;
  27644. } else if (isObject(Constructor)) {
  27645. Constructor = Constructor[SPECIES];
  27646. if (Constructor === null) Constructor = undefined;
  27647. }
  27648. if (Constructor === $Array || Constructor === undefined) {
  27649. return nativeSlice(O, k, fin);
  27650. }
  27651. }
  27652. result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
  27653. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  27654. result.length = n;
  27655. return result;
  27656. }
  27657. });
  27658. },{"../internals/array-method-has-species-support":270,"../internals/array-slice":275,"../internals/create-property":295,"../internals/export":319,"../internals/is-array":346,"../internals/is-constructor":348,"../internals/is-object":353,"../internals/length-of-array-like":363,"../internals/to-absolute-index":413,"../internals/to-indexed-object":414,"../internals/well-known-symbol":430}],449:[function(_dereq_,module,exports){
  27659. 'use strict';
  27660. var $ = _dereq_('../internals/export');
  27661. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  27662. var aCallable = _dereq_('../internals/a-callable');
  27663. var toObject = _dereq_('../internals/to-object');
  27664. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  27665. var deletePropertyOrThrow = _dereq_('../internals/delete-property-or-throw');
  27666. var toString = _dereq_('../internals/to-string');
  27667. var fails = _dereq_('../internals/fails');
  27668. var internalSort = _dereq_('../internals/array-sort');
  27669. var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
  27670. var FF = _dereq_('../internals/engine-ff-version');
  27671. var IE_OR_EDGE = _dereq_('../internals/engine-is-ie-or-edge');
  27672. var V8 = _dereq_('../internals/engine-v8-version');
  27673. var WEBKIT = _dereq_('../internals/engine-webkit-version');
  27674. var test = [];
  27675. var nativeSort = uncurryThis(test.sort);
  27676. var push = uncurryThis(test.push);
  27677. // IE8-
  27678. var FAILS_ON_UNDEFINED = fails(function () {
  27679. test.sort(undefined);
  27680. });
  27681. // V8 bug
  27682. var FAILS_ON_NULL = fails(function () {
  27683. test.sort(null);
  27684. });
  27685. // Old WebKit
  27686. var STRICT_METHOD = arrayMethodIsStrict('sort');
  27687. var STABLE_SORT = !fails(function () {
  27688. // feature detection can be too slow, so check engines versions
  27689. if (V8) return V8 < 70;
  27690. if (FF && FF > 3) return;
  27691. if (IE_OR_EDGE) return true;
  27692. if (WEBKIT) return WEBKIT < 603;
  27693. var result = '';
  27694. var code, chr, value, index;
  27695. // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
  27696. for (code = 65; code < 76; code++) {
  27697. chr = String.fromCharCode(code);
  27698. switch (code) {
  27699. case 66: case 69: case 70: case 72: value = 3; break;
  27700. case 68: case 71: value = 4; break;
  27701. default: value = 2;
  27702. }
  27703. for (index = 0; index < 47; index++) {
  27704. test.push({ k: chr + index, v: value });
  27705. }
  27706. }
  27707. test.sort(function (a, b) { return b.v - a.v; });
  27708. for (index = 0; index < test.length; index++) {
  27709. chr = test[index].k.charAt(0);
  27710. if (result.charAt(result.length - 1) !== chr) result += chr;
  27711. }
  27712. return result !== 'DGBEFHACIJK';
  27713. });
  27714. var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
  27715. var getSortCompare = function (comparefn) {
  27716. return function (x, y) {
  27717. if (y === undefined) return -1;
  27718. if (x === undefined) return 1;
  27719. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  27720. return toString(x) > toString(y) ? 1 : -1;
  27721. };
  27722. };
  27723. // `Array.prototype.sort` method
  27724. // https://tc39.es/ecma262/#sec-array.prototype.sort
  27725. $({ target: 'Array', proto: true, forced: FORCED }, {
  27726. sort: function sort(comparefn) {
  27727. if (comparefn !== undefined) aCallable(comparefn);
  27728. var array = toObject(this);
  27729. if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
  27730. var items = [];
  27731. var arrayLength = lengthOfArrayLike(array);
  27732. var itemsLength, index;
  27733. for (index = 0; index < arrayLength; index++) {
  27734. if (index in array) push(items, array[index]);
  27735. }
  27736. internalSort(items, getSortCompare(comparefn));
  27737. itemsLength = lengthOfArrayLike(items);
  27738. index = 0;
  27739. while (index < itemsLength) array[index] = items[index++];
  27740. while (index < arrayLength) deletePropertyOrThrow(array, index++);
  27741. return array;
  27742. }
  27743. });
  27744. },{"../internals/a-callable":259,"../internals/array-method-is-strict":271,"../internals/array-sort":276,"../internals/delete-property-or-throw":299,"../internals/engine-ff-version":304,"../internals/engine-is-ie-or-edge":307,"../internals/engine-v8-version":313,"../internals/engine-webkit-version":314,"../internals/export":319,"../internals/fails":320,"../internals/function-uncurry-this":328,"../internals/length-of-array-like":363,"../internals/to-object":417,"../internals/to-string":421}],450:[function(_dereq_,module,exports){
  27745. 'use strict';
  27746. var $ = _dereq_('../internals/export');
  27747. var toObject = _dereq_('../internals/to-object');
  27748. var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
  27749. var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
  27750. var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
  27751. var setArrayLength = _dereq_('../internals/array-set-length');
  27752. var doesNotExceedSafeInteger = _dereq_('../internals/does-not-exceed-safe-integer');
  27753. var arraySpeciesCreate = _dereq_('../internals/array-species-create');
  27754. var createProperty = _dereq_('../internals/create-property');
  27755. var deletePropertyOrThrow = _dereq_('../internals/delete-property-or-throw');
  27756. var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
  27757. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  27758. var max = Math.max;
  27759. var min = Math.min;
  27760. // `Array.prototype.splice` method
  27761. // https://tc39.es/ecma262/#sec-array.prototype.splice
  27762. // with adding support of @@species
  27763. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  27764. splice: function splice(start, deleteCount /* , ...items */) {
  27765. var O = toObject(this);
  27766. var len = lengthOfArrayLike(O);
  27767. var actualStart = toAbsoluteIndex(start, len);
  27768. var argumentsLength = arguments.length;
  27769. var insertCount, actualDeleteCount, A, k, from, to;
  27770. if (argumentsLength === 0) {
  27771. insertCount = actualDeleteCount = 0;
  27772. } else if (argumentsLength === 1) {
  27773. insertCount = 0;
  27774. actualDeleteCount = len - actualStart;
  27775. } else {
  27776. insertCount = argumentsLength - 2;
  27777. actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
  27778. }
  27779. doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
  27780. A = arraySpeciesCreate(O, actualDeleteCount);
  27781. for (k = 0; k < actualDeleteCount; k++) {
  27782. from = actualStart + k;
  27783. if (from in O) createProperty(A, k, O[from]);
  27784. }
  27785. A.length = actualDeleteCount;
  27786. if (insertCount < actualDeleteCount) {
  27787. for (k = actualStart; k < len - actualDeleteCount; k++) {
  27788. from = k + actualDeleteCount;
  27789. to = k + insertCount;
  27790. if (from in O) O[to] = O[from];
  27791. else deletePropertyOrThrow(O, to);
  27792. }
  27793. for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow(O, k - 1);
  27794. } else if (insertCount > actualDeleteCount) {
  27795. for (k = len - actualDeleteCount; k > actualStart; k--) {
  27796. from = k + actualDeleteCount - 1;
  27797. to = k + insertCount - 1;
  27798. if (from in O) O[to] = O[from];
  27799. else deletePropertyOrThrow(O, to);
  27800. }
  27801. }
  27802. for (k = 0; k < insertCount; k++) {
  27803. O[k + actualStart] = arguments[k + 2];
  27804. }
  27805. setArrayLength(O, len - actualDeleteCount + insertCount);
  27806. return A;
  27807. }
  27808. });
  27809. },{"../internals/array-method-has-species-support":270,"../internals/array-set-length":273,"../internals/array-species-create":278,"../internals/create-property":295,"../internals/delete-property-or-throw":299,"../internals/does-not-exceed-safe-integer":302,"../internals/export":319,"../internals/length-of-array-like":363,"../internals/to-absolute-index":413,"../internals/to-integer-or-infinity":415,"../internals/to-object":417}],451:[function(_dereq_,module,exports){
  27810. // TODO: Remove from `core-js@4`
  27811. var $ = _dereq_('../internals/export');
  27812. var bind = _dereq_('../internals/function-bind');
  27813. // `Function.prototype.bind` method
  27814. // https://tc39.es/ecma262/#sec-function.prototype.bind
  27815. $({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
  27816. bind: bind
  27817. });
  27818. },{"../internals/export":319,"../internals/function-bind":325}],452:[function(_dereq_,module,exports){
  27819. var $ = _dereq_('../internals/export');
  27820. var getBuiltIn = _dereq_('../internals/get-built-in');
  27821. var apply = _dereq_('../internals/function-apply');
  27822. var call = _dereq_('../internals/function-call');
  27823. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  27824. var fails = _dereq_('../internals/fails');
  27825. var isArray = _dereq_('../internals/is-array');
  27826. var isCallable = _dereq_('../internals/is-callable');
  27827. var isObject = _dereq_('../internals/is-object');
  27828. var isSymbol = _dereq_('../internals/is-symbol');
  27829. var arraySlice = _dereq_('../internals/array-slice');
  27830. var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
  27831. var $stringify = getBuiltIn('JSON', 'stringify');
  27832. var exec = uncurryThis(/./.exec);
  27833. var charAt = uncurryThis(''.charAt);
  27834. var charCodeAt = uncurryThis(''.charCodeAt);
  27835. var replace = uncurryThis(''.replace);
  27836. var numberToString = uncurryThis(1.0.toString);
  27837. var tester = /[\uD800-\uDFFF]/g;
  27838. var low = /^[\uD800-\uDBFF]$/;
  27839. var hi = /^[\uDC00-\uDFFF]$/;
  27840. var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
  27841. var symbol = getBuiltIn('Symbol')();
  27842. // MS Edge converts symbol values to JSON as {}
  27843. return $stringify([symbol]) != '[null]'
  27844. // WebKit converts symbol values to JSON as null
  27845. || $stringify({ a: symbol }) != '{}'
  27846. // V8 throws on boxed symbols
  27847. || $stringify(Object(symbol)) != '{}';
  27848. });
  27849. // https://github.com/tc39/proposal-well-formed-stringify
  27850. var ILL_FORMED_UNICODE = fails(function () {
  27851. return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
  27852. || $stringify('\uDEAD') !== '"\\udead"';
  27853. });
  27854. var stringifyWithSymbolsFix = function (it, replacer) {
  27855. var args = arraySlice(arguments);
  27856. var $replacer = replacer;
  27857. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  27858. if (!isArray(replacer)) replacer = function (key, value) {
  27859. if (isCallable($replacer)) value = call($replacer, this, key, value);
  27860. if (!isSymbol(value)) return value;
  27861. };
  27862. args[1] = replacer;
  27863. return apply($stringify, null, args);
  27864. };
  27865. var fixIllFormed = function (match, offset, string) {
  27866. var prev = charAt(string, offset - 1);
  27867. var next = charAt(string, offset + 1);
  27868. if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
  27869. return '\\u' + numberToString(charCodeAt(match, 0), 16);
  27870. } return match;
  27871. };
  27872. if ($stringify) {
  27873. // `JSON.stringify` method
  27874. // https://tc39.es/ecma262/#sec-json.stringify
  27875. $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
  27876. // eslint-disable-next-line no-unused-vars -- required for `.length`
  27877. stringify: function stringify(it, replacer, space) {
  27878. var args = arraySlice(arguments);
  27879. var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
  27880. return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
  27881. }
  27882. });
  27883. }
  27884. },{"../internals/array-slice":275,"../internals/export":319,"../internals/fails":320,"../internals/function-apply":322,"../internals/function-call":326,"../internals/function-uncurry-this":328,"../internals/get-built-in":329,"../internals/is-array":346,"../internals/is-callable":347,"../internals/is-object":353,"../internals/is-symbol":356,"../internals/symbol-constructor-detection":409}],453:[function(_dereq_,module,exports){
  27885. var global = _dereq_('../internals/global');
  27886. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  27887. // JSON[@@toStringTag] property
  27888. // https://tc39.es/ecma262/#sec-json-@@tostringtag
  27889. setToStringTag(global.JSON, 'JSON', true);
  27890. },{"../internals/global":334,"../internals/set-to-string-tag":402}],454:[function(_dereq_,module,exports){
  27891. 'use strict';
  27892. var collection = _dereq_('../internals/collection');
  27893. var collectionStrong = _dereq_('../internals/collection-strong');
  27894. // `Map` constructor
  27895. // https://tc39.es/ecma262/#sec-map-objects
  27896. collection('Map', function (init) {
  27897. return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
  27898. }, collectionStrong);
  27899. },{"../internals/collection":288,"../internals/collection-strong":286}],455:[function(_dereq_,module,exports){
  27900. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  27901. _dereq_('../modules/es.map.constructor');
  27902. },{"../modules/es.map.constructor":454}],456:[function(_dereq_,module,exports){
  27903. // empty
  27904. },{}],457:[function(_dereq_,module,exports){
  27905. var $ = _dereq_('../internals/export');
  27906. var isIntegralNumber = _dereq_('../internals/is-integral-number');
  27907. // `Number.isInteger` method
  27908. // https://tc39.es/ecma262/#sec-number.isinteger
  27909. $({ target: 'Number', stat: true }, {
  27910. isInteger: isIntegralNumber
  27911. });
  27912. },{"../internals/export":319,"../internals/is-integral-number":351}],458:[function(_dereq_,module,exports){
  27913. var $ = _dereq_('../internals/export');
  27914. var assign = _dereq_('../internals/object-assign');
  27915. // `Object.assign` method
  27916. // https://tc39.es/ecma262/#sec-object.assign
  27917. // eslint-disable-next-line es-x/no-object-assign -- required for testing
  27918. $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
  27919. assign: assign
  27920. });
  27921. },{"../internals/export":319,"../internals/object-assign":372}],459:[function(_dereq_,module,exports){
  27922. // TODO: Remove from `core-js@4`
  27923. var $ = _dereq_('../internals/export');
  27924. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27925. var create = _dereq_('../internals/object-create');
  27926. // `Object.create` method
  27927. // https://tc39.es/ecma262/#sec-object.create
  27928. $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
  27929. create: create
  27930. });
  27931. },{"../internals/descriptors":300,"../internals/export":319,"../internals/object-create":373}],460:[function(_dereq_,module,exports){
  27932. var $ = _dereq_('../internals/export');
  27933. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27934. var defineProperties = _dereq_('../internals/object-define-properties').f;
  27935. // `Object.defineProperties` method
  27936. // https://tc39.es/ecma262/#sec-object.defineproperties
  27937. // eslint-disable-next-line es-x/no-object-defineproperties -- safe
  27938. $({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
  27939. defineProperties: defineProperties
  27940. });
  27941. },{"../internals/descriptors":300,"../internals/export":319,"../internals/object-define-properties":374}],461:[function(_dereq_,module,exports){
  27942. var $ = _dereq_('../internals/export');
  27943. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27944. var defineProperty = _dereq_('../internals/object-define-property').f;
  27945. // `Object.defineProperty` method
  27946. // https://tc39.es/ecma262/#sec-object.defineproperty
  27947. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  27948. $({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
  27949. defineProperty: defineProperty
  27950. });
  27951. },{"../internals/descriptors":300,"../internals/export":319,"../internals/object-define-property":375}],462:[function(_dereq_,module,exports){
  27952. var $ = _dereq_('../internals/export');
  27953. var $entries = _dereq_('../internals/object-to-array').entries;
  27954. // `Object.entries` method
  27955. // https://tc39.es/ecma262/#sec-object.entries
  27956. $({ target: 'Object', stat: true }, {
  27957. entries: function entries(O) {
  27958. return $entries(O);
  27959. }
  27960. });
  27961. },{"../internals/export":319,"../internals/object-to-array":387}],463:[function(_dereq_,module,exports){
  27962. var $ = _dereq_('../internals/export');
  27963. var FREEZING = _dereq_('../internals/freezing');
  27964. var fails = _dereq_('../internals/fails');
  27965. var isObject = _dereq_('../internals/is-object');
  27966. var onFreeze = _dereq_('../internals/internal-metadata').onFreeze;
  27967. // eslint-disable-next-line es-x/no-object-freeze -- safe
  27968. var $freeze = Object.freeze;
  27969. var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
  27970. // `Object.freeze` method
  27971. // https://tc39.es/ecma262/#sec-object.freeze
  27972. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
  27973. freeze: function freeze(it) {
  27974. return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
  27975. }
  27976. });
  27977. },{"../internals/export":319,"../internals/fails":320,"../internals/freezing":321,"../internals/internal-metadata":343,"../internals/is-object":353}],464:[function(_dereq_,module,exports){
  27978. var $ = _dereq_('../internals/export');
  27979. var fails = _dereq_('../internals/fails');
  27980. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  27981. var nativeGetOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
  27982. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27983. var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
  27984. var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
  27985. // `Object.getOwnPropertyDescriptor` method
  27986. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  27987. $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
  27988. getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
  27989. return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
  27990. }
  27991. });
  27992. },{"../internals/descriptors":300,"../internals/export":319,"../internals/fails":320,"../internals/object-get-own-property-descriptor":376,"../internals/to-indexed-object":414}],465:[function(_dereq_,module,exports){
  27993. var $ = _dereq_('../internals/export');
  27994. var DESCRIPTORS = _dereq_('../internals/descriptors');
  27995. var ownKeys = _dereq_('../internals/own-keys');
  27996. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  27997. var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
  27998. var createProperty = _dereq_('../internals/create-property');
  27999. // `Object.getOwnPropertyDescriptors` method
  28000. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  28001. $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
  28002. getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
  28003. var O = toIndexedObject(object);
  28004. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  28005. var keys = ownKeys(O);
  28006. var result = {};
  28007. var index = 0;
  28008. var key, descriptor;
  28009. while (keys.length > index) {
  28010. descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
  28011. if (descriptor !== undefined) createProperty(result, key, descriptor);
  28012. }
  28013. return result;
  28014. }
  28015. });
  28016. },{"../internals/create-property":295,"../internals/descriptors":300,"../internals/export":319,"../internals/object-get-own-property-descriptor":376,"../internals/own-keys":390,"../internals/to-indexed-object":414}],466:[function(_dereq_,module,exports){
  28017. var $ = _dereq_('../internals/export');
  28018. var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
  28019. var fails = _dereq_('../internals/fails');
  28020. var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
  28021. var toObject = _dereq_('../internals/to-object');
  28022. // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  28023. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  28024. var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
  28025. // `Object.getOwnPropertySymbols` method
  28026. // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
  28027. $({ target: 'Object', stat: true, forced: FORCED }, {
  28028. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  28029. var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  28030. return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
  28031. }
  28032. });
  28033. },{"../internals/export":319,"../internals/fails":320,"../internals/object-get-own-property-symbols":379,"../internals/symbol-constructor-detection":409,"../internals/to-object":417}],467:[function(_dereq_,module,exports){
  28034. var $ = _dereq_('../internals/export');
  28035. var fails = _dereq_('../internals/fails');
  28036. var toObject = _dereq_('../internals/to-object');
  28037. var nativeGetPrototypeOf = _dereq_('../internals/object-get-prototype-of');
  28038. var CORRECT_PROTOTYPE_GETTER = _dereq_('../internals/correct-prototype-getter');
  28039. var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
  28040. // `Object.getPrototypeOf` method
  28041. // https://tc39.es/ecma262/#sec-object.getprototypeof
  28042. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
  28043. getPrototypeOf: function getPrototypeOf(it) {
  28044. return nativeGetPrototypeOf(toObject(it));
  28045. }
  28046. });
  28047. },{"../internals/correct-prototype-getter":291,"../internals/export":319,"../internals/fails":320,"../internals/object-get-prototype-of":380,"../internals/to-object":417}],468:[function(_dereq_,module,exports){
  28048. var $ = _dereq_('../internals/export');
  28049. var toObject = _dereq_('../internals/to-object');
  28050. var nativeKeys = _dereq_('../internals/object-keys');
  28051. var fails = _dereq_('../internals/fails');
  28052. var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
  28053. // `Object.keys` method
  28054. // https://tc39.es/ecma262/#sec-object.keys
  28055. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  28056. keys: function keys(it) {
  28057. return nativeKeys(toObject(it));
  28058. }
  28059. });
  28060. },{"../internals/export":319,"../internals/fails":320,"../internals/object-keys":384,"../internals/to-object":417}],469:[function(_dereq_,module,exports){
  28061. var $ = _dereq_('../internals/export');
  28062. var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
  28063. // `Object.setPrototypeOf` method
  28064. // https://tc39.es/ecma262/#sec-object.setprototypeof
  28065. $({ target: 'Object', stat: true }, {
  28066. setPrototypeOf: setPrototypeOf
  28067. });
  28068. },{"../internals/export":319,"../internals/object-set-prototype-of":386}],470:[function(_dereq_,module,exports){
  28069. arguments[4][456][0].apply(exports,arguments)
  28070. },{"dup":456}],471:[function(_dereq_,module,exports){
  28071. var $ = _dereq_('../internals/export');
  28072. var $parseInt = _dereq_('../internals/number-parse-int');
  28073. // `parseInt` method
  28074. // https://tc39.es/ecma262/#sec-parseint-string-radix
  28075. $({ global: true, forced: parseInt != $parseInt }, {
  28076. parseInt: $parseInt
  28077. });
  28078. },{"../internals/export":319,"../internals/number-parse-int":371}],472:[function(_dereq_,module,exports){
  28079. 'use strict';
  28080. var $ = _dereq_('../internals/export');
  28081. var call = _dereq_('../internals/function-call');
  28082. var aCallable = _dereq_('../internals/a-callable');
  28083. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  28084. var perform = _dereq_('../internals/perform');
  28085. var iterate = _dereq_('../internals/iterate');
  28086. // `Promise.allSettled` method
  28087. // https://tc39.es/ecma262/#sec-promise.allsettled
  28088. $({ target: 'Promise', stat: true }, {
  28089. allSettled: function allSettled(iterable) {
  28090. var C = this;
  28091. var capability = newPromiseCapabilityModule.f(C);
  28092. var resolve = capability.resolve;
  28093. var reject = capability.reject;
  28094. var result = perform(function () {
  28095. var promiseResolve = aCallable(C.resolve);
  28096. var values = [];
  28097. var counter = 0;
  28098. var remaining = 1;
  28099. iterate(iterable, function (promise) {
  28100. var index = counter++;
  28101. var alreadyCalled = false;
  28102. remaining++;
  28103. call(promiseResolve, C, promise).then(function (value) {
  28104. if (alreadyCalled) return;
  28105. alreadyCalled = true;
  28106. values[index] = { status: 'fulfilled', value: value };
  28107. --remaining || resolve(values);
  28108. }, function (error) {
  28109. if (alreadyCalled) return;
  28110. alreadyCalled = true;
  28111. values[index] = { status: 'rejected', reason: error };
  28112. --remaining || resolve(values);
  28113. });
  28114. });
  28115. --remaining || resolve(values);
  28116. });
  28117. if (result.error) reject(result.value);
  28118. return capability.promise;
  28119. }
  28120. });
  28121. },{"../internals/a-callable":259,"../internals/export":319,"../internals/function-call":326,"../internals/iterate":357,"../internals/new-promise-capability":368,"../internals/perform":392}],473:[function(_dereq_,module,exports){
  28122. 'use strict';
  28123. var $ = _dereq_('../internals/export');
  28124. var call = _dereq_('../internals/function-call');
  28125. var aCallable = _dereq_('../internals/a-callable');
  28126. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  28127. var perform = _dereq_('../internals/perform');
  28128. var iterate = _dereq_('../internals/iterate');
  28129. var PROMISE_STATICS_INCORRECT_ITERATION = _dereq_('../internals/promise-statics-incorrect-iteration');
  28130. // `Promise.all` method
  28131. // https://tc39.es/ecma262/#sec-promise.all
  28132. $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
  28133. all: function all(iterable) {
  28134. var C = this;
  28135. var capability = newPromiseCapabilityModule.f(C);
  28136. var resolve = capability.resolve;
  28137. var reject = capability.reject;
  28138. var result = perform(function () {
  28139. var $promiseResolve = aCallable(C.resolve);
  28140. var values = [];
  28141. var counter = 0;
  28142. var remaining = 1;
  28143. iterate(iterable, function (promise) {
  28144. var index = counter++;
  28145. var alreadyCalled = false;
  28146. remaining++;
  28147. call($promiseResolve, C, promise).then(function (value) {
  28148. if (alreadyCalled) return;
  28149. alreadyCalled = true;
  28150. values[index] = value;
  28151. --remaining || resolve(values);
  28152. }, reject);
  28153. });
  28154. --remaining || resolve(values);
  28155. });
  28156. if (result.error) reject(result.value);
  28157. return capability.promise;
  28158. }
  28159. });
  28160. },{"../internals/a-callable":259,"../internals/export":319,"../internals/function-call":326,"../internals/iterate":357,"../internals/new-promise-capability":368,"../internals/perform":392,"../internals/promise-statics-incorrect-iteration":396}],474:[function(_dereq_,module,exports){
  28161. 'use strict';
  28162. var $ = _dereq_('../internals/export');
  28163. var call = _dereq_('../internals/function-call');
  28164. var aCallable = _dereq_('../internals/a-callable');
  28165. var getBuiltIn = _dereq_('../internals/get-built-in');
  28166. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  28167. var perform = _dereq_('../internals/perform');
  28168. var iterate = _dereq_('../internals/iterate');
  28169. var PROMISE_ANY_ERROR = 'No one promise resolved';
  28170. // `Promise.any` method
  28171. // https://tc39.es/ecma262/#sec-promise.any
  28172. $({ target: 'Promise', stat: true }, {
  28173. any: function any(iterable) {
  28174. var C = this;
  28175. var AggregateError = getBuiltIn('AggregateError');
  28176. var capability = newPromiseCapabilityModule.f(C);
  28177. var resolve = capability.resolve;
  28178. var reject = capability.reject;
  28179. var result = perform(function () {
  28180. var promiseResolve = aCallable(C.resolve);
  28181. var errors = [];
  28182. var counter = 0;
  28183. var remaining = 1;
  28184. var alreadyResolved = false;
  28185. iterate(iterable, function (promise) {
  28186. var index = counter++;
  28187. var alreadyRejected = false;
  28188. remaining++;
  28189. call(promiseResolve, C, promise).then(function (value) {
  28190. if (alreadyRejected || alreadyResolved) return;
  28191. alreadyResolved = true;
  28192. resolve(value);
  28193. }, function (error) {
  28194. if (alreadyRejected || alreadyResolved) return;
  28195. alreadyRejected = true;
  28196. errors[index] = error;
  28197. --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
  28198. });
  28199. });
  28200. --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
  28201. });
  28202. if (result.error) reject(result.value);
  28203. return capability.promise;
  28204. }
  28205. });
  28206. },{"../internals/a-callable":259,"../internals/export":319,"../internals/function-call":326,"../internals/get-built-in":329,"../internals/iterate":357,"../internals/new-promise-capability":368,"../internals/perform":392}],475:[function(_dereq_,module,exports){
  28207. 'use strict';
  28208. var $ = _dereq_('../internals/export');
  28209. var IS_PURE = _dereq_('../internals/is-pure');
  28210. var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
  28211. var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
  28212. var getBuiltIn = _dereq_('../internals/get-built-in');
  28213. var isCallable = _dereq_('../internals/is-callable');
  28214. var defineBuiltIn = _dereq_('../internals/define-built-in');
  28215. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  28216. // `Promise.prototype.catch` method
  28217. // https://tc39.es/ecma262/#sec-promise.prototype.catch
  28218. $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
  28219. 'catch': function (onRejected) {
  28220. return this.then(undefined, onRejected);
  28221. }
  28222. });
  28223. // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
  28224. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  28225. var method = getBuiltIn('Promise').prototype['catch'];
  28226. if (NativePromisePrototype['catch'] !== method) {
  28227. defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
  28228. }
  28229. }
  28230. },{"../internals/define-built-in":296,"../internals/export":319,"../internals/get-built-in":329,"../internals/is-callable":347,"../internals/is-pure":354,"../internals/promise-constructor-detection":393,"../internals/promise-native-constructor":394}],476:[function(_dereq_,module,exports){
  28231. 'use strict';
  28232. var $ = _dereq_('../internals/export');
  28233. var IS_PURE = _dereq_('../internals/is-pure');
  28234. var IS_NODE = _dereq_('../internals/engine-is-node');
  28235. var global = _dereq_('../internals/global');
  28236. var call = _dereq_('../internals/function-call');
  28237. var defineBuiltIn = _dereq_('../internals/define-built-in');
  28238. var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
  28239. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  28240. var setSpecies = _dereq_('../internals/set-species');
  28241. var aCallable = _dereq_('../internals/a-callable');
  28242. var isCallable = _dereq_('../internals/is-callable');
  28243. var isObject = _dereq_('../internals/is-object');
  28244. var anInstance = _dereq_('../internals/an-instance');
  28245. var speciesConstructor = _dereq_('../internals/species-constructor');
  28246. var task = _dereq_('../internals/task').set;
  28247. var microtask = _dereq_('../internals/microtask');
  28248. var hostReportErrors = _dereq_('../internals/host-report-errors');
  28249. var perform = _dereq_('../internals/perform');
  28250. var Queue = _dereq_('../internals/queue');
  28251. var InternalStateModule = _dereq_('../internals/internal-state');
  28252. var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
  28253. var PromiseConstructorDetection = _dereq_('../internals/promise-constructor-detection');
  28254. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  28255. var PROMISE = 'Promise';
  28256. var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
  28257. var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
  28258. var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
  28259. var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
  28260. var setInternalState = InternalStateModule.set;
  28261. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  28262. var PromiseConstructor = NativePromiseConstructor;
  28263. var PromisePrototype = NativePromisePrototype;
  28264. var TypeError = global.TypeError;
  28265. var document = global.document;
  28266. var process = global.process;
  28267. var newPromiseCapability = newPromiseCapabilityModule.f;
  28268. var newGenericPromiseCapability = newPromiseCapability;
  28269. var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
  28270. var UNHANDLED_REJECTION = 'unhandledrejection';
  28271. var REJECTION_HANDLED = 'rejectionhandled';
  28272. var PENDING = 0;
  28273. var FULFILLED = 1;
  28274. var REJECTED = 2;
  28275. var HANDLED = 1;
  28276. var UNHANDLED = 2;
  28277. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  28278. // helpers
  28279. var isThenable = function (it) {
  28280. var then;
  28281. return isObject(it) && isCallable(then = it.then) ? then : false;
  28282. };
  28283. var callReaction = function (reaction, state) {
  28284. var value = state.value;
  28285. var ok = state.state == FULFILLED;
  28286. var handler = ok ? reaction.ok : reaction.fail;
  28287. var resolve = reaction.resolve;
  28288. var reject = reaction.reject;
  28289. var domain = reaction.domain;
  28290. var result, then, exited;
  28291. try {
  28292. if (handler) {
  28293. if (!ok) {
  28294. if (state.rejection === UNHANDLED) onHandleUnhandled(state);
  28295. state.rejection = HANDLED;
  28296. }
  28297. if (handler === true) result = value;
  28298. else {
  28299. if (domain) domain.enter();
  28300. result = handler(value); // can throw
  28301. if (domain) {
  28302. domain.exit();
  28303. exited = true;
  28304. }
  28305. }
  28306. if (result === reaction.promise) {
  28307. reject(TypeError('Promise-chain cycle'));
  28308. } else if (then = isThenable(result)) {
  28309. call(then, result, resolve, reject);
  28310. } else resolve(result);
  28311. } else reject(value);
  28312. } catch (error) {
  28313. if (domain && !exited) domain.exit();
  28314. reject(error);
  28315. }
  28316. };
  28317. var notify = function (state, isReject) {
  28318. if (state.notified) return;
  28319. state.notified = true;
  28320. microtask(function () {
  28321. var reactions = state.reactions;
  28322. var reaction;
  28323. while (reaction = reactions.get()) {
  28324. callReaction(reaction, state);
  28325. }
  28326. state.notified = false;
  28327. if (isReject && !state.rejection) onUnhandled(state);
  28328. });
  28329. };
  28330. var dispatchEvent = function (name, promise, reason) {
  28331. var event, handler;
  28332. if (DISPATCH_EVENT) {
  28333. event = document.createEvent('Event');
  28334. event.promise = promise;
  28335. event.reason = reason;
  28336. event.initEvent(name, false, true);
  28337. global.dispatchEvent(event);
  28338. } else event = { promise: promise, reason: reason };
  28339. if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
  28340. else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
  28341. };
  28342. var onUnhandled = function (state) {
  28343. call(task, global, function () {
  28344. var promise = state.facade;
  28345. var value = state.value;
  28346. var IS_UNHANDLED = isUnhandled(state);
  28347. var result;
  28348. if (IS_UNHANDLED) {
  28349. result = perform(function () {
  28350. if (IS_NODE) {
  28351. process.emit('unhandledRejection', value, promise);
  28352. } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
  28353. });
  28354. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  28355. state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
  28356. if (result.error) throw result.value;
  28357. }
  28358. });
  28359. };
  28360. var isUnhandled = function (state) {
  28361. return state.rejection !== HANDLED && !state.parent;
  28362. };
  28363. var onHandleUnhandled = function (state) {
  28364. call(task, global, function () {
  28365. var promise = state.facade;
  28366. if (IS_NODE) {
  28367. process.emit('rejectionHandled', promise);
  28368. } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  28369. });
  28370. };
  28371. var bind = function (fn, state, unwrap) {
  28372. return function (value) {
  28373. fn(state, value, unwrap);
  28374. };
  28375. };
  28376. var internalReject = function (state, value, unwrap) {
  28377. if (state.done) return;
  28378. state.done = true;
  28379. if (unwrap) state = unwrap;
  28380. state.value = value;
  28381. state.state = REJECTED;
  28382. notify(state, true);
  28383. };
  28384. var internalResolve = function (state, value, unwrap) {
  28385. if (state.done) return;
  28386. state.done = true;
  28387. if (unwrap) state = unwrap;
  28388. try {
  28389. if (state.facade === value) throw TypeError("Promise can't be resolved itself");
  28390. var then = isThenable(value);
  28391. if (then) {
  28392. microtask(function () {
  28393. var wrapper = { done: false };
  28394. try {
  28395. call(then, value,
  28396. bind(internalResolve, wrapper, state),
  28397. bind(internalReject, wrapper, state)
  28398. );
  28399. } catch (error) {
  28400. internalReject(wrapper, error, state);
  28401. }
  28402. });
  28403. } else {
  28404. state.value = value;
  28405. state.state = FULFILLED;
  28406. notify(state, false);
  28407. }
  28408. } catch (error) {
  28409. internalReject({ done: false }, error, state);
  28410. }
  28411. };
  28412. // constructor polyfill
  28413. if (FORCED_PROMISE_CONSTRUCTOR) {
  28414. // 25.4.3.1 Promise(executor)
  28415. PromiseConstructor = function Promise(executor) {
  28416. anInstance(this, PromisePrototype);
  28417. aCallable(executor);
  28418. call(Internal, this);
  28419. var state = getInternalPromiseState(this);
  28420. try {
  28421. executor(bind(internalResolve, state), bind(internalReject, state));
  28422. } catch (error) {
  28423. internalReject(state, error);
  28424. }
  28425. };
  28426. PromisePrototype = PromiseConstructor.prototype;
  28427. // eslint-disable-next-line no-unused-vars -- required for `.length`
  28428. Internal = function Promise(executor) {
  28429. setInternalState(this, {
  28430. type: PROMISE,
  28431. done: false,
  28432. notified: false,
  28433. parent: false,
  28434. reactions: new Queue(),
  28435. rejection: false,
  28436. state: PENDING,
  28437. value: undefined
  28438. });
  28439. };
  28440. // `Promise.prototype.then` method
  28441. // https://tc39.es/ecma262/#sec-promise.prototype.then
  28442. Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
  28443. var state = getInternalPromiseState(this);
  28444. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  28445. state.parent = true;
  28446. reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
  28447. reaction.fail = isCallable(onRejected) && onRejected;
  28448. reaction.domain = IS_NODE ? process.domain : undefined;
  28449. if (state.state == PENDING) state.reactions.add(reaction);
  28450. else microtask(function () {
  28451. callReaction(reaction, state);
  28452. });
  28453. return reaction.promise;
  28454. });
  28455. OwnPromiseCapability = function () {
  28456. var promise = new Internal();
  28457. var state = getInternalPromiseState(promise);
  28458. this.promise = promise;
  28459. this.resolve = bind(internalResolve, state);
  28460. this.reject = bind(internalReject, state);
  28461. };
  28462. newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
  28463. return C === PromiseConstructor || C === PromiseWrapper
  28464. ? new OwnPromiseCapability(C)
  28465. : newGenericPromiseCapability(C);
  28466. };
  28467. if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
  28468. nativeThen = NativePromisePrototype.then;
  28469. if (!NATIVE_PROMISE_SUBCLASSING) {
  28470. // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
  28471. defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
  28472. var that = this;
  28473. return new PromiseConstructor(function (resolve, reject) {
  28474. call(nativeThen, that, resolve, reject);
  28475. }).then(onFulfilled, onRejected);
  28476. // https://github.com/zloirock/core-js/issues/640
  28477. }, { unsafe: true });
  28478. }
  28479. // make `.constructor === Promise` work for native promise-based APIs
  28480. try {
  28481. delete NativePromisePrototype.constructor;
  28482. } catch (error) { /* empty */ }
  28483. // make `instanceof Promise` work for native promise-based APIs
  28484. if (setPrototypeOf) {
  28485. setPrototypeOf(NativePromisePrototype, PromisePrototype);
  28486. }
  28487. }
  28488. }
  28489. $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  28490. Promise: PromiseConstructor
  28491. });
  28492. setToStringTag(PromiseConstructor, PROMISE, false, true);
  28493. setSpecies(PROMISE);
  28494. },{"../internals/a-callable":259,"../internals/an-instance":263,"../internals/define-built-in":296,"../internals/engine-is-node":310,"../internals/export":319,"../internals/function-call":326,"../internals/global":334,"../internals/host-report-errors":337,"../internals/internal-state":344,"../internals/is-callable":347,"../internals/is-object":353,"../internals/is-pure":354,"../internals/microtask":367,"../internals/new-promise-capability":368,"../internals/object-set-prototype-of":386,"../internals/perform":392,"../internals/promise-constructor-detection":393,"../internals/promise-native-constructor":394,"../internals/queue":397,"../internals/set-species":401,"../internals/set-to-string-tag":402,"../internals/species-constructor":406,"../internals/task":412}],477:[function(_dereq_,module,exports){
  28495. 'use strict';
  28496. var $ = _dereq_('../internals/export');
  28497. var IS_PURE = _dereq_('../internals/is-pure');
  28498. var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
  28499. var fails = _dereq_('../internals/fails');
  28500. var getBuiltIn = _dereq_('../internals/get-built-in');
  28501. var isCallable = _dereq_('../internals/is-callable');
  28502. var speciesConstructor = _dereq_('../internals/species-constructor');
  28503. var promiseResolve = _dereq_('../internals/promise-resolve');
  28504. var defineBuiltIn = _dereq_('../internals/define-built-in');
  28505. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  28506. // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
  28507. var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
  28508. // eslint-disable-next-line unicorn/no-thenable -- required for testing
  28509. NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
  28510. });
  28511. // `Promise.prototype.finally` method
  28512. // https://tc39.es/ecma262/#sec-promise.prototype.finally
  28513. $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
  28514. 'finally': function (onFinally) {
  28515. var C = speciesConstructor(this, getBuiltIn('Promise'));
  28516. var isFunction = isCallable(onFinally);
  28517. return this.then(
  28518. isFunction ? function (x) {
  28519. return promiseResolve(C, onFinally()).then(function () { return x; });
  28520. } : onFinally,
  28521. isFunction ? function (e) {
  28522. return promiseResolve(C, onFinally()).then(function () { throw e; });
  28523. } : onFinally
  28524. );
  28525. }
  28526. });
  28527. // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
  28528. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  28529. var method = getBuiltIn('Promise').prototype['finally'];
  28530. if (NativePromisePrototype['finally'] !== method) {
  28531. defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
  28532. }
  28533. }
  28534. },{"../internals/define-built-in":296,"../internals/export":319,"../internals/fails":320,"../internals/get-built-in":329,"../internals/is-callable":347,"../internals/is-pure":354,"../internals/promise-native-constructor":394,"../internals/promise-resolve":395,"../internals/species-constructor":406}],478:[function(_dereq_,module,exports){
  28535. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  28536. _dereq_('../modules/es.promise.constructor');
  28537. _dereq_('../modules/es.promise.all');
  28538. _dereq_('../modules/es.promise.catch');
  28539. _dereq_('../modules/es.promise.race');
  28540. _dereq_('../modules/es.promise.reject');
  28541. _dereq_('../modules/es.promise.resolve');
  28542. },{"../modules/es.promise.all":473,"../modules/es.promise.catch":475,"../modules/es.promise.constructor":476,"../modules/es.promise.race":479,"../modules/es.promise.reject":480,"../modules/es.promise.resolve":481}],479:[function(_dereq_,module,exports){
  28543. 'use strict';
  28544. var $ = _dereq_('../internals/export');
  28545. var call = _dereq_('../internals/function-call');
  28546. var aCallable = _dereq_('../internals/a-callable');
  28547. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  28548. var perform = _dereq_('../internals/perform');
  28549. var iterate = _dereq_('../internals/iterate');
  28550. var PROMISE_STATICS_INCORRECT_ITERATION = _dereq_('../internals/promise-statics-incorrect-iteration');
  28551. // `Promise.race` method
  28552. // https://tc39.es/ecma262/#sec-promise.race
  28553. $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
  28554. race: function race(iterable) {
  28555. var C = this;
  28556. var capability = newPromiseCapabilityModule.f(C);
  28557. var reject = capability.reject;
  28558. var result = perform(function () {
  28559. var $promiseResolve = aCallable(C.resolve);
  28560. iterate(iterable, function (promise) {
  28561. call($promiseResolve, C, promise).then(capability.resolve, reject);
  28562. });
  28563. });
  28564. if (result.error) reject(result.value);
  28565. return capability.promise;
  28566. }
  28567. });
  28568. },{"../internals/a-callable":259,"../internals/export":319,"../internals/function-call":326,"../internals/iterate":357,"../internals/new-promise-capability":368,"../internals/perform":392,"../internals/promise-statics-incorrect-iteration":396}],480:[function(_dereq_,module,exports){
  28569. 'use strict';
  28570. var $ = _dereq_('../internals/export');
  28571. var call = _dereq_('../internals/function-call');
  28572. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  28573. var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
  28574. // `Promise.reject` method
  28575. // https://tc39.es/ecma262/#sec-promise.reject
  28576. $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  28577. reject: function reject(r) {
  28578. var capability = newPromiseCapabilityModule.f(this);
  28579. call(capability.reject, undefined, r);
  28580. return capability.promise;
  28581. }
  28582. });
  28583. },{"../internals/export":319,"../internals/function-call":326,"../internals/new-promise-capability":368,"../internals/promise-constructor-detection":393}],481:[function(_dereq_,module,exports){
  28584. 'use strict';
  28585. var $ = _dereq_('../internals/export');
  28586. var getBuiltIn = _dereq_('../internals/get-built-in');
  28587. var IS_PURE = _dereq_('../internals/is-pure');
  28588. var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
  28589. var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
  28590. var promiseResolve = _dereq_('../internals/promise-resolve');
  28591. var PromiseConstructorWrapper = getBuiltIn('Promise');
  28592. var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
  28593. // `Promise.resolve` method
  28594. // https://tc39.es/ecma262/#sec-promise.resolve
  28595. $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
  28596. resolve: function resolve(x) {
  28597. return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
  28598. }
  28599. });
  28600. },{"../internals/export":319,"../internals/get-built-in":329,"../internals/is-pure":354,"../internals/promise-constructor-detection":393,"../internals/promise-native-constructor":394,"../internals/promise-resolve":395}],482:[function(_dereq_,module,exports){
  28601. var $ = _dereq_('../internals/export');
  28602. var getBuiltIn = _dereq_('../internals/get-built-in');
  28603. var apply = _dereq_('../internals/function-apply');
  28604. var bind = _dereq_('../internals/function-bind');
  28605. var aConstructor = _dereq_('../internals/a-constructor');
  28606. var anObject = _dereq_('../internals/an-object');
  28607. var isObject = _dereq_('../internals/is-object');
  28608. var create = _dereq_('../internals/object-create');
  28609. var fails = _dereq_('../internals/fails');
  28610. var nativeConstruct = getBuiltIn('Reflect', 'construct');
  28611. var ObjectPrototype = Object.prototype;
  28612. var push = [].push;
  28613. // `Reflect.construct` method
  28614. // https://tc39.es/ecma262/#sec-reflect.construct
  28615. // MS Edge supports only 2 arguments and argumentsList argument is optional
  28616. // FF Nightly sets third argument as `new.target`, but does not create `this` from it
  28617. var NEW_TARGET_BUG = fails(function () {
  28618. function F() { /* empty */ }
  28619. return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
  28620. });
  28621. var ARGS_BUG = !fails(function () {
  28622. nativeConstruct(function () { /* empty */ });
  28623. });
  28624. var FORCED = NEW_TARGET_BUG || ARGS_BUG;
  28625. $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
  28626. construct: function construct(Target, args /* , newTarget */) {
  28627. aConstructor(Target);
  28628. anObject(args);
  28629. var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
  28630. if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
  28631. if (Target == newTarget) {
  28632. // w/o altered newTarget, optimization for 0-4 arguments
  28633. switch (args.length) {
  28634. case 0: return new Target();
  28635. case 1: return new Target(args[0]);
  28636. case 2: return new Target(args[0], args[1]);
  28637. case 3: return new Target(args[0], args[1], args[2]);
  28638. case 4: return new Target(args[0], args[1], args[2], args[3]);
  28639. }
  28640. // w/o altered newTarget, lot of arguments case
  28641. var $args = [null];
  28642. apply(push, $args, args);
  28643. return new (apply(bind, Target, $args))();
  28644. }
  28645. // with altered newTarget, not support built-in constructors
  28646. var proto = newTarget.prototype;
  28647. var instance = create(isObject(proto) ? proto : ObjectPrototype);
  28648. var result = apply(Target, instance, args);
  28649. return isObject(result) ? result : instance;
  28650. }
  28651. });
  28652. },{"../internals/a-constructor":260,"../internals/an-object":264,"../internals/export":319,"../internals/fails":320,"../internals/function-apply":322,"../internals/function-bind":325,"../internals/get-built-in":329,"../internals/is-object":353,"../internals/object-create":373}],483:[function(_dereq_,module,exports){
  28653. var $ = _dereq_('../internals/export');
  28654. var call = _dereq_('../internals/function-call');
  28655. var isObject = _dereq_('../internals/is-object');
  28656. var anObject = _dereq_('../internals/an-object');
  28657. var isDataDescriptor = _dereq_('../internals/is-data-descriptor');
  28658. var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
  28659. var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
  28660. // `Reflect.get` method
  28661. // https://tc39.es/ecma262/#sec-reflect.get
  28662. function get(target, propertyKey /* , receiver */) {
  28663. var receiver = arguments.length < 3 ? target : arguments[2];
  28664. var descriptor, prototype;
  28665. if (anObject(target) === receiver) return target[propertyKey];
  28666. descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey);
  28667. if (descriptor) return isDataDescriptor(descriptor)
  28668. ? descriptor.value
  28669. : descriptor.get === undefined ? undefined : call(descriptor.get, receiver);
  28670. if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver);
  28671. }
  28672. $({ target: 'Reflect', stat: true }, {
  28673. get: get
  28674. });
  28675. },{"../internals/an-object":264,"../internals/export":319,"../internals/function-call":326,"../internals/is-data-descriptor":349,"../internals/is-object":353,"../internals/object-get-own-property-descriptor":376,"../internals/object-get-prototype-of":380}],484:[function(_dereq_,module,exports){
  28676. arguments[4][456][0].apply(exports,arguments)
  28677. },{"dup":456}],485:[function(_dereq_,module,exports){
  28678. 'use strict';
  28679. var collection = _dereq_('../internals/collection');
  28680. var collectionStrong = _dereq_('../internals/collection-strong');
  28681. // `Set` constructor
  28682. // https://tc39.es/ecma262/#sec-set-objects
  28683. collection('Set', function (init) {
  28684. return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
  28685. }, collectionStrong);
  28686. },{"../internals/collection":288,"../internals/collection-strong":286}],486:[function(_dereq_,module,exports){
  28687. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  28688. _dereq_('../modules/es.set.constructor');
  28689. },{"../modules/es.set.constructor":485}],487:[function(_dereq_,module,exports){
  28690. 'use strict';
  28691. var $ = _dereq_('../internals/export');
  28692. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  28693. var notARegExp = _dereq_('../internals/not-a-regexp');
  28694. var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
  28695. var toString = _dereq_('../internals/to-string');
  28696. var correctIsRegExpLogic = _dereq_('../internals/correct-is-regexp-logic');
  28697. var stringIndexOf = uncurryThis(''.indexOf);
  28698. // `String.prototype.includes` method
  28699. // https://tc39.es/ecma262/#sec-string.prototype.includes
  28700. $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
  28701. includes: function includes(searchString /* , position = 0 */) {
  28702. return !!~stringIndexOf(
  28703. toString(requireObjectCoercible(this)),
  28704. toString(notARegExp(searchString)),
  28705. arguments.length > 1 ? arguments[1] : undefined
  28706. );
  28707. }
  28708. });
  28709. },{"../internals/correct-is-regexp-logic":290,"../internals/export":319,"../internals/function-uncurry-this":328,"../internals/not-a-regexp":370,"../internals/require-object-coercible":398,"../internals/to-string":421}],488:[function(_dereq_,module,exports){
  28710. 'use strict';
  28711. var charAt = _dereq_('../internals/string-multibyte').charAt;
  28712. var toString = _dereq_('../internals/to-string');
  28713. var InternalStateModule = _dereq_('../internals/internal-state');
  28714. var defineIterator = _dereq_('../internals/iterator-define');
  28715. var createIterResultObject = _dereq_('../internals/create-iter-result-object');
  28716. var STRING_ITERATOR = 'String Iterator';
  28717. var setInternalState = InternalStateModule.set;
  28718. var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
  28719. // `String.prototype[@@iterator]` method
  28720. // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
  28721. defineIterator(String, 'String', function (iterated) {
  28722. setInternalState(this, {
  28723. type: STRING_ITERATOR,
  28724. string: toString(iterated),
  28725. index: 0
  28726. });
  28727. // `%StringIteratorPrototype%.next` method
  28728. // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
  28729. }, function next() {
  28730. var state = getInternalState(this);
  28731. var string = state.string;
  28732. var index = state.index;
  28733. var point;
  28734. if (index >= string.length) return createIterResultObject(undefined, true);
  28735. point = charAt(string, index);
  28736. state.index += point.length;
  28737. return createIterResultObject(point, false);
  28738. });
  28739. },{"../internals/create-iter-result-object":292,"../internals/internal-state":344,"../internals/iterator-define":360,"../internals/string-multibyte":407,"../internals/to-string":421}],489:[function(_dereq_,module,exports){
  28740. 'use strict';
  28741. var $ = _dereq_('../internals/export');
  28742. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  28743. var getOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
  28744. var toLength = _dereq_('../internals/to-length');
  28745. var toString = _dereq_('../internals/to-string');
  28746. var notARegExp = _dereq_('../internals/not-a-regexp');
  28747. var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
  28748. var correctIsRegExpLogic = _dereq_('../internals/correct-is-regexp-logic');
  28749. var IS_PURE = _dereq_('../internals/is-pure');
  28750. // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
  28751. var nativeStartsWith = uncurryThis(''.startsWith);
  28752. var stringSlice = uncurryThis(''.slice);
  28753. var min = Math.min;
  28754. var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
  28755. // https://github.com/zloirock/core-js/pull/702
  28756. var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
  28757. var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
  28758. return descriptor && !descriptor.writable;
  28759. }();
  28760. // `String.prototype.startsWith` method
  28761. // https://tc39.es/ecma262/#sec-string.prototype.startswith
  28762. $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  28763. startsWith: function startsWith(searchString /* , position = 0 */) {
  28764. var that = toString(requireObjectCoercible(this));
  28765. notARegExp(searchString);
  28766. var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
  28767. var search = toString(searchString);
  28768. return nativeStartsWith
  28769. ? nativeStartsWith(that, search, index)
  28770. : stringSlice(that, index, index + search.length) === search;
  28771. }
  28772. });
  28773. },{"../internals/correct-is-regexp-logic":290,"../internals/export":319,"../internals/function-uncurry-this":328,"../internals/is-pure":354,"../internals/not-a-regexp":370,"../internals/object-get-own-property-descriptor":376,"../internals/require-object-coercible":398,"../internals/to-length":416,"../internals/to-string":421}],490:[function(_dereq_,module,exports){
  28774. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  28775. // `Symbol.asyncIterator` well-known symbol
  28776. // https://tc39.es/ecma262/#sec-symbol.asynciterator
  28777. defineWellKnownSymbol('asyncIterator');
  28778. },{"../internals/well-known-symbol-define":428}],491:[function(_dereq_,module,exports){
  28779. 'use strict';
  28780. var $ = _dereq_('../internals/export');
  28781. var global = _dereq_('../internals/global');
  28782. var call = _dereq_('../internals/function-call');
  28783. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  28784. var IS_PURE = _dereq_('../internals/is-pure');
  28785. var DESCRIPTORS = _dereq_('../internals/descriptors');
  28786. var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
  28787. var fails = _dereq_('../internals/fails');
  28788. var hasOwn = _dereq_('../internals/has-own-property');
  28789. var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
  28790. var anObject = _dereq_('../internals/an-object');
  28791. var toIndexedObject = _dereq_('../internals/to-indexed-object');
  28792. var toPropertyKey = _dereq_('../internals/to-property-key');
  28793. var $toString = _dereq_('../internals/to-string');
  28794. var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
  28795. var nativeObjectCreate = _dereq_('../internals/object-create');
  28796. var objectKeys = _dereq_('../internals/object-keys');
  28797. var getOwnPropertyNamesModule = _dereq_('../internals/object-get-own-property-names');
  28798. var getOwnPropertyNamesExternal = _dereq_('../internals/object-get-own-property-names-external');
  28799. var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
  28800. var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
  28801. var definePropertyModule = _dereq_('../internals/object-define-property');
  28802. var definePropertiesModule = _dereq_('../internals/object-define-properties');
  28803. var propertyIsEnumerableModule = _dereq_('../internals/object-property-is-enumerable');
  28804. var defineBuiltIn = _dereq_('../internals/define-built-in');
  28805. var shared = _dereq_('../internals/shared');
  28806. var sharedKey = _dereq_('../internals/shared-key');
  28807. var hiddenKeys = _dereq_('../internals/hidden-keys');
  28808. var uid = _dereq_('../internals/uid');
  28809. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  28810. var wrappedWellKnownSymbolModule = _dereq_('../internals/well-known-symbol-wrapped');
  28811. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  28812. var defineSymbolToPrimitive = _dereq_('../internals/symbol-define-to-primitive');
  28813. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  28814. var InternalStateModule = _dereq_('../internals/internal-state');
  28815. var $forEach = _dereq_('../internals/array-iteration').forEach;
  28816. var HIDDEN = sharedKey('hidden');
  28817. var SYMBOL = 'Symbol';
  28818. var PROTOTYPE = 'prototype';
  28819. var setInternalState = InternalStateModule.set;
  28820. var getInternalState = InternalStateModule.getterFor(SYMBOL);
  28821. var ObjectPrototype = Object[PROTOTYPE];
  28822. var $Symbol = global.Symbol;
  28823. var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
  28824. var TypeError = global.TypeError;
  28825. var QObject = global.QObject;
  28826. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  28827. var nativeDefineProperty = definePropertyModule.f;
  28828. var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
  28829. var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
  28830. var push = uncurryThis([].push);
  28831. var AllSymbols = shared('symbols');
  28832. var ObjectPrototypeSymbols = shared('op-symbols');
  28833. var WellKnownSymbolsStore = shared('wks');
  28834. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  28835. var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  28836. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  28837. var setSymbolDescriptor = DESCRIPTORS && fails(function () {
  28838. return nativeObjectCreate(nativeDefineProperty({}, 'a', {
  28839. get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
  28840. })).a != 7;
  28841. }) ? function (O, P, Attributes) {
  28842. var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
  28843. if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
  28844. nativeDefineProperty(O, P, Attributes);
  28845. if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
  28846. nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
  28847. }
  28848. } : nativeDefineProperty;
  28849. var wrap = function (tag, description) {
  28850. var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
  28851. setInternalState(symbol, {
  28852. type: SYMBOL,
  28853. tag: tag,
  28854. description: description
  28855. });
  28856. if (!DESCRIPTORS) symbol.description = description;
  28857. return symbol;
  28858. };
  28859. var $defineProperty = function defineProperty(O, P, Attributes) {
  28860. if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  28861. anObject(O);
  28862. var key = toPropertyKey(P);
  28863. anObject(Attributes);
  28864. if (hasOwn(AllSymbols, key)) {
  28865. if (!Attributes.enumerable) {
  28866. if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
  28867. O[HIDDEN][key] = true;
  28868. } else {
  28869. if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
  28870. Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
  28871. } return setSymbolDescriptor(O, key, Attributes);
  28872. } return nativeDefineProperty(O, key, Attributes);
  28873. };
  28874. var $defineProperties = function defineProperties(O, Properties) {
  28875. anObject(O);
  28876. var properties = toIndexedObject(Properties);
  28877. var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  28878. $forEach(keys, function (key) {
  28879. if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
  28880. });
  28881. return O;
  28882. };
  28883. var $create = function create(O, Properties) {
  28884. return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
  28885. };
  28886. var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  28887. var P = toPropertyKey(V);
  28888. var enumerable = call(nativePropertyIsEnumerable, this, P);
  28889. if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
  28890. return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
  28891. ? enumerable : true;
  28892. };
  28893. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  28894. var it = toIndexedObject(O);
  28895. var key = toPropertyKey(P);
  28896. if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
  28897. var descriptor = nativeGetOwnPropertyDescriptor(it, key);
  28898. if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
  28899. descriptor.enumerable = true;
  28900. }
  28901. return descriptor;
  28902. };
  28903. var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  28904. var names = nativeGetOwnPropertyNames(toIndexedObject(O));
  28905. var result = [];
  28906. $forEach(names, function (key) {
  28907. if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
  28908. });
  28909. return result;
  28910. };
  28911. var $getOwnPropertySymbols = function (O) {
  28912. var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  28913. var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  28914. var result = [];
  28915. $forEach(names, function (key) {
  28916. if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
  28917. push(result, AllSymbols[key]);
  28918. }
  28919. });
  28920. return result;
  28921. };
  28922. // `Symbol` constructor
  28923. // https://tc39.es/ecma262/#sec-symbol-constructor
  28924. if (!NATIVE_SYMBOL) {
  28925. $Symbol = function Symbol() {
  28926. if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
  28927. var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
  28928. var tag = uid(description);
  28929. var setter = function (value) {
  28930. if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
  28931. if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  28932. setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
  28933. };
  28934. if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
  28935. return wrap(tag, description);
  28936. };
  28937. SymbolPrototype = $Symbol[PROTOTYPE];
  28938. defineBuiltIn(SymbolPrototype, 'toString', function toString() {
  28939. return getInternalState(this).tag;
  28940. });
  28941. defineBuiltIn($Symbol, 'withoutSetter', function (description) {
  28942. return wrap(uid(description), description);
  28943. });
  28944. propertyIsEnumerableModule.f = $propertyIsEnumerable;
  28945. definePropertyModule.f = $defineProperty;
  28946. definePropertiesModule.f = $defineProperties;
  28947. getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
  28948. getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  28949. getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
  28950. wrappedWellKnownSymbolModule.f = function (name) {
  28951. return wrap(wellKnownSymbol(name), name);
  28952. };
  28953. if (DESCRIPTORS) {
  28954. // https://github.com/tc39/proposal-Symbol-description
  28955. nativeDefineProperty(SymbolPrototype, 'description', {
  28956. configurable: true,
  28957. get: function description() {
  28958. return getInternalState(this).description;
  28959. }
  28960. });
  28961. if (!IS_PURE) {
  28962. defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
  28963. }
  28964. }
  28965. }
  28966. $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
  28967. Symbol: $Symbol
  28968. });
  28969. $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  28970. defineWellKnownSymbol(name);
  28971. });
  28972. $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
  28973. useSetter: function () { USE_SETTER = true; },
  28974. useSimple: function () { USE_SETTER = false; }
  28975. });
  28976. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
  28977. // `Object.create` method
  28978. // https://tc39.es/ecma262/#sec-object.create
  28979. create: $create,
  28980. // `Object.defineProperty` method
  28981. // https://tc39.es/ecma262/#sec-object.defineproperty
  28982. defineProperty: $defineProperty,
  28983. // `Object.defineProperties` method
  28984. // https://tc39.es/ecma262/#sec-object.defineproperties
  28985. defineProperties: $defineProperties,
  28986. // `Object.getOwnPropertyDescriptor` method
  28987. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  28988. getOwnPropertyDescriptor: $getOwnPropertyDescriptor
  28989. });
  28990. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
  28991. // `Object.getOwnPropertyNames` method
  28992. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  28993. getOwnPropertyNames: $getOwnPropertyNames
  28994. });
  28995. // `Symbol.prototype[@@toPrimitive]` method
  28996. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  28997. defineSymbolToPrimitive();
  28998. // `Symbol.prototype[@@toStringTag]` property
  28999. // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
  29000. setToStringTag($Symbol, SYMBOL);
  29001. hiddenKeys[HIDDEN] = true;
  29002. },{"../internals/an-object":264,"../internals/array-iteration":269,"../internals/create-property-descriptor":294,"../internals/define-built-in":296,"../internals/descriptors":300,"../internals/export":319,"../internals/fails":320,"../internals/function-call":326,"../internals/function-uncurry-this":328,"../internals/global":334,"../internals/has-own-property":335,"../internals/hidden-keys":336,"../internals/internal-state":344,"../internals/is-pure":354,"../internals/object-create":373,"../internals/object-define-properties":374,"../internals/object-define-property":375,"../internals/object-get-own-property-descriptor":376,"../internals/object-get-own-property-names":378,"../internals/object-get-own-property-names-external":377,"../internals/object-get-own-property-symbols":379,"../internals/object-is-prototype-of":382,"../internals/object-keys":384,"../internals/object-property-is-enumerable":385,"../internals/set-to-string-tag":402,"../internals/shared":405,"../internals/shared-key":403,"../internals/symbol-constructor-detection":409,"../internals/symbol-define-to-primitive":410,"../internals/to-indexed-object":414,"../internals/to-property-key":419,"../internals/to-string":421,"../internals/uid":423,"../internals/well-known-symbol":430,"../internals/well-known-symbol-define":428,"../internals/well-known-symbol-wrapped":429}],492:[function(_dereq_,module,exports){
  29003. arguments[4][456][0].apply(exports,arguments)
  29004. },{"dup":456}],493:[function(_dereq_,module,exports){
  29005. var $ = _dereq_('../internals/export');
  29006. var getBuiltIn = _dereq_('../internals/get-built-in');
  29007. var hasOwn = _dereq_('../internals/has-own-property');
  29008. var toString = _dereq_('../internals/to-string');
  29009. var shared = _dereq_('../internals/shared');
  29010. var NATIVE_SYMBOL_REGISTRY = _dereq_('../internals/symbol-registry-detection');
  29011. var StringToSymbolRegistry = shared('string-to-symbol-registry');
  29012. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  29013. // `Symbol.for` method
  29014. // https://tc39.es/ecma262/#sec-symbol.for
  29015. $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
  29016. 'for': function (key) {
  29017. var string = toString(key);
  29018. if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
  29019. var symbol = getBuiltIn('Symbol')(string);
  29020. StringToSymbolRegistry[string] = symbol;
  29021. SymbolToStringRegistry[symbol] = string;
  29022. return symbol;
  29023. }
  29024. });
  29025. },{"../internals/export":319,"../internals/get-built-in":329,"../internals/has-own-property":335,"../internals/shared":405,"../internals/symbol-registry-detection":411,"../internals/to-string":421}],494:[function(_dereq_,module,exports){
  29026. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29027. // `Symbol.hasInstance` well-known symbol
  29028. // https://tc39.es/ecma262/#sec-symbol.hasinstance
  29029. defineWellKnownSymbol('hasInstance');
  29030. },{"../internals/well-known-symbol-define":428}],495:[function(_dereq_,module,exports){
  29031. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29032. // `Symbol.isConcatSpreadable` well-known symbol
  29033. // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
  29034. defineWellKnownSymbol('isConcatSpreadable');
  29035. },{"../internals/well-known-symbol-define":428}],496:[function(_dereq_,module,exports){
  29036. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29037. // `Symbol.iterator` well-known symbol
  29038. // https://tc39.es/ecma262/#sec-symbol.iterator
  29039. defineWellKnownSymbol('iterator');
  29040. },{"../internals/well-known-symbol-define":428}],497:[function(_dereq_,module,exports){
  29041. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  29042. _dereq_('../modules/es.symbol.constructor');
  29043. _dereq_('../modules/es.symbol.for');
  29044. _dereq_('../modules/es.symbol.key-for');
  29045. _dereq_('../modules/es.json.stringify');
  29046. _dereq_('../modules/es.object.get-own-property-symbols');
  29047. },{"../modules/es.json.stringify":452,"../modules/es.object.get-own-property-symbols":466,"../modules/es.symbol.constructor":491,"../modules/es.symbol.for":493,"../modules/es.symbol.key-for":498}],498:[function(_dereq_,module,exports){
  29048. var $ = _dereq_('../internals/export');
  29049. var hasOwn = _dereq_('../internals/has-own-property');
  29050. var isSymbol = _dereq_('../internals/is-symbol');
  29051. var tryToString = _dereq_('../internals/try-to-string');
  29052. var shared = _dereq_('../internals/shared');
  29053. var NATIVE_SYMBOL_REGISTRY = _dereq_('../internals/symbol-registry-detection');
  29054. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  29055. // `Symbol.keyFor` method
  29056. // https://tc39.es/ecma262/#sec-symbol.keyfor
  29057. $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
  29058. keyFor: function keyFor(sym) {
  29059. if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
  29060. if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
  29061. }
  29062. });
  29063. },{"../internals/export":319,"../internals/has-own-property":335,"../internals/is-symbol":356,"../internals/shared":405,"../internals/symbol-registry-detection":411,"../internals/try-to-string":422}],499:[function(_dereq_,module,exports){
  29064. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29065. // `Symbol.matchAll` well-known symbol
  29066. // https://tc39.es/ecma262/#sec-symbol.matchall
  29067. defineWellKnownSymbol('matchAll');
  29068. },{"../internals/well-known-symbol-define":428}],500:[function(_dereq_,module,exports){
  29069. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29070. // `Symbol.match` well-known symbol
  29071. // https://tc39.es/ecma262/#sec-symbol.match
  29072. defineWellKnownSymbol('match');
  29073. },{"../internals/well-known-symbol-define":428}],501:[function(_dereq_,module,exports){
  29074. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29075. // `Symbol.replace` well-known symbol
  29076. // https://tc39.es/ecma262/#sec-symbol.replace
  29077. defineWellKnownSymbol('replace');
  29078. },{"../internals/well-known-symbol-define":428}],502:[function(_dereq_,module,exports){
  29079. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29080. // `Symbol.search` well-known symbol
  29081. // https://tc39.es/ecma262/#sec-symbol.search
  29082. defineWellKnownSymbol('search');
  29083. },{"../internals/well-known-symbol-define":428}],503:[function(_dereq_,module,exports){
  29084. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29085. // `Symbol.species` well-known symbol
  29086. // https://tc39.es/ecma262/#sec-symbol.species
  29087. defineWellKnownSymbol('species');
  29088. },{"../internals/well-known-symbol-define":428}],504:[function(_dereq_,module,exports){
  29089. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29090. // `Symbol.split` well-known symbol
  29091. // https://tc39.es/ecma262/#sec-symbol.split
  29092. defineWellKnownSymbol('split');
  29093. },{"../internals/well-known-symbol-define":428}],505:[function(_dereq_,module,exports){
  29094. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29095. var defineSymbolToPrimitive = _dereq_('../internals/symbol-define-to-primitive');
  29096. // `Symbol.toPrimitive` well-known symbol
  29097. // https://tc39.es/ecma262/#sec-symbol.toprimitive
  29098. defineWellKnownSymbol('toPrimitive');
  29099. // `Symbol.prototype[@@toPrimitive]` method
  29100. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  29101. defineSymbolToPrimitive();
  29102. },{"../internals/symbol-define-to-primitive":410,"../internals/well-known-symbol-define":428}],506:[function(_dereq_,module,exports){
  29103. var getBuiltIn = _dereq_('../internals/get-built-in');
  29104. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29105. var setToStringTag = _dereq_('../internals/set-to-string-tag');
  29106. // `Symbol.toStringTag` well-known symbol
  29107. // https://tc39.es/ecma262/#sec-symbol.tostringtag
  29108. defineWellKnownSymbol('toStringTag');
  29109. // `Symbol.prototype[@@toStringTag]` property
  29110. // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
  29111. setToStringTag(getBuiltIn('Symbol'), 'Symbol');
  29112. },{"../internals/get-built-in":329,"../internals/set-to-string-tag":402,"../internals/well-known-symbol-define":428}],507:[function(_dereq_,module,exports){
  29113. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29114. // `Symbol.unscopables` well-known symbol
  29115. // https://tc39.es/ecma262/#sec-symbol.unscopables
  29116. defineWellKnownSymbol('unscopables');
  29117. },{"../internals/well-known-symbol-define":428}],508:[function(_dereq_,module,exports){
  29118. 'use strict';
  29119. var global = _dereq_('../internals/global');
  29120. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  29121. var defineBuiltIns = _dereq_('../internals/define-built-ins');
  29122. var InternalMetadataModule = _dereq_('../internals/internal-metadata');
  29123. var collection = _dereq_('../internals/collection');
  29124. var collectionWeak = _dereq_('../internals/collection-weak');
  29125. var isObject = _dereq_('../internals/is-object');
  29126. var isExtensible = _dereq_('../internals/object-is-extensible');
  29127. var enforceInternalState = _dereq_('../internals/internal-state').enforce;
  29128. var NATIVE_WEAK_MAP = _dereq_('../internals/weak-map-basic-detection');
  29129. var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
  29130. var InternalWeakMap;
  29131. var wrapper = function (init) {
  29132. return function WeakMap() {
  29133. return init(this, arguments.length ? arguments[0] : undefined);
  29134. };
  29135. };
  29136. // `WeakMap` constructor
  29137. // https://tc39.es/ecma262/#sec-weakmap-constructor
  29138. var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
  29139. // IE11 WeakMap frozen keys fix
  29140. // We can't use feature detection because it crash some old IE builds
  29141. // https://github.com/zloirock/core-js/issues/485
  29142. if (NATIVE_WEAK_MAP && IS_IE11) {
  29143. InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
  29144. InternalMetadataModule.enable();
  29145. var WeakMapPrototype = $WeakMap.prototype;
  29146. var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
  29147. var nativeHas = uncurryThis(WeakMapPrototype.has);
  29148. var nativeGet = uncurryThis(WeakMapPrototype.get);
  29149. var nativeSet = uncurryThis(WeakMapPrototype.set);
  29150. defineBuiltIns(WeakMapPrototype, {
  29151. 'delete': function (key) {
  29152. if (isObject(key) && !isExtensible(key)) {
  29153. var state = enforceInternalState(this);
  29154. if (!state.frozen) state.frozen = new InternalWeakMap();
  29155. return nativeDelete(this, key) || state.frozen['delete'](key);
  29156. } return nativeDelete(this, key);
  29157. },
  29158. has: function has(key) {
  29159. if (isObject(key) && !isExtensible(key)) {
  29160. var state = enforceInternalState(this);
  29161. if (!state.frozen) state.frozen = new InternalWeakMap();
  29162. return nativeHas(this, key) || state.frozen.has(key);
  29163. } return nativeHas(this, key);
  29164. },
  29165. get: function get(key) {
  29166. if (isObject(key) && !isExtensible(key)) {
  29167. var state = enforceInternalState(this);
  29168. if (!state.frozen) state.frozen = new InternalWeakMap();
  29169. return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
  29170. } return nativeGet(this, key);
  29171. },
  29172. set: function set(key, value) {
  29173. if (isObject(key) && !isExtensible(key)) {
  29174. var state = enforceInternalState(this);
  29175. if (!state.frozen) state.frozen = new InternalWeakMap();
  29176. nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
  29177. } else nativeSet(this, key, value);
  29178. return this;
  29179. }
  29180. });
  29181. }
  29182. },{"../internals/collection":288,"../internals/collection-weak":287,"../internals/define-built-ins":297,"../internals/function-uncurry-this":328,"../internals/global":334,"../internals/internal-metadata":343,"../internals/internal-state":344,"../internals/is-object":353,"../internals/object-is-extensible":381,"../internals/weak-map-basic-detection":427}],509:[function(_dereq_,module,exports){
  29183. // TODO: Remove this module from `core-js@4` since it's replaced to module below
  29184. _dereq_('../modules/es.weak-map.constructor');
  29185. },{"../modules/es.weak-map.constructor":508}],510:[function(_dereq_,module,exports){
  29186. // TODO: Remove from `core-js@4`
  29187. _dereq_('../modules/es.aggregate-error');
  29188. },{"../modules/es.aggregate-error":433}],511:[function(_dereq_,module,exports){
  29189. 'use strict';
  29190. var $ = _dereq_('../internals/export');
  29191. var deleteAll = _dereq_('../internals/collection-delete-all');
  29192. // `Map.prototype.deleteAll` method
  29193. // https://github.com/tc39/proposal-collection-methods
  29194. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29195. deleteAll: deleteAll
  29196. });
  29197. },{"../internals/collection-delete-all":283,"../internals/export":319}],512:[function(_dereq_,module,exports){
  29198. 'use strict';
  29199. var $ = _dereq_('../internals/export');
  29200. var emplace = _dereq_('../internals/map-emplace');
  29201. // `Map.prototype.emplace` method
  29202. // https://github.com/thumbsupep/proposal-upsert
  29203. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29204. emplace: emplace
  29205. });
  29206. },{"../internals/export":319,"../internals/map-emplace":364}],513:[function(_dereq_,module,exports){
  29207. 'use strict';
  29208. var $ = _dereq_('../internals/export');
  29209. var anObject = _dereq_('../internals/an-object');
  29210. var bind = _dereq_('../internals/function-bind-context');
  29211. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29212. var iterate = _dereq_('../internals/iterate');
  29213. // `Map.prototype.every` method
  29214. // https://github.com/tc39/proposal-collection-methods
  29215. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29216. every: function every(callbackfn /* , thisArg */) {
  29217. var map = anObject(this);
  29218. var iterator = getMapIterator(map);
  29219. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29220. return !iterate(iterator, function (key, value, stop) {
  29221. if (!boundFunction(value, key, map)) return stop();
  29222. }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;
  29223. }
  29224. });
  29225. },{"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/get-map-iterator":332,"../internals/iterate":357}],514:[function(_dereq_,module,exports){
  29226. 'use strict';
  29227. var $ = _dereq_('../internals/export');
  29228. var getBuiltIn = _dereq_('../internals/get-built-in');
  29229. var bind = _dereq_('../internals/function-bind-context');
  29230. var call = _dereq_('../internals/function-call');
  29231. var aCallable = _dereq_('../internals/a-callable');
  29232. var anObject = _dereq_('../internals/an-object');
  29233. var speciesConstructor = _dereq_('../internals/species-constructor');
  29234. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29235. var iterate = _dereq_('../internals/iterate');
  29236. // `Map.prototype.filter` method
  29237. // https://github.com/tc39/proposal-collection-methods
  29238. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29239. filter: function filter(callbackfn /* , thisArg */) {
  29240. var map = anObject(this);
  29241. var iterator = getMapIterator(map);
  29242. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29243. var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();
  29244. var setter = aCallable(newMap.set);
  29245. iterate(iterator, function (key, value) {
  29246. if (boundFunction(value, key, map)) call(setter, newMap, key, value);
  29247. }, { AS_ENTRIES: true, IS_ITERATOR: true });
  29248. return newMap;
  29249. }
  29250. });
  29251. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/function-call":326,"../internals/get-built-in":329,"../internals/get-map-iterator":332,"../internals/iterate":357,"../internals/species-constructor":406}],515:[function(_dereq_,module,exports){
  29252. 'use strict';
  29253. var $ = _dereq_('../internals/export');
  29254. var anObject = _dereq_('../internals/an-object');
  29255. var bind = _dereq_('../internals/function-bind-context');
  29256. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29257. var iterate = _dereq_('../internals/iterate');
  29258. // `Map.prototype.findKey` method
  29259. // https://github.com/tc39/proposal-collection-methods
  29260. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29261. findKey: function findKey(callbackfn /* , thisArg */) {
  29262. var map = anObject(this);
  29263. var iterator = getMapIterator(map);
  29264. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29265. return iterate(iterator, function (key, value, stop) {
  29266. if (boundFunction(value, key, map)) return stop(key);
  29267. }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;
  29268. }
  29269. });
  29270. },{"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/get-map-iterator":332,"../internals/iterate":357}],516:[function(_dereq_,module,exports){
  29271. 'use strict';
  29272. var $ = _dereq_('../internals/export');
  29273. var anObject = _dereq_('../internals/an-object');
  29274. var bind = _dereq_('../internals/function-bind-context');
  29275. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29276. var iterate = _dereq_('../internals/iterate');
  29277. // `Map.prototype.find` method
  29278. // https://github.com/tc39/proposal-collection-methods
  29279. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29280. find: function find(callbackfn /* , thisArg */) {
  29281. var map = anObject(this);
  29282. var iterator = getMapIterator(map);
  29283. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29284. return iterate(iterator, function (key, value, stop) {
  29285. if (boundFunction(value, key, map)) return stop(value);
  29286. }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;
  29287. }
  29288. });
  29289. },{"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/get-map-iterator":332,"../internals/iterate":357}],517:[function(_dereq_,module,exports){
  29290. var $ = _dereq_('../internals/export');
  29291. var from = _dereq_('../internals/collection-from');
  29292. // `Map.from` method
  29293. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  29294. $({ target: 'Map', stat: true, forced: true }, {
  29295. from: from
  29296. });
  29297. },{"../internals/collection-from":284,"../internals/export":319}],518:[function(_dereq_,module,exports){
  29298. 'use strict';
  29299. var $ = _dereq_('../internals/export');
  29300. var call = _dereq_('../internals/function-call');
  29301. var uncurryThis = _dereq_('../internals/function-uncurry-this');
  29302. var aCallable = _dereq_('../internals/a-callable');
  29303. var getIterator = _dereq_('../internals/get-iterator');
  29304. var iterate = _dereq_('../internals/iterate');
  29305. var push = uncurryThis([].push);
  29306. // `Map.groupBy` method
  29307. // https://github.com/tc39/proposal-collection-methods
  29308. $({ target: 'Map', stat: true, forced: true }, {
  29309. groupBy: function groupBy(iterable, keyDerivative) {
  29310. aCallable(keyDerivative);
  29311. var iterator = getIterator(iterable);
  29312. var newMap = new this();
  29313. var has = aCallable(newMap.has);
  29314. var get = aCallable(newMap.get);
  29315. var set = aCallable(newMap.set);
  29316. iterate(iterator, function (element) {
  29317. var derivedKey = keyDerivative(element);
  29318. if (!call(has, newMap, derivedKey)) call(set, newMap, derivedKey, [element]);
  29319. else push(call(get, newMap, derivedKey), element);
  29320. }, { IS_ITERATOR: true });
  29321. return newMap;
  29322. }
  29323. });
  29324. },{"../internals/a-callable":259,"../internals/export":319,"../internals/function-call":326,"../internals/function-uncurry-this":328,"../internals/get-iterator":331,"../internals/iterate":357}],519:[function(_dereq_,module,exports){
  29325. 'use strict';
  29326. var $ = _dereq_('../internals/export');
  29327. var anObject = _dereq_('../internals/an-object');
  29328. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29329. var sameValueZero = _dereq_('../internals/same-value-zero');
  29330. var iterate = _dereq_('../internals/iterate');
  29331. // `Map.prototype.includes` method
  29332. // https://github.com/tc39/proposal-collection-methods
  29333. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29334. includes: function includes(searchElement) {
  29335. return iterate(getMapIterator(anObject(this)), function (key, value, stop) {
  29336. if (sameValueZero(value, searchElement)) return stop();
  29337. }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;
  29338. }
  29339. });
  29340. },{"../internals/an-object":264,"../internals/export":319,"../internals/get-map-iterator":332,"../internals/iterate":357,"../internals/same-value-zero":399}],520:[function(_dereq_,module,exports){
  29341. 'use strict';
  29342. var $ = _dereq_('../internals/export');
  29343. var call = _dereq_('../internals/function-call');
  29344. var iterate = _dereq_('../internals/iterate');
  29345. var aCallable = _dereq_('../internals/a-callable');
  29346. // `Map.keyBy` method
  29347. // https://github.com/tc39/proposal-collection-methods
  29348. $({ target: 'Map', stat: true, forced: true }, {
  29349. keyBy: function keyBy(iterable, keyDerivative) {
  29350. var newMap = new this();
  29351. aCallable(keyDerivative);
  29352. var setter = aCallable(newMap.set);
  29353. iterate(iterable, function (element) {
  29354. call(setter, newMap, keyDerivative(element), element);
  29355. });
  29356. return newMap;
  29357. }
  29358. });
  29359. },{"../internals/a-callable":259,"../internals/export":319,"../internals/function-call":326,"../internals/iterate":357}],521:[function(_dereq_,module,exports){
  29360. 'use strict';
  29361. var $ = _dereq_('../internals/export');
  29362. var anObject = _dereq_('../internals/an-object');
  29363. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29364. var iterate = _dereq_('../internals/iterate');
  29365. // `Map.prototype.keyOf` method
  29366. // https://github.com/tc39/proposal-collection-methods
  29367. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29368. keyOf: function keyOf(searchElement) {
  29369. return iterate(getMapIterator(anObject(this)), function (key, value, stop) {
  29370. if (value === searchElement) return stop(key);
  29371. }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;
  29372. }
  29373. });
  29374. },{"../internals/an-object":264,"../internals/export":319,"../internals/get-map-iterator":332,"../internals/iterate":357}],522:[function(_dereq_,module,exports){
  29375. 'use strict';
  29376. var $ = _dereq_('../internals/export');
  29377. var getBuiltIn = _dereq_('../internals/get-built-in');
  29378. var bind = _dereq_('../internals/function-bind-context');
  29379. var call = _dereq_('../internals/function-call');
  29380. var aCallable = _dereq_('../internals/a-callable');
  29381. var anObject = _dereq_('../internals/an-object');
  29382. var speciesConstructor = _dereq_('../internals/species-constructor');
  29383. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29384. var iterate = _dereq_('../internals/iterate');
  29385. // `Map.prototype.mapKeys` method
  29386. // https://github.com/tc39/proposal-collection-methods
  29387. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29388. mapKeys: function mapKeys(callbackfn /* , thisArg */) {
  29389. var map = anObject(this);
  29390. var iterator = getMapIterator(map);
  29391. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29392. var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();
  29393. var setter = aCallable(newMap.set);
  29394. iterate(iterator, function (key, value) {
  29395. call(setter, newMap, boundFunction(value, key, map), value);
  29396. }, { AS_ENTRIES: true, IS_ITERATOR: true });
  29397. return newMap;
  29398. }
  29399. });
  29400. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/function-call":326,"../internals/get-built-in":329,"../internals/get-map-iterator":332,"../internals/iterate":357,"../internals/species-constructor":406}],523:[function(_dereq_,module,exports){
  29401. 'use strict';
  29402. var $ = _dereq_('../internals/export');
  29403. var getBuiltIn = _dereq_('../internals/get-built-in');
  29404. var bind = _dereq_('../internals/function-bind-context');
  29405. var call = _dereq_('../internals/function-call');
  29406. var aCallable = _dereq_('../internals/a-callable');
  29407. var anObject = _dereq_('../internals/an-object');
  29408. var speciesConstructor = _dereq_('../internals/species-constructor');
  29409. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29410. var iterate = _dereq_('../internals/iterate');
  29411. // `Map.prototype.mapValues` method
  29412. // https://github.com/tc39/proposal-collection-methods
  29413. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29414. mapValues: function mapValues(callbackfn /* , thisArg */) {
  29415. var map = anObject(this);
  29416. var iterator = getMapIterator(map);
  29417. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29418. var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();
  29419. var setter = aCallable(newMap.set);
  29420. iterate(iterator, function (key, value) {
  29421. call(setter, newMap, key, boundFunction(value, key, map));
  29422. }, { AS_ENTRIES: true, IS_ITERATOR: true });
  29423. return newMap;
  29424. }
  29425. });
  29426. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/function-call":326,"../internals/get-built-in":329,"../internals/get-map-iterator":332,"../internals/iterate":357,"../internals/species-constructor":406}],524:[function(_dereq_,module,exports){
  29427. 'use strict';
  29428. var $ = _dereq_('../internals/export');
  29429. var aCallable = _dereq_('../internals/a-callable');
  29430. var anObject = _dereq_('../internals/an-object');
  29431. var iterate = _dereq_('../internals/iterate');
  29432. // `Map.prototype.merge` method
  29433. // https://github.com/tc39/proposal-collection-methods
  29434. $({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, {
  29435. // eslint-disable-next-line no-unused-vars -- required for `.length`
  29436. merge: function merge(iterable /* ...iterables */) {
  29437. var map = anObject(this);
  29438. var setter = aCallable(map.set);
  29439. var argumentsLength = arguments.length;
  29440. var i = 0;
  29441. while (i < argumentsLength) {
  29442. iterate(arguments[i++], setter, { that: map, AS_ENTRIES: true });
  29443. }
  29444. return map;
  29445. }
  29446. });
  29447. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/export":319,"../internals/iterate":357}],525:[function(_dereq_,module,exports){
  29448. var $ = _dereq_('../internals/export');
  29449. var of = _dereq_('../internals/collection-of');
  29450. // `Map.of` method
  29451. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  29452. $({ target: 'Map', stat: true, forced: true }, {
  29453. of: of
  29454. });
  29455. },{"../internals/collection-of":285,"../internals/export":319}],526:[function(_dereq_,module,exports){
  29456. 'use strict';
  29457. var $ = _dereq_('../internals/export');
  29458. var anObject = _dereq_('../internals/an-object');
  29459. var aCallable = _dereq_('../internals/a-callable');
  29460. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29461. var iterate = _dereq_('../internals/iterate');
  29462. var $TypeError = TypeError;
  29463. // `Map.prototype.reduce` method
  29464. // https://github.com/tc39/proposal-collection-methods
  29465. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29466. reduce: function reduce(callbackfn /* , initialValue */) {
  29467. var map = anObject(this);
  29468. var iterator = getMapIterator(map);
  29469. var noInitial = arguments.length < 2;
  29470. var accumulator = noInitial ? undefined : arguments[1];
  29471. aCallable(callbackfn);
  29472. iterate(iterator, function (key, value) {
  29473. if (noInitial) {
  29474. noInitial = false;
  29475. accumulator = value;
  29476. } else {
  29477. accumulator = callbackfn(accumulator, value, key, map);
  29478. }
  29479. }, { AS_ENTRIES: true, IS_ITERATOR: true });
  29480. if (noInitial) throw $TypeError('Reduce of empty map with no initial value');
  29481. return accumulator;
  29482. }
  29483. });
  29484. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/export":319,"../internals/get-map-iterator":332,"../internals/iterate":357}],527:[function(_dereq_,module,exports){
  29485. 'use strict';
  29486. var $ = _dereq_('../internals/export');
  29487. var anObject = _dereq_('../internals/an-object');
  29488. var bind = _dereq_('../internals/function-bind-context');
  29489. var getMapIterator = _dereq_('../internals/get-map-iterator');
  29490. var iterate = _dereq_('../internals/iterate');
  29491. // `Set.prototype.some` method
  29492. // https://github.com/tc39/proposal-collection-methods
  29493. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29494. some: function some(callbackfn /* , thisArg */) {
  29495. var map = anObject(this);
  29496. var iterator = getMapIterator(map);
  29497. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  29498. return iterate(iterator, function (key, value, stop) {
  29499. if (boundFunction(value, key, map)) return stop();
  29500. }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;
  29501. }
  29502. });
  29503. },{"../internals/an-object":264,"../internals/export":319,"../internals/function-bind-context":323,"../internals/get-map-iterator":332,"../internals/iterate":357}],528:[function(_dereq_,module,exports){
  29504. 'use strict';
  29505. // TODO: remove from `core-js@4`
  29506. var $ = _dereq_('../internals/export');
  29507. var upsert = _dereq_('../internals/map-upsert');
  29508. // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`)
  29509. // https://github.com/thumbsupep/proposal-upsert
  29510. $({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, {
  29511. updateOrInsert: upsert
  29512. });
  29513. },{"../internals/export":319,"../internals/map-upsert":365}],529:[function(_dereq_,module,exports){
  29514. 'use strict';
  29515. var $ = _dereq_('../internals/export');
  29516. var call = _dereq_('../internals/function-call');
  29517. var anObject = _dereq_('../internals/an-object');
  29518. var aCallable = _dereq_('../internals/a-callable');
  29519. var $TypeError = TypeError;
  29520. // `Set.prototype.update` method
  29521. // https://github.com/tc39/proposal-collection-methods
  29522. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29523. update: function update(key, callback /* , thunk */) {
  29524. var map = anObject(this);
  29525. var get = aCallable(map.get);
  29526. var has = aCallable(map.has);
  29527. var set = aCallable(map.set);
  29528. var length = arguments.length;
  29529. aCallable(callback);
  29530. var isPresentInMap = call(has, map, key);
  29531. if (!isPresentInMap && length < 3) {
  29532. throw $TypeError('Updating absent value');
  29533. }
  29534. var value = isPresentInMap ? call(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map);
  29535. call(set, map, key, callback(value, key, map));
  29536. return map;
  29537. }
  29538. });
  29539. },{"../internals/a-callable":259,"../internals/an-object":264,"../internals/export":319,"../internals/function-call":326}],530:[function(_dereq_,module,exports){
  29540. 'use strict';
  29541. // TODO: remove from `core-js@4`
  29542. var $ = _dereq_('../internals/export');
  29543. var upsert = _dereq_('../internals/map-upsert');
  29544. // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`)
  29545. // https://github.com/thumbsupep/proposal-upsert
  29546. $({ target: 'Map', proto: true, real: true, forced: true }, {
  29547. upsert: upsert
  29548. });
  29549. },{"../internals/export":319,"../internals/map-upsert":365}],531:[function(_dereq_,module,exports){
  29550. // TODO: Remove from `core-js@4`
  29551. _dereq_('../modules/es.promise.all-settled.js');
  29552. },{"../modules/es.promise.all-settled.js":472}],532:[function(_dereq_,module,exports){
  29553. // TODO: Remove from `core-js@4`
  29554. _dereq_('../modules/es.promise.any');
  29555. },{"../modules/es.promise.any":474}],533:[function(_dereq_,module,exports){
  29556. 'use strict';
  29557. // TODO: Remove from `core-js@4`
  29558. var $ = _dereq_('../internals/export');
  29559. var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
  29560. var perform = _dereq_('../internals/perform');
  29561. // `Promise.try` method
  29562. // https://github.com/tc39/proposal-promise-try
  29563. $({ target: 'Promise', stat: true, forced: true }, {
  29564. 'try': function (callbackfn) {
  29565. var promiseCapability = newPromiseCapabilityModule.f(this);
  29566. var result = perform(callbackfn);
  29567. (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);
  29568. return promiseCapability.promise;
  29569. }
  29570. });
  29571. },{"../internals/export":319,"../internals/new-promise-capability":368,"../internals/perform":392}],534:[function(_dereq_,module,exports){
  29572. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29573. // `Symbol.asyncDispose` well-known symbol
  29574. // https://github.com/tc39/proposal-using-statement
  29575. defineWellKnownSymbol('asyncDispose');
  29576. },{"../internals/well-known-symbol-define":428}],535:[function(_dereq_,module,exports){
  29577. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29578. // `Symbol.dispose` well-known symbol
  29579. // https://github.com/tc39/proposal-using-statement
  29580. defineWellKnownSymbol('dispose');
  29581. },{"../internals/well-known-symbol-define":428}],536:[function(_dereq_,module,exports){
  29582. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29583. // `Symbol.matcher` well-known symbol
  29584. // https://github.com/tc39/proposal-pattern-matching
  29585. defineWellKnownSymbol('matcher');
  29586. },{"../internals/well-known-symbol-define":428}],537:[function(_dereq_,module,exports){
  29587. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29588. // `Symbol.metadataKey` well-known symbol
  29589. // https://github.com/tc39/proposal-decorator-metadata
  29590. defineWellKnownSymbol('metadataKey');
  29591. },{"../internals/well-known-symbol-define":428}],538:[function(_dereq_,module,exports){
  29592. // TODO: Remove from `core-js@4`
  29593. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29594. // `Symbol.metadata` well-known symbol
  29595. // https://github.com/tc39/proposal-decorators
  29596. defineWellKnownSymbol('metadata');
  29597. },{"../internals/well-known-symbol-define":428}],539:[function(_dereq_,module,exports){
  29598. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29599. // `Symbol.observable` well-known symbol
  29600. // https://github.com/tc39/proposal-observable
  29601. defineWellKnownSymbol('observable');
  29602. },{"../internals/well-known-symbol-define":428}],540:[function(_dereq_,module,exports){
  29603. // TODO: remove from `core-js@4`
  29604. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29605. // `Symbol.patternMatch` well-known symbol
  29606. // https://github.com/tc39/proposal-pattern-matching
  29607. defineWellKnownSymbol('patternMatch');
  29608. },{"../internals/well-known-symbol-define":428}],541:[function(_dereq_,module,exports){
  29609. // TODO: remove from `core-js@4`
  29610. var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
  29611. defineWellKnownSymbol('replaceAll');
  29612. },{"../internals/well-known-symbol-define":428}],542:[function(_dereq_,module,exports){
  29613. _dereq_('../modules/es.array.iterator');
  29614. var DOMIterables = _dereq_('../internals/dom-iterables');
  29615. var global = _dereq_('../internals/global');
  29616. var classof = _dereq_('../internals/classof');
  29617. var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
  29618. var Iterators = _dereq_('../internals/iterators');
  29619. var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
  29620. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  29621. for (var COLLECTION_NAME in DOMIterables) {
  29622. var Collection = global[COLLECTION_NAME];
  29623. var CollectionPrototype = Collection && Collection.prototype;
  29624. if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
  29625. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  29626. }
  29627. Iterators[COLLECTION_NAME] = Iterators.Array;
  29628. }
  29629. },{"../internals/classof":282,"../internals/create-non-enumerable-property":293,"../internals/dom-iterables":303,"../internals/global":334,"../internals/iterators":362,"../internals/well-known-symbol":430,"../modules/es.array.iterator":444}],543:[function(_dereq_,module,exports){
  29630. var $ = _dereq_('../internals/export');
  29631. var global = _dereq_('../internals/global');
  29632. var setInterval = _dereq_('../internals/schedulers-fix').setInterval;
  29633. // ie9- setInterval additional parameters fix
  29634. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
  29635. $({ global: true, bind: true, forced: global.setInterval !== setInterval }, {
  29636. setInterval: setInterval
  29637. });
  29638. },{"../internals/export":319,"../internals/global":334,"../internals/schedulers-fix":400}],544:[function(_dereq_,module,exports){
  29639. var $ = _dereq_('../internals/export');
  29640. var global = _dereq_('../internals/global');
  29641. var setTimeout = _dereq_('../internals/schedulers-fix').setTimeout;
  29642. // ie9- setTimeout additional parameters fix
  29643. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
  29644. $({ global: true, bind: true, forced: global.setTimeout !== setTimeout }, {
  29645. setTimeout: setTimeout
  29646. });
  29647. },{"../internals/export":319,"../internals/global":334,"../internals/schedulers-fix":400}],545:[function(_dereq_,module,exports){
  29648. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  29649. _dereq_('../modules/web.set-interval');
  29650. _dereq_('../modules/web.set-timeout');
  29651. },{"../modules/web.set-interval":543,"../modules/web.set-timeout":544}],546:[function(_dereq_,module,exports){
  29652. var parent = _dereq_('../../es/array/from');
  29653. module.exports = parent;
  29654. },{"../../es/array/from":164}],547:[function(_dereq_,module,exports){
  29655. var parent = _dereq_('../../es/array/is-array');
  29656. module.exports = parent;
  29657. },{"../../es/array/is-array":165}],548:[function(_dereq_,module,exports){
  29658. var parent = _dereq_('../../../es/array/virtual/entries');
  29659. module.exports = parent;
  29660. },{"../../../es/array/virtual/entries":167}],549:[function(_dereq_,module,exports){
  29661. var parent = _dereq_('../../../es/array/virtual/for-each');
  29662. module.exports = parent;
  29663. },{"../../../es/array/virtual/for-each":172}],550:[function(_dereq_,module,exports){
  29664. var parent = _dereq_('../../../es/array/virtual/keys');
  29665. module.exports = parent;
  29666. },{"../../../es/array/virtual/keys":175}],551:[function(_dereq_,module,exports){
  29667. var parent = _dereq_('../../../es/array/virtual/values');
  29668. module.exports = parent;
  29669. },{"../../../es/array/virtual/values":182}],552:[function(_dereq_,module,exports){
  29670. var parent = _dereq_('../es/get-iterator-method');
  29671. _dereq_('../modules/web.dom-collections.iterator');
  29672. module.exports = parent;
  29673. },{"../es/get-iterator-method":184,"../modules/web.dom-collections.iterator":542}],553:[function(_dereq_,module,exports){
  29674. var parent = _dereq_('../../es/instance/bind');
  29675. module.exports = parent;
  29676. },{"../../es/instance/bind":185}],554:[function(_dereq_,module,exports){
  29677. var parent = _dereq_('../../es/instance/concat');
  29678. module.exports = parent;
  29679. },{"../../es/instance/concat":186}],555:[function(_dereq_,module,exports){
  29680. _dereq_('../../modules/web.dom-collections.iterator');
  29681. var classof = _dereq_('../../internals/classof');
  29682. var hasOwn = _dereq_('../../internals/has-own-property');
  29683. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  29684. var method = _dereq_('../array/virtual/entries');
  29685. var ArrayPrototype = Array.prototype;
  29686. var DOMIterables = {
  29687. DOMTokenList: true,
  29688. NodeList: true
  29689. };
  29690. module.exports = function (it) {
  29691. var own = it.entries;
  29692. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.entries)
  29693. || hasOwn(DOMIterables, classof(it)) ? method : own;
  29694. };
  29695. },{"../../internals/classof":282,"../../internals/has-own-property":335,"../../internals/object-is-prototype-of":382,"../../modules/web.dom-collections.iterator":542,"../array/virtual/entries":548}],556:[function(_dereq_,module,exports){
  29696. var parent = _dereq_('../../es/instance/every');
  29697. module.exports = parent;
  29698. },{"../../es/instance/every":187}],557:[function(_dereq_,module,exports){
  29699. var parent = _dereq_('../../es/instance/filter');
  29700. module.exports = parent;
  29701. },{"../../es/instance/filter":188}],558:[function(_dereq_,module,exports){
  29702. var parent = _dereq_('../../es/instance/find-index');
  29703. module.exports = parent;
  29704. },{"../../es/instance/find-index":189}],559:[function(_dereq_,module,exports){
  29705. var parent = _dereq_('../../es/instance/find');
  29706. module.exports = parent;
  29707. },{"../../es/instance/find":190}],560:[function(_dereq_,module,exports){
  29708. _dereq_('../../modules/web.dom-collections.iterator');
  29709. var classof = _dereq_('../../internals/classof');
  29710. var hasOwn = _dereq_('../../internals/has-own-property');
  29711. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  29712. var method = _dereq_('../array/virtual/for-each');
  29713. var ArrayPrototype = Array.prototype;
  29714. var DOMIterables = {
  29715. DOMTokenList: true,
  29716. NodeList: true
  29717. };
  29718. module.exports = function (it) {
  29719. var own = it.forEach;
  29720. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.forEach)
  29721. || hasOwn(DOMIterables, classof(it)) ? method : own;
  29722. };
  29723. },{"../../internals/classof":282,"../../internals/has-own-property":335,"../../internals/object-is-prototype-of":382,"../../modules/web.dom-collections.iterator":542,"../array/virtual/for-each":549}],561:[function(_dereq_,module,exports){
  29724. var parent = _dereq_('../../es/instance/includes');
  29725. module.exports = parent;
  29726. },{"../../es/instance/includes":191}],562:[function(_dereq_,module,exports){
  29727. var parent = _dereq_('../../es/instance/index-of');
  29728. module.exports = parent;
  29729. },{"../../es/instance/index-of":192}],563:[function(_dereq_,module,exports){
  29730. _dereq_('../../modules/web.dom-collections.iterator');
  29731. var classof = _dereq_('../../internals/classof');
  29732. var hasOwn = _dereq_('../../internals/has-own-property');
  29733. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  29734. var method = _dereq_('../array/virtual/keys');
  29735. var ArrayPrototype = Array.prototype;
  29736. var DOMIterables = {
  29737. DOMTokenList: true,
  29738. NodeList: true
  29739. };
  29740. module.exports = function (it) {
  29741. var own = it.keys;
  29742. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
  29743. || hasOwn(DOMIterables, classof(it)) ? method : own;
  29744. };
  29745. },{"../../internals/classof":282,"../../internals/has-own-property":335,"../../internals/object-is-prototype-of":382,"../../modules/web.dom-collections.iterator":542,"../array/virtual/keys":550}],564:[function(_dereq_,module,exports){
  29746. var parent = _dereq_('../../es/instance/map');
  29747. module.exports = parent;
  29748. },{"../../es/instance/map":193}],565:[function(_dereq_,module,exports){
  29749. var parent = _dereq_('../../es/instance/reduce');
  29750. module.exports = parent;
  29751. },{"../../es/instance/reduce":194}],566:[function(_dereq_,module,exports){
  29752. var parent = _dereq_('../../es/instance/reverse');
  29753. module.exports = parent;
  29754. },{"../../es/instance/reverse":195}],567:[function(_dereq_,module,exports){
  29755. var parent = _dereq_('../../es/instance/slice');
  29756. module.exports = parent;
  29757. },{"../../es/instance/slice":196}],568:[function(_dereq_,module,exports){
  29758. var parent = _dereq_('../../es/instance/sort');
  29759. module.exports = parent;
  29760. },{"../../es/instance/sort":197}],569:[function(_dereq_,module,exports){
  29761. var parent = _dereq_('../../es/instance/splice');
  29762. module.exports = parent;
  29763. },{"../../es/instance/splice":198}],570:[function(_dereq_,module,exports){
  29764. var parent = _dereq_('../../es/instance/starts-with');
  29765. module.exports = parent;
  29766. },{"../../es/instance/starts-with":199}],571:[function(_dereq_,module,exports){
  29767. _dereq_('../../modules/web.dom-collections.iterator');
  29768. var classof = _dereq_('../../internals/classof');
  29769. var hasOwn = _dereq_('../../internals/has-own-property');
  29770. var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
  29771. var method = _dereq_('../array/virtual/values');
  29772. var ArrayPrototype = Array.prototype;
  29773. var DOMIterables = {
  29774. DOMTokenList: true,
  29775. NodeList: true
  29776. };
  29777. module.exports = function (it) {
  29778. var own = it.values;
  29779. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.values)
  29780. || hasOwn(DOMIterables, classof(it)) ? method : own;
  29781. };
  29782. },{"../../internals/classof":282,"../../internals/has-own-property":335,"../../internals/object-is-prototype-of":382,"../../modules/web.dom-collections.iterator":542,"../array/virtual/values":551}],572:[function(_dereq_,module,exports){
  29783. var parent = _dereq_('../../es/json/stringify');
  29784. module.exports = parent;
  29785. },{"../../es/json/stringify":200}],573:[function(_dereq_,module,exports){
  29786. var parent = _dereq_('../../es/map');
  29787. _dereq_('../../modules/web.dom-collections.iterator');
  29788. module.exports = parent;
  29789. },{"../../es/map":201,"../../modules/web.dom-collections.iterator":542}],574:[function(_dereq_,module,exports){
  29790. var parent = _dereq_('../../es/number/is-integer');
  29791. module.exports = parent;
  29792. },{"../../es/number/is-integer":202}],575:[function(_dereq_,module,exports){
  29793. var parent = _dereq_('../../es/object/assign');
  29794. module.exports = parent;
  29795. },{"../../es/object/assign":203}],576:[function(_dereq_,module,exports){
  29796. var parent = _dereq_('../../es/object/create');
  29797. module.exports = parent;
  29798. },{"../../es/object/create":204}],577:[function(_dereq_,module,exports){
  29799. var parent = _dereq_('../../es/object/define-properties');
  29800. module.exports = parent;
  29801. },{"../../es/object/define-properties":205}],578:[function(_dereq_,module,exports){
  29802. var parent = _dereq_('../../es/object/define-property');
  29803. module.exports = parent;
  29804. },{"../../es/object/define-property":206}],579:[function(_dereq_,module,exports){
  29805. var parent = _dereq_('../../es/object/entries');
  29806. module.exports = parent;
  29807. },{"../../es/object/entries":207}],580:[function(_dereq_,module,exports){
  29808. var parent = _dereq_('../../es/object/freeze');
  29809. module.exports = parent;
  29810. },{"../../es/object/freeze":208}],581:[function(_dereq_,module,exports){
  29811. var parent = _dereq_('../../es/object/get-own-property-descriptor');
  29812. module.exports = parent;
  29813. },{"../../es/object/get-own-property-descriptor":209}],582:[function(_dereq_,module,exports){
  29814. var parent = _dereq_('../../es/object/get-own-property-descriptors');
  29815. module.exports = parent;
  29816. },{"../../es/object/get-own-property-descriptors":210}],583:[function(_dereq_,module,exports){
  29817. var parent = _dereq_('../../es/object/get-own-property-symbols');
  29818. module.exports = parent;
  29819. },{"../../es/object/get-own-property-symbols":211}],584:[function(_dereq_,module,exports){
  29820. var parent = _dereq_('../../es/object/get-prototype-of');
  29821. module.exports = parent;
  29822. },{"../../es/object/get-prototype-of":212}],585:[function(_dereq_,module,exports){
  29823. var parent = _dereq_('../../es/object/keys');
  29824. module.exports = parent;
  29825. },{"../../es/object/keys":213}],586:[function(_dereq_,module,exports){
  29826. var parent = _dereq_('../../es/object/set-prototype-of');
  29827. module.exports = parent;
  29828. },{"../../es/object/set-prototype-of":214}],587:[function(_dereq_,module,exports){
  29829. var parent = _dereq_('../es/parse-int');
  29830. module.exports = parent;
  29831. },{"../es/parse-int":215}],588:[function(_dereq_,module,exports){
  29832. var parent = _dereq_('../../es/promise');
  29833. _dereq_('../../modules/web.dom-collections.iterator');
  29834. module.exports = parent;
  29835. },{"../../es/promise":216,"../../modules/web.dom-collections.iterator":542}],589:[function(_dereq_,module,exports){
  29836. var parent = _dereq_('../../es/reflect/construct');
  29837. module.exports = parent;
  29838. },{"../../es/reflect/construct":217}],590:[function(_dereq_,module,exports){
  29839. var parent = _dereq_('../../es/reflect/get');
  29840. module.exports = parent;
  29841. },{"../../es/reflect/get":218}],591:[function(_dereq_,module,exports){
  29842. _dereq_('../modules/web.timers');
  29843. var path = _dereq_('../internals/path');
  29844. module.exports = path.setInterval;
  29845. },{"../internals/path":391,"../modules/web.timers":545}],592:[function(_dereq_,module,exports){
  29846. _dereq_('../modules/web.timers');
  29847. var path = _dereq_('../internals/path');
  29848. module.exports = path.setTimeout;
  29849. },{"../internals/path":391,"../modules/web.timers":545}],593:[function(_dereq_,module,exports){
  29850. var parent = _dereq_('../../es/set');
  29851. _dereq_('../../modules/web.dom-collections.iterator');
  29852. module.exports = parent;
  29853. },{"../../es/set":219,"../../modules/web.dom-collections.iterator":542}],594:[function(_dereq_,module,exports){
  29854. var parent = _dereq_('../../es/symbol');
  29855. _dereq_('../../modules/web.dom-collections.iterator');
  29856. module.exports = parent;
  29857. },{"../../es/symbol":222,"../../modules/web.dom-collections.iterator":542}],595:[function(_dereq_,module,exports){
  29858. var parent = _dereq_('../../es/symbol/iterator');
  29859. _dereq_('../../modules/web.dom-collections.iterator');
  29860. module.exports = parent;
  29861. },{"../../es/symbol/iterator":223,"../../modules/web.dom-collections.iterator":542}],596:[function(_dereq_,module,exports){
  29862. var parent = _dereq_('../../es/weak-map');
  29863. _dereq_('../../modules/web.dom-collections.iterator');
  29864. module.exports = parent;
  29865. },{"../../es/weak-map":224,"../../modules/web.dom-collections.iterator":542}],597:[function(_dereq_,module,exports){
  29866. ;(function (root, factory, undef) {
  29867. if (typeof exports === "object") {
  29868. // CommonJS
  29869. module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
  29870. }
  29871. else if (typeof define === "function" && define.amd) {
  29872. // AMD
  29873. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  29874. }
  29875. else {
  29876. // Global (browser)
  29877. factory(root.CryptoJS);
  29878. }
  29879. }(this, function (CryptoJS) {
  29880. (function () {
  29881. // Shortcuts
  29882. var C = CryptoJS;
  29883. var C_lib = C.lib;
  29884. var BlockCipher = C_lib.BlockCipher;
  29885. var C_algo = C.algo;
  29886. // Lookup tables
  29887. var SBOX = [];
  29888. var INV_SBOX = [];
  29889. var SUB_MIX_0 = [];
  29890. var SUB_MIX_1 = [];
  29891. var SUB_MIX_2 = [];
  29892. var SUB_MIX_3 = [];
  29893. var INV_SUB_MIX_0 = [];
  29894. var INV_SUB_MIX_1 = [];
  29895. var INV_SUB_MIX_2 = [];
  29896. var INV_SUB_MIX_3 = [];
  29897. // Compute lookup tables
  29898. (function () {
  29899. // Compute double table
  29900. var d = [];
  29901. for (var i = 0; i < 256; i++) {
  29902. if (i < 128) {
  29903. d[i] = i << 1;
  29904. } else {
  29905. d[i] = (i << 1) ^ 0x11b;
  29906. }
  29907. }
  29908. // Walk GF(2^8)
  29909. var x = 0;
  29910. var xi = 0;
  29911. for (var i = 0; i < 256; i++) {
  29912. // Compute sbox
  29913. var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  29914. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  29915. SBOX[x] = sx;
  29916. INV_SBOX[sx] = x;
  29917. // Compute multiplication
  29918. var x2 = d[x];
  29919. var x4 = d[x2];
  29920. var x8 = d[x4];
  29921. // Compute sub bytes, mix columns tables
  29922. var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  29923. SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  29924. SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  29925. SUB_MIX_2[x] = (t << 8) | (t >>> 24);
  29926. SUB_MIX_3[x] = t;
  29927. // Compute inv sub bytes, inv mix columns tables
  29928. var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  29929. INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  29930. INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  29931. INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
  29932. INV_SUB_MIX_3[sx] = t;
  29933. // Compute next counter
  29934. if (!x) {
  29935. x = xi = 1;
  29936. } else {
  29937. x = x2 ^ d[d[d[x8 ^ x2]]];
  29938. xi ^= d[d[xi]];
  29939. }
  29940. }
  29941. }());
  29942. // Precomputed Rcon lookup
  29943. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  29944. /**
  29945. * AES block cipher algorithm.
  29946. */
  29947. var AES = C_algo.AES = BlockCipher.extend({
  29948. _doReset: function () {
  29949. var t;
  29950. // Skip reset of nRounds has been set before and key did not change
  29951. if (this._nRounds && this._keyPriorReset === this._key) {
  29952. return;
  29953. }
  29954. // Shortcuts
  29955. var key = this._keyPriorReset = this._key;
  29956. var keyWords = key.words;
  29957. var keySize = key.sigBytes / 4;
  29958. // Compute number of rounds
  29959. var nRounds = this._nRounds = keySize + 6;
  29960. // Compute number of key schedule rows
  29961. var ksRows = (nRounds + 1) * 4;
  29962. // Compute key schedule
  29963. var keySchedule = this._keySchedule = [];
  29964. for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  29965. if (ksRow < keySize) {
  29966. keySchedule[ksRow] = keyWords[ksRow];
  29967. } else {
  29968. t = keySchedule[ksRow - 1];
  29969. if (!(ksRow % keySize)) {
  29970. // Rot word
  29971. t = (t << 8) | (t >>> 24);
  29972. // Sub word
  29973. t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  29974. // Mix Rcon
  29975. t ^= RCON[(ksRow / keySize) | 0] << 24;
  29976. } else if (keySize > 6 && ksRow % keySize == 4) {
  29977. // Sub word
  29978. t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  29979. }
  29980. keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  29981. }
  29982. }
  29983. // Compute inv key schedule
  29984. var invKeySchedule = this._invKeySchedule = [];
  29985. for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  29986. var ksRow = ksRows - invKsRow;
  29987. if (invKsRow % 4) {
  29988. var t = keySchedule[ksRow];
  29989. } else {
  29990. var t = keySchedule[ksRow - 4];
  29991. }
  29992. if (invKsRow < 4 || ksRow <= 4) {
  29993. invKeySchedule[invKsRow] = t;
  29994. } else {
  29995. invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  29996. INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  29997. }
  29998. }
  29999. },
  30000. encryptBlock: function (M, offset) {
  30001. this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  30002. },
  30003. decryptBlock: function (M, offset) {
  30004. // Swap 2nd and 4th rows
  30005. var t = M[offset + 1];
  30006. M[offset + 1] = M[offset + 3];
  30007. M[offset + 3] = t;
  30008. this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  30009. // Inv swap 2nd and 4th rows
  30010. var t = M[offset + 1];
  30011. M[offset + 1] = M[offset + 3];
  30012. M[offset + 3] = t;
  30013. },
  30014. _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  30015. // Shortcut
  30016. var nRounds = this._nRounds;
  30017. // Get input, add round key
  30018. var s0 = M[offset] ^ keySchedule[0];
  30019. var s1 = M[offset + 1] ^ keySchedule[1];
  30020. var s2 = M[offset + 2] ^ keySchedule[2];
  30021. var s3 = M[offset + 3] ^ keySchedule[3];
  30022. // Key schedule row counter
  30023. var ksRow = 4;
  30024. // Rounds
  30025. for (var round = 1; round < nRounds; round++) {
  30026. // Shift rows, sub bytes, mix columns, add round key
  30027. var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
  30028. var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
  30029. var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
  30030. var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
  30031. // Update state
  30032. s0 = t0;
  30033. s1 = t1;
  30034. s2 = t2;
  30035. s3 = t3;
  30036. }
  30037. // Shift rows, sub bytes, add round key
  30038. var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  30039. var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  30040. var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  30041. var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  30042. // Set output
  30043. M[offset] = t0;
  30044. M[offset + 1] = t1;
  30045. M[offset + 2] = t2;
  30046. M[offset + 3] = t3;
  30047. },
  30048. keySize: 256/32
  30049. });
  30050. /**
  30051. * Shortcut functions to the cipher's object interface.
  30052. *
  30053. * @example
  30054. *
  30055. * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  30056. * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  30057. */
  30058. C.AES = BlockCipher._createHelper(AES);
  30059. }());
  30060. return CryptoJS.AES;
  30061. }));
  30062. },{"./cipher-core":598,"./core":599,"./enc-base64":600,"./evpkdf":602,"./md5":604}],598:[function(_dereq_,module,exports){
  30063. ;(function (root, factory, undef) {
  30064. if (typeof exports === "object") {
  30065. // CommonJS
  30066. module.exports = exports = factory(_dereq_("./core"), _dereq_("./evpkdf"));
  30067. }
  30068. else if (typeof define === "function" && define.amd) {
  30069. // AMD
  30070. define(["./core", "./evpkdf"], factory);
  30071. }
  30072. else {
  30073. // Global (browser)
  30074. factory(root.CryptoJS);
  30075. }
  30076. }(this, function (CryptoJS) {
  30077. /**
  30078. * Cipher core components.
  30079. */
  30080. CryptoJS.lib.Cipher || (function (undefined) {
  30081. // Shortcuts
  30082. var C = CryptoJS;
  30083. var C_lib = C.lib;
  30084. var Base = C_lib.Base;
  30085. var WordArray = C_lib.WordArray;
  30086. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  30087. var C_enc = C.enc;
  30088. var Utf8 = C_enc.Utf8;
  30089. var Base64 = C_enc.Base64;
  30090. var C_algo = C.algo;
  30091. var EvpKDF = C_algo.EvpKDF;
  30092. /**
  30093. * Abstract base cipher template.
  30094. *
  30095. * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  30096. * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  30097. * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  30098. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  30099. */
  30100. var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
  30101. /**
  30102. * Configuration options.
  30103. *
  30104. * @property {WordArray} iv The IV to use for this operation.
  30105. */
  30106. cfg: Base.extend(),
  30107. /**
  30108. * Creates this cipher in encryption mode.
  30109. *
  30110. * @param {WordArray} key The key.
  30111. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30112. *
  30113. * @return {Cipher} A cipher instance.
  30114. *
  30115. * @static
  30116. *
  30117. * @example
  30118. *
  30119. * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  30120. */
  30121. createEncryptor: function (key, cfg) {
  30122. return this.create(this._ENC_XFORM_MODE, key, cfg);
  30123. },
  30124. /**
  30125. * Creates this cipher in decryption mode.
  30126. *
  30127. * @param {WordArray} key The key.
  30128. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30129. *
  30130. * @return {Cipher} A cipher instance.
  30131. *
  30132. * @static
  30133. *
  30134. * @example
  30135. *
  30136. * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  30137. */
  30138. createDecryptor: function (key, cfg) {
  30139. return this.create(this._DEC_XFORM_MODE, key, cfg);
  30140. },
  30141. /**
  30142. * Initializes a newly created cipher.
  30143. *
  30144. * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  30145. * @param {WordArray} key The key.
  30146. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30147. *
  30148. * @example
  30149. *
  30150. * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  30151. */
  30152. init: function (xformMode, key, cfg) {
  30153. // Apply config defaults
  30154. this.cfg = this.cfg.extend(cfg);
  30155. // Store transform mode and key
  30156. this._xformMode = xformMode;
  30157. this._key = key;
  30158. // Set initial values
  30159. this.reset();
  30160. },
  30161. /**
  30162. * Resets this cipher to its initial state.
  30163. *
  30164. * @example
  30165. *
  30166. * cipher.reset();
  30167. */
  30168. reset: function () {
  30169. // Reset data buffer
  30170. BufferedBlockAlgorithm.reset.call(this);
  30171. // Perform concrete-cipher logic
  30172. this._doReset();
  30173. },
  30174. /**
  30175. * Adds data to be encrypted or decrypted.
  30176. *
  30177. * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  30178. *
  30179. * @return {WordArray} The data after processing.
  30180. *
  30181. * @example
  30182. *
  30183. * var encrypted = cipher.process('data');
  30184. * var encrypted = cipher.process(wordArray);
  30185. */
  30186. process: function (dataUpdate) {
  30187. // Append
  30188. this._append(dataUpdate);
  30189. // Process available blocks
  30190. return this._process();
  30191. },
  30192. /**
  30193. * Finalizes the encryption or decryption process.
  30194. * Note that the finalize operation is effectively a destructive, read-once operation.
  30195. *
  30196. * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  30197. *
  30198. * @return {WordArray} The data after final processing.
  30199. *
  30200. * @example
  30201. *
  30202. * var encrypted = cipher.finalize();
  30203. * var encrypted = cipher.finalize('data');
  30204. * var encrypted = cipher.finalize(wordArray);
  30205. */
  30206. finalize: function (dataUpdate) {
  30207. // Final data update
  30208. if (dataUpdate) {
  30209. this._append(dataUpdate);
  30210. }
  30211. // Perform concrete-cipher logic
  30212. var finalProcessedData = this._doFinalize();
  30213. return finalProcessedData;
  30214. },
  30215. keySize: 128/32,
  30216. ivSize: 128/32,
  30217. _ENC_XFORM_MODE: 1,
  30218. _DEC_XFORM_MODE: 2,
  30219. /**
  30220. * Creates shortcut functions to a cipher's object interface.
  30221. *
  30222. * @param {Cipher} cipher The cipher to create a helper for.
  30223. *
  30224. * @return {Object} An object with encrypt and decrypt shortcut functions.
  30225. *
  30226. * @static
  30227. *
  30228. * @example
  30229. *
  30230. * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  30231. */
  30232. _createHelper: (function () {
  30233. function selectCipherStrategy(key) {
  30234. if (typeof key == 'string') {
  30235. return PasswordBasedCipher;
  30236. } else {
  30237. return SerializableCipher;
  30238. }
  30239. }
  30240. return function (cipher) {
  30241. return {
  30242. encrypt: function (message, key, cfg) {
  30243. return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
  30244. },
  30245. decrypt: function (ciphertext, key, cfg) {
  30246. return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
  30247. }
  30248. };
  30249. };
  30250. }())
  30251. });
  30252. /**
  30253. * Abstract base stream cipher template.
  30254. *
  30255. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  30256. */
  30257. var StreamCipher = C_lib.StreamCipher = Cipher.extend({
  30258. _doFinalize: function () {
  30259. // Process partial blocks
  30260. var finalProcessedBlocks = this._process(!!'flush');
  30261. return finalProcessedBlocks;
  30262. },
  30263. blockSize: 1
  30264. });
  30265. /**
  30266. * Mode namespace.
  30267. */
  30268. var C_mode = C.mode = {};
  30269. /**
  30270. * Abstract base block cipher mode template.
  30271. */
  30272. var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
  30273. /**
  30274. * Creates this mode for encryption.
  30275. *
  30276. * @param {Cipher} cipher A block cipher instance.
  30277. * @param {Array} iv The IV words.
  30278. *
  30279. * @static
  30280. *
  30281. * @example
  30282. *
  30283. * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  30284. */
  30285. createEncryptor: function (cipher, iv) {
  30286. return this.Encryptor.create(cipher, iv);
  30287. },
  30288. /**
  30289. * Creates this mode for decryption.
  30290. *
  30291. * @param {Cipher} cipher A block cipher instance.
  30292. * @param {Array} iv The IV words.
  30293. *
  30294. * @static
  30295. *
  30296. * @example
  30297. *
  30298. * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  30299. */
  30300. createDecryptor: function (cipher, iv) {
  30301. return this.Decryptor.create(cipher, iv);
  30302. },
  30303. /**
  30304. * Initializes a newly created mode.
  30305. *
  30306. * @param {Cipher} cipher A block cipher instance.
  30307. * @param {Array} iv The IV words.
  30308. *
  30309. * @example
  30310. *
  30311. * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  30312. */
  30313. init: function (cipher, iv) {
  30314. this._cipher = cipher;
  30315. this._iv = iv;
  30316. }
  30317. });
  30318. /**
  30319. * Cipher Block Chaining mode.
  30320. */
  30321. var CBC = C_mode.CBC = (function () {
  30322. /**
  30323. * Abstract base CBC mode.
  30324. */
  30325. var CBC = BlockCipherMode.extend();
  30326. /**
  30327. * CBC encryptor.
  30328. */
  30329. CBC.Encryptor = CBC.extend({
  30330. /**
  30331. * Processes the data block at offset.
  30332. *
  30333. * @param {Array} words The data words to operate on.
  30334. * @param {number} offset The offset where the block starts.
  30335. *
  30336. * @example
  30337. *
  30338. * mode.processBlock(data.words, offset);
  30339. */
  30340. processBlock: function (words, offset) {
  30341. // Shortcuts
  30342. var cipher = this._cipher;
  30343. var blockSize = cipher.blockSize;
  30344. // XOR and encrypt
  30345. xorBlock.call(this, words, offset, blockSize);
  30346. cipher.encryptBlock(words, offset);
  30347. // Remember this block to use with next block
  30348. this._prevBlock = words.slice(offset, offset + blockSize);
  30349. }
  30350. });
  30351. /**
  30352. * CBC decryptor.
  30353. */
  30354. CBC.Decryptor = CBC.extend({
  30355. /**
  30356. * Processes the data block at offset.
  30357. *
  30358. * @param {Array} words The data words to operate on.
  30359. * @param {number} offset The offset where the block starts.
  30360. *
  30361. * @example
  30362. *
  30363. * mode.processBlock(data.words, offset);
  30364. */
  30365. processBlock: function (words, offset) {
  30366. // Shortcuts
  30367. var cipher = this._cipher;
  30368. var blockSize = cipher.blockSize;
  30369. // Remember this block to use with next block
  30370. var thisBlock = words.slice(offset, offset + blockSize);
  30371. // Decrypt and XOR
  30372. cipher.decryptBlock(words, offset);
  30373. xorBlock.call(this, words, offset, blockSize);
  30374. // This block becomes the previous block
  30375. this._prevBlock = thisBlock;
  30376. }
  30377. });
  30378. function xorBlock(words, offset, blockSize) {
  30379. var block;
  30380. // Shortcut
  30381. var iv = this._iv;
  30382. // Choose mixing block
  30383. if (iv) {
  30384. block = iv;
  30385. // Remove IV for subsequent blocks
  30386. this._iv = undefined;
  30387. } else {
  30388. block = this._prevBlock;
  30389. }
  30390. // XOR blocks
  30391. for (var i = 0; i < blockSize; i++) {
  30392. words[offset + i] ^= block[i];
  30393. }
  30394. }
  30395. return CBC;
  30396. }());
  30397. /**
  30398. * Padding namespace.
  30399. */
  30400. var C_pad = C.pad = {};
  30401. /**
  30402. * PKCS #5/7 padding strategy.
  30403. */
  30404. var Pkcs7 = C_pad.Pkcs7 = {
  30405. /**
  30406. * Pads data using the algorithm defined in PKCS #5/7.
  30407. *
  30408. * @param {WordArray} data The data to pad.
  30409. * @param {number} blockSize The multiple that the data should be padded to.
  30410. *
  30411. * @static
  30412. *
  30413. * @example
  30414. *
  30415. * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  30416. */
  30417. pad: function (data, blockSize) {
  30418. // Shortcut
  30419. var blockSizeBytes = blockSize * 4;
  30420. // Count padding bytes
  30421. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  30422. // Create padding word
  30423. var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
  30424. // Create padding
  30425. var paddingWords = [];
  30426. for (var i = 0; i < nPaddingBytes; i += 4) {
  30427. paddingWords.push(paddingWord);
  30428. }
  30429. var padding = WordArray.create(paddingWords, nPaddingBytes);
  30430. // Add padding
  30431. data.concat(padding);
  30432. },
  30433. /**
  30434. * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  30435. *
  30436. * @param {WordArray} data The data to unpad.
  30437. *
  30438. * @static
  30439. *
  30440. * @example
  30441. *
  30442. * CryptoJS.pad.Pkcs7.unpad(wordArray);
  30443. */
  30444. unpad: function (data) {
  30445. // Get number of padding bytes from last byte
  30446. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  30447. // Remove padding
  30448. data.sigBytes -= nPaddingBytes;
  30449. }
  30450. };
  30451. /**
  30452. * Abstract base block cipher template.
  30453. *
  30454. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  30455. */
  30456. var BlockCipher = C_lib.BlockCipher = Cipher.extend({
  30457. /**
  30458. * Configuration options.
  30459. *
  30460. * @property {Mode} mode The block mode to use. Default: CBC
  30461. * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  30462. */
  30463. cfg: Cipher.cfg.extend({
  30464. mode: CBC,
  30465. padding: Pkcs7
  30466. }),
  30467. reset: function () {
  30468. var modeCreator;
  30469. // Reset cipher
  30470. Cipher.reset.call(this);
  30471. // Shortcuts
  30472. var cfg = this.cfg;
  30473. var iv = cfg.iv;
  30474. var mode = cfg.mode;
  30475. // Reset block mode
  30476. if (this._xformMode == this._ENC_XFORM_MODE) {
  30477. modeCreator = mode.createEncryptor;
  30478. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  30479. modeCreator = mode.createDecryptor;
  30480. // Keep at least one block in the buffer for unpadding
  30481. this._minBufferSize = 1;
  30482. }
  30483. if (this._mode && this._mode.__creator == modeCreator) {
  30484. this._mode.init(this, iv && iv.words);
  30485. } else {
  30486. this._mode = modeCreator.call(mode, this, iv && iv.words);
  30487. this._mode.__creator = modeCreator;
  30488. }
  30489. },
  30490. _doProcessBlock: function (words, offset) {
  30491. this._mode.processBlock(words, offset);
  30492. },
  30493. _doFinalize: function () {
  30494. var finalProcessedBlocks;
  30495. // Shortcut
  30496. var padding = this.cfg.padding;
  30497. // Finalize
  30498. if (this._xformMode == this._ENC_XFORM_MODE) {
  30499. // Pad data
  30500. padding.pad(this._data, this.blockSize);
  30501. // Process final blocks
  30502. finalProcessedBlocks = this._process(!!'flush');
  30503. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  30504. // Process final blocks
  30505. finalProcessedBlocks = this._process(!!'flush');
  30506. // Unpad data
  30507. padding.unpad(finalProcessedBlocks);
  30508. }
  30509. return finalProcessedBlocks;
  30510. },
  30511. blockSize: 128/32
  30512. });
  30513. /**
  30514. * A collection of cipher parameters.
  30515. *
  30516. * @property {WordArray} ciphertext The raw ciphertext.
  30517. * @property {WordArray} key The key to this ciphertext.
  30518. * @property {WordArray} iv The IV used in the ciphering operation.
  30519. * @property {WordArray} salt The salt used with a key derivation function.
  30520. * @property {Cipher} algorithm The cipher algorithm.
  30521. * @property {Mode} mode The block mode used in the ciphering operation.
  30522. * @property {Padding} padding The padding scheme used in the ciphering operation.
  30523. * @property {number} blockSize The block size of the cipher.
  30524. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  30525. */
  30526. var CipherParams = C_lib.CipherParams = Base.extend({
  30527. /**
  30528. * Initializes a newly created cipher params object.
  30529. *
  30530. * @param {Object} cipherParams An object with any of the possible cipher parameters.
  30531. *
  30532. * @example
  30533. *
  30534. * var cipherParams = CryptoJS.lib.CipherParams.create({
  30535. * ciphertext: ciphertextWordArray,
  30536. * key: keyWordArray,
  30537. * iv: ivWordArray,
  30538. * salt: saltWordArray,
  30539. * algorithm: CryptoJS.algo.AES,
  30540. * mode: CryptoJS.mode.CBC,
  30541. * padding: CryptoJS.pad.PKCS7,
  30542. * blockSize: 4,
  30543. * formatter: CryptoJS.format.OpenSSL
  30544. * });
  30545. */
  30546. init: function (cipherParams) {
  30547. this.mixIn(cipherParams);
  30548. },
  30549. /**
  30550. * Converts this cipher params object to a string.
  30551. *
  30552. * @param {Format} formatter (Optional) The formatting strategy to use.
  30553. *
  30554. * @return {string} The stringified cipher params.
  30555. *
  30556. * @throws Error If neither the formatter nor the default formatter is set.
  30557. *
  30558. * @example
  30559. *
  30560. * var string = cipherParams + '';
  30561. * var string = cipherParams.toString();
  30562. * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  30563. */
  30564. toString: function (formatter) {
  30565. return (formatter || this.formatter).stringify(this);
  30566. }
  30567. });
  30568. /**
  30569. * Format namespace.
  30570. */
  30571. var C_format = C.format = {};
  30572. /**
  30573. * OpenSSL formatting strategy.
  30574. */
  30575. var OpenSSLFormatter = C_format.OpenSSL = {
  30576. /**
  30577. * Converts a cipher params object to an OpenSSL-compatible string.
  30578. *
  30579. * @param {CipherParams} cipherParams The cipher params object.
  30580. *
  30581. * @return {string} The OpenSSL-compatible string.
  30582. *
  30583. * @static
  30584. *
  30585. * @example
  30586. *
  30587. * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  30588. */
  30589. stringify: function (cipherParams) {
  30590. var wordArray;
  30591. // Shortcuts
  30592. var ciphertext = cipherParams.ciphertext;
  30593. var salt = cipherParams.salt;
  30594. // Format
  30595. if (salt) {
  30596. wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
  30597. } else {
  30598. wordArray = ciphertext;
  30599. }
  30600. return wordArray.toString(Base64);
  30601. },
  30602. /**
  30603. * Converts an OpenSSL-compatible string to a cipher params object.
  30604. *
  30605. * @param {string} openSSLStr The OpenSSL-compatible string.
  30606. *
  30607. * @return {CipherParams} The cipher params object.
  30608. *
  30609. * @static
  30610. *
  30611. * @example
  30612. *
  30613. * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  30614. */
  30615. parse: function (openSSLStr) {
  30616. var salt;
  30617. // Parse base64
  30618. var ciphertext = Base64.parse(openSSLStr);
  30619. // Shortcut
  30620. var ciphertextWords = ciphertext.words;
  30621. // Test for salt
  30622. if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
  30623. // Extract salt
  30624. salt = WordArray.create(ciphertextWords.slice(2, 4));
  30625. // Remove salt from ciphertext
  30626. ciphertextWords.splice(0, 4);
  30627. ciphertext.sigBytes -= 16;
  30628. }
  30629. return CipherParams.create({ ciphertext: ciphertext, salt: salt });
  30630. }
  30631. };
  30632. /**
  30633. * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  30634. */
  30635. var SerializableCipher = C_lib.SerializableCipher = Base.extend({
  30636. /**
  30637. * Configuration options.
  30638. *
  30639. * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  30640. */
  30641. cfg: Base.extend({
  30642. format: OpenSSLFormatter
  30643. }),
  30644. /**
  30645. * Encrypts a message.
  30646. *
  30647. * @param {Cipher} cipher The cipher algorithm to use.
  30648. * @param {WordArray|string} message The message to encrypt.
  30649. * @param {WordArray} key The key.
  30650. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30651. *
  30652. * @return {CipherParams} A cipher params object.
  30653. *
  30654. * @static
  30655. *
  30656. * @example
  30657. *
  30658. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  30659. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  30660. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  30661. */
  30662. encrypt: function (cipher, message, key, cfg) {
  30663. // Apply config defaults
  30664. cfg = this.cfg.extend(cfg);
  30665. // Encrypt
  30666. var encryptor = cipher.createEncryptor(key, cfg);
  30667. var ciphertext = encryptor.finalize(message);
  30668. // Shortcut
  30669. var cipherCfg = encryptor.cfg;
  30670. // Create and return serializable cipher params
  30671. return CipherParams.create({
  30672. ciphertext: ciphertext,
  30673. key: key,
  30674. iv: cipherCfg.iv,
  30675. algorithm: cipher,
  30676. mode: cipherCfg.mode,
  30677. padding: cipherCfg.padding,
  30678. blockSize: cipher.blockSize,
  30679. formatter: cfg.format
  30680. });
  30681. },
  30682. /**
  30683. * Decrypts serialized ciphertext.
  30684. *
  30685. * @param {Cipher} cipher The cipher algorithm to use.
  30686. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  30687. * @param {WordArray} key The key.
  30688. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30689. *
  30690. * @return {WordArray} The plaintext.
  30691. *
  30692. * @static
  30693. *
  30694. * @example
  30695. *
  30696. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  30697. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  30698. */
  30699. decrypt: function (cipher, ciphertext, key, cfg) {
  30700. // Apply config defaults
  30701. cfg = this.cfg.extend(cfg);
  30702. // Convert string to CipherParams
  30703. ciphertext = this._parse(ciphertext, cfg.format);
  30704. // Decrypt
  30705. var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
  30706. return plaintext;
  30707. },
  30708. /**
  30709. * Converts serialized ciphertext to CipherParams,
  30710. * else assumed CipherParams already and returns ciphertext unchanged.
  30711. *
  30712. * @param {CipherParams|string} ciphertext The ciphertext.
  30713. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  30714. *
  30715. * @return {CipherParams} The unserialized ciphertext.
  30716. *
  30717. * @static
  30718. *
  30719. * @example
  30720. *
  30721. * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  30722. */
  30723. _parse: function (ciphertext, format) {
  30724. if (typeof ciphertext == 'string') {
  30725. return format.parse(ciphertext, this);
  30726. } else {
  30727. return ciphertext;
  30728. }
  30729. }
  30730. });
  30731. /**
  30732. * Key derivation function namespace.
  30733. */
  30734. var C_kdf = C.kdf = {};
  30735. /**
  30736. * OpenSSL key derivation function.
  30737. */
  30738. var OpenSSLKdf = C_kdf.OpenSSL = {
  30739. /**
  30740. * Derives a key and IV from a password.
  30741. *
  30742. * @param {string} password The password to derive from.
  30743. * @param {number} keySize The size in words of the key to generate.
  30744. * @param {number} ivSize The size in words of the IV to generate.
  30745. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  30746. *
  30747. * @return {CipherParams} A cipher params object with the key, IV, and salt.
  30748. *
  30749. * @static
  30750. *
  30751. * @example
  30752. *
  30753. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  30754. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  30755. */
  30756. execute: function (password, keySize, ivSize, salt) {
  30757. // Generate random salt
  30758. if (!salt) {
  30759. salt = WordArray.random(64/8);
  30760. }
  30761. // Derive key and IV
  30762. var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
  30763. // Separate key and IV
  30764. var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
  30765. key.sigBytes = keySize * 4;
  30766. // Return params
  30767. return CipherParams.create({ key: key, iv: iv, salt: salt });
  30768. }
  30769. };
  30770. /**
  30771. * A serializable cipher wrapper that derives the key from a password,
  30772. * and returns ciphertext as a serializable cipher params object.
  30773. */
  30774. var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
  30775. /**
  30776. * Configuration options.
  30777. *
  30778. * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  30779. */
  30780. cfg: SerializableCipher.cfg.extend({
  30781. kdf: OpenSSLKdf
  30782. }),
  30783. /**
  30784. * Encrypts a message using a password.
  30785. *
  30786. * @param {Cipher} cipher The cipher algorithm to use.
  30787. * @param {WordArray|string} message The message to encrypt.
  30788. * @param {string} password The password.
  30789. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30790. *
  30791. * @return {CipherParams} A cipher params object.
  30792. *
  30793. * @static
  30794. *
  30795. * @example
  30796. *
  30797. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  30798. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  30799. */
  30800. encrypt: function (cipher, message, password, cfg) {
  30801. // Apply config defaults
  30802. cfg = this.cfg.extend(cfg);
  30803. // Derive key and other params
  30804. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
  30805. // Add IV to config
  30806. cfg.iv = derivedParams.iv;
  30807. // Encrypt
  30808. var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
  30809. // Mix in derived params
  30810. ciphertext.mixIn(derivedParams);
  30811. return ciphertext;
  30812. },
  30813. /**
  30814. * Decrypts serialized ciphertext using a password.
  30815. *
  30816. * @param {Cipher} cipher The cipher algorithm to use.
  30817. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  30818. * @param {string} password The password.
  30819. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  30820. *
  30821. * @return {WordArray} The plaintext.
  30822. *
  30823. * @static
  30824. *
  30825. * @example
  30826. *
  30827. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  30828. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  30829. */
  30830. decrypt: function (cipher, ciphertext, password, cfg) {
  30831. // Apply config defaults
  30832. cfg = this.cfg.extend(cfg);
  30833. // Convert string to CipherParams
  30834. ciphertext = this._parse(ciphertext, cfg.format);
  30835. // Derive key and other params
  30836. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
  30837. // Add IV to config
  30838. cfg.iv = derivedParams.iv;
  30839. // Decrypt
  30840. var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
  30841. return plaintext;
  30842. }
  30843. });
  30844. }());
  30845. }));
  30846. },{"./core":599,"./evpkdf":602}],599:[function(_dereq_,module,exports){
  30847. (function (global){(function (){
  30848. ;(function (root, factory) {
  30849. if (typeof exports === "object") {
  30850. // CommonJS
  30851. module.exports = exports = factory();
  30852. }
  30853. else if (typeof define === "function" && define.amd) {
  30854. // AMD
  30855. define([], factory);
  30856. }
  30857. else {
  30858. // Global (browser)
  30859. root.CryptoJS = factory();
  30860. }
  30861. }(this, function () {
  30862. /*globals window, global, require*/
  30863. /**
  30864. * CryptoJS core components.
  30865. */
  30866. var CryptoJS = CryptoJS || (function (Math, undefined) {
  30867. var crypto;
  30868. // Native crypto from window (Browser)
  30869. if (typeof window !== 'undefined' && window.crypto) {
  30870. crypto = window.crypto;
  30871. }
  30872. // Native crypto in web worker (Browser)
  30873. if (typeof self !== 'undefined' && self.crypto) {
  30874. crypto = self.crypto;
  30875. }
  30876. // Native crypto from worker
  30877. if (typeof globalThis !== 'undefined' && globalThis.crypto) {
  30878. crypto = globalThis.crypto;
  30879. }
  30880. // Native (experimental IE 11) crypto from window (Browser)
  30881. if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
  30882. crypto = window.msCrypto;
  30883. }
  30884. // Native crypto from global (NodeJS)
  30885. if (!crypto && typeof global !== 'undefined' && global.crypto) {
  30886. crypto = global.crypto;
  30887. }
  30888. // Native crypto import via require (NodeJS)
  30889. if (!crypto && typeof _dereq_ === 'function') {
  30890. try {
  30891. crypto = _dereq_('crypto');
  30892. } catch (err) {}
  30893. }
  30894. /*
  30895. * Cryptographically secure pseudorandom number generator
  30896. *
  30897. * As Math.random() is cryptographically not safe to use
  30898. */
  30899. var cryptoSecureRandomInt = function () {
  30900. if (crypto) {
  30901. // Use getRandomValues method (Browser)
  30902. if (typeof crypto.getRandomValues === 'function') {
  30903. try {
  30904. return crypto.getRandomValues(new Uint32Array(1))[0];
  30905. } catch (err) {}
  30906. }
  30907. // Use randomBytes method (NodeJS)
  30908. if (typeof crypto.randomBytes === 'function') {
  30909. try {
  30910. return crypto.randomBytes(4).readInt32LE();
  30911. } catch (err) {}
  30912. }
  30913. }
  30914. throw new Error('Native crypto module could not be used to get secure random number.');
  30915. };
  30916. /*
  30917. * Local polyfill of Object.create
  30918. */
  30919. var create = Object.create || (function () {
  30920. function F() {}
  30921. return function (obj) {
  30922. var subtype;
  30923. F.prototype = obj;
  30924. subtype = new F();
  30925. F.prototype = null;
  30926. return subtype;
  30927. };
  30928. }());
  30929. /**
  30930. * CryptoJS namespace.
  30931. */
  30932. var C = {};
  30933. /**
  30934. * Library namespace.
  30935. */
  30936. var C_lib = C.lib = {};
  30937. /**
  30938. * Base object for prototypal inheritance.
  30939. */
  30940. var Base = C_lib.Base = (function () {
  30941. return {
  30942. /**
  30943. * Creates a new object that inherits from this object.
  30944. *
  30945. * @param {Object} overrides Properties to copy into the new object.
  30946. *
  30947. * @return {Object} The new object.
  30948. *
  30949. * @static
  30950. *
  30951. * @example
  30952. *
  30953. * var MyType = CryptoJS.lib.Base.extend({
  30954. * field: 'value',
  30955. *
  30956. * method: function () {
  30957. * }
  30958. * });
  30959. */
  30960. extend: function (overrides) {
  30961. // Spawn
  30962. var subtype = create(this);
  30963. // Augment
  30964. if (overrides) {
  30965. subtype.mixIn(overrides);
  30966. }
  30967. // Create default initializer
  30968. if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  30969. subtype.init = function () {
  30970. subtype.$super.init.apply(this, arguments);
  30971. };
  30972. }
  30973. // Initializer's prototype is the subtype object
  30974. subtype.init.prototype = subtype;
  30975. // Reference supertype
  30976. subtype.$super = this;
  30977. return subtype;
  30978. },
  30979. /**
  30980. * Extends this object and runs the init method.
  30981. * Arguments to create() will be passed to init().
  30982. *
  30983. * @return {Object} The new object.
  30984. *
  30985. * @static
  30986. *
  30987. * @example
  30988. *
  30989. * var instance = MyType.create();
  30990. */
  30991. create: function () {
  30992. var instance = this.extend();
  30993. instance.init.apply(instance, arguments);
  30994. return instance;
  30995. },
  30996. /**
  30997. * Initializes a newly created object.
  30998. * Override this method to add some logic when your objects are created.
  30999. *
  31000. * @example
  31001. *
  31002. * var MyType = CryptoJS.lib.Base.extend({
  31003. * init: function () {
  31004. * // ...
  31005. * }
  31006. * });
  31007. */
  31008. init: function () {
  31009. },
  31010. /**
  31011. * Copies properties into this object.
  31012. *
  31013. * @param {Object} properties The properties to mix in.
  31014. *
  31015. * @example
  31016. *
  31017. * MyType.mixIn({
  31018. * field: 'value'
  31019. * });
  31020. */
  31021. mixIn: function (properties) {
  31022. for (var propertyName in properties) {
  31023. if (properties.hasOwnProperty(propertyName)) {
  31024. this[propertyName] = properties[propertyName];
  31025. }
  31026. }
  31027. // IE won't copy toString using the loop above
  31028. if (properties.hasOwnProperty('toString')) {
  31029. this.toString = properties.toString;
  31030. }
  31031. },
  31032. /**
  31033. * Creates a copy of this object.
  31034. *
  31035. * @return {Object} The clone.
  31036. *
  31037. * @example
  31038. *
  31039. * var clone = instance.clone();
  31040. */
  31041. clone: function () {
  31042. return this.init.prototype.extend(this);
  31043. }
  31044. };
  31045. }());
  31046. /**
  31047. * An array of 32-bit words.
  31048. *
  31049. * @property {Array} words The array of 32-bit words.
  31050. * @property {number} sigBytes The number of significant bytes in this word array.
  31051. */
  31052. var WordArray = C_lib.WordArray = Base.extend({
  31053. /**
  31054. * Initializes a newly created word array.
  31055. *
  31056. * @param {Array} words (Optional) An array of 32-bit words.
  31057. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  31058. *
  31059. * @example
  31060. *
  31061. * var wordArray = CryptoJS.lib.WordArray.create();
  31062. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  31063. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  31064. */
  31065. init: function (words, sigBytes) {
  31066. words = this.words = words || [];
  31067. if (sigBytes != undefined) {
  31068. this.sigBytes = sigBytes;
  31069. } else {
  31070. this.sigBytes = words.length * 4;
  31071. }
  31072. },
  31073. /**
  31074. * Converts this word array to a string.
  31075. *
  31076. * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  31077. *
  31078. * @return {string} The stringified word array.
  31079. *
  31080. * @example
  31081. *
  31082. * var string = wordArray + '';
  31083. * var string = wordArray.toString();
  31084. * var string = wordArray.toString(CryptoJS.enc.Utf8);
  31085. */
  31086. toString: function (encoder) {
  31087. return (encoder || Hex).stringify(this);
  31088. },
  31089. /**
  31090. * Concatenates a word array to this word array.
  31091. *
  31092. * @param {WordArray} wordArray The word array to append.
  31093. *
  31094. * @return {WordArray} This word array.
  31095. *
  31096. * @example
  31097. *
  31098. * wordArray1.concat(wordArray2);
  31099. */
  31100. concat: function (wordArray) {
  31101. // Shortcuts
  31102. var thisWords = this.words;
  31103. var thatWords = wordArray.words;
  31104. var thisSigBytes = this.sigBytes;
  31105. var thatSigBytes = wordArray.sigBytes;
  31106. // Clamp excess bits
  31107. this.clamp();
  31108. // Concat
  31109. if (thisSigBytes % 4) {
  31110. // Copy one byte at a time
  31111. for (var i = 0; i < thatSigBytes; i++) {
  31112. var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  31113. thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
  31114. }
  31115. } else {
  31116. // Copy one word at a time
  31117. for (var j = 0; j < thatSigBytes; j += 4) {
  31118. thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
  31119. }
  31120. }
  31121. this.sigBytes += thatSigBytes;
  31122. // Chainable
  31123. return this;
  31124. },
  31125. /**
  31126. * Removes insignificant bits.
  31127. *
  31128. * @example
  31129. *
  31130. * wordArray.clamp();
  31131. */
  31132. clamp: function () {
  31133. // Shortcuts
  31134. var words = this.words;
  31135. var sigBytes = this.sigBytes;
  31136. // Clamp
  31137. words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
  31138. words.length = Math.ceil(sigBytes / 4);
  31139. },
  31140. /**
  31141. * Creates a copy of this word array.
  31142. *
  31143. * @return {WordArray} The clone.
  31144. *
  31145. * @example
  31146. *
  31147. * var clone = wordArray.clone();
  31148. */
  31149. clone: function () {
  31150. var clone = Base.clone.call(this);
  31151. clone.words = this.words.slice(0);
  31152. return clone;
  31153. },
  31154. /**
  31155. * Creates a word array filled with random bytes.
  31156. *
  31157. * @param {number} nBytes The number of random bytes to generate.
  31158. *
  31159. * @return {WordArray} The random word array.
  31160. *
  31161. * @static
  31162. *
  31163. * @example
  31164. *
  31165. * var wordArray = CryptoJS.lib.WordArray.random(16);
  31166. */
  31167. random: function (nBytes) {
  31168. var words = [];
  31169. for (var i = 0; i < nBytes; i += 4) {
  31170. words.push(cryptoSecureRandomInt());
  31171. }
  31172. return new WordArray.init(words, nBytes);
  31173. }
  31174. });
  31175. /**
  31176. * Encoder namespace.
  31177. */
  31178. var C_enc = C.enc = {};
  31179. /**
  31180. * Hex encoding strategy.
  31181. */
  31182. var Hex = C_enc.Hex = {
  31183. /**
  31184. * Converts a word array to a hex string.
  31185. *
  31186. * @param {WordArray} wordArray The word array.
  31187. *
  31188. * @return {string} The hex string.
  31189. *
  31190. * @static
  31191. *
  31192. * @example
  31193. *
  31194. * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  31195. */
  31196. stringify: function (wordArray) {
  31197. // Shortcuts
  31198. var words = wordArray.words;
  31199. var sigBytes = wordArray.sigBytes;
  31200. // Convert
  31201. var hexChars = [];
  31202. for (var i = 0; i < sigBytes; i++) {
  31203. var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  31204. hexChars.push((bite >>> 4).toString(16));
  31205. hexChars.push((bite & 0x0f).toString(16));
  31206. }
  31207. return hexChars.join('');
  31208. },
  31209. /**
  31210. * Converts a hex string to a word array.
  31211. *
  31212. * @param {string} hexStr The hex string.
  31213. *
  31214. * @return {WordArray} The word array.
  31215. *
  31216. * @static
  31217. *
  31218. * @example
  31219. *
  31220. * var wordArray = CryptoJS.enc.Hex.parse(hexString);
  31221. */
  31222. parse: function (hexStr) {
  31223. // Shortcut
  31224. var hexStrLength = hexStr.length;
  31225. // Convert
  31226. var words = [];
  31227. for (var i = 0; i < hexStrLength; i += 2) {
  31228. words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
  31229. }
  31230. return new WordArray.init(words, hexStrLength / 2);
  31231. }
  31232. };
  31233. /**
  31234. * Latin1 encoding strategy.
  31235. */
  31236. var Latin1 = C_enc.Latin1 = {
  31237. /**
  31238. * Converts a word array to a Latin1 string.
  31239. *
  31240. * @param {WordArray} wordArray The word array.
  31241. *
  31242. * @return {string} The Latin1 string.
  31243. *
  31244. * @static
  31245. *
  31246. * @example
  31247. *
  31248. * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  31249. */
  31250. stringify: function (wordArray) {
  31251. // Shortcuts
  31252. var words = wordArray.words;
  31253. var sigBytes = wordArray.sigBytes;
  31254. // Convert
  31255. var latin1Chars = [];
  31256. for (var i = 0; i < sigBytes; i++) {
  31257. var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  31258. latin1Chars.push(String.fromCharCode(bite));
  31259. }
  31260. return latin1Chars.join('');
  31261. },
  31262. /**
  31263. * Converts a Latin1 string to a word array.
  31264. *
  31265. * @param {string} latin1Str The Latin1 string.
  31266. *
  31267. * @return {WordArray} The word array.
  31268. *
  31269. * @static
  31270. *
  31271. * @example
  31272. *
  31273. * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  31274. */
  31275. parse: function (latin1Str) {
  31276. // Shortcut
  31277. var latin1StrLength = latin1Str.length;
  31278. // Convert
  31279. var words = [];
  31280. for (var i = 0; i < latin1StrLength; i++) {
  31281. words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
  31282. }
  31283. return new WordArray.init(words, latin1StrLength);
  31284. }
  31285. };
  31286. /**
  31287. * UTF-8 encoding strategy.
  31288. */
  31289. var Utf8 = C_enc.Utf8 = {
  31290. /**
  31291. * Converts a word array to a UTF-8 string.
  31292. *
  31293. * @param {WordArray} wordArray The word array.
  31294. *
  31295. * @return {string} The UTF-8 string.
  31296. *
  31297. * @static
  31298. *
  31299. * @example
  31300. *
  31301. * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  31302. */
  31303. stringify: function (wordArray) {
  31304. try {
  31305. return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  31306. } catch (e) {
  31307. throw new Error('Malformed UTF-8 data');
  31308. }
  31309. },
  31310. /**
  31311. * Converts a UTF-8 string to a word array.
  31312. *
  31313. * @param {string} utf8Str The UTF-8 string.
  31314. *
  31315. * @return {WordArray} The word array.
  31316. *
  31317. * @static
  31318. *
  31319. * @example
  31320. *
  31321. * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  31322. */
  31323. parse: function (utf8Str) {
  31324. return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  31325. }
  31326. };
  31327. /**
  31328. * Abstract buffered block algorithm template.
  31329. *
  31330. * The property blockSize must be implemented in a concrete subtype.
  31331. *
  31332. * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  31333. */
  31334. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  31335. /**
  31336. * Resets this block algorithm's data buffer to its initial state.
  31337. *
  31338. * @example
  31339. *
  31340. * bufferedBlockAlgorithm.reset();
  31341. */
  31342. reset: function () {
  31343. // Initial values
  31344. this._data = new WordArray.init();
  31345. this._nDataBytes = 0;
  31346. },
  31347. /**
  31348. * Adds new data to this block algorithm's buffer.
  31349. *
  31350. * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  31351. *
  31352. * @example
  31353. *
  31354. * bufferedBlockAlgorithm._append('data');
  31355. * bufferedBlockAlgorithm._append(wordArray);
  31356. */
  31357. _append: function (data) {
  31358. // Convert string to WordArray, else assume WordArray already
  31359. if (typeof data == 'string') {
  31360. data = Utf8.parse(data);
  31361. }
  31362. // Append
  31363. this._data.concat(data);
  31364. this._nDataBytes += data.sigBytes;
  31365. },
  31366. /**
  31367. * Processes available data blocks.
  31368. *
  31369. * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  31370. *
  31371. * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  31372. *
  31373. * @return {WordArray} The processed data.
  31374. *
  31375. * @example
  31376. *
  31377. * var processedData = bufferedBlockAlgorithm._process();
  31378. * var processedData = bufferedBlockAlgorithm._process(!!'flush');
  31379. */
  31380. _process: function (doFlush) {
  31381. var processedWords;
  31382. // Shortcuts
  31383. var data = this._data;
  31384. var dataWords = data.words;
  31385. var dataSigBytes = data.sigBytes;
  31386. var blockSize = this.blockSize;
  31387. var blockSizeBytes = blockSize * 4;
  31388. // Count blocks ready
  31389. var nBlocksReady = dataSigBytes / blockSizeBytes;
  31390. if (doFlush) {
  31391. // Round up to include partial blocks
  31392. nBlocksReady = Math.ceil(nBlocksReady);
  31393. } else {
  31394. // Round down to include only full blocks,
  31395. // less the number of blocks that must remain in the buffer
  31396. nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  31397. }
  31398. // Count words ready
  31399. var nWordsReady = nBlocksReady * blockSize;
  31400. // Count bytes ready
  31401. var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  31402. // Process blocks
  31403. if (nWordsReady) {
  31404. for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  31405. // Perform concrete-algorithm logic
  31406. this._doProcessBlock(dataWords, offset);
  31407. }
  31408. // Remove processed words
  31409. processedWords = dataWords.splice(0, nWordsReady);
  31410. data.sigBytes -= nBytesReady;
  31411. }
  31412. // Return processed words
  31413. return new WordArray.init(processedWords, nBytesReady);
  31414. },
  31415. /**
  31416. * Creates a copy of this object.
  31417. *
  31418. * @return {Object} The clone.
  31419. *
  31420. * @example
  31421. *
  31422. * var clone = bufferedBlockAlgorithm.clone();
  31423. */
  31424. clone: function () {
  31425. var clone = Base.clone.call(this);
  31426. clone._data = this._data.clone();
  31427. return clone;
  31428. },
  31429. _minBufferSize: 0
  31430. });
  31431. /**
  31432. * Abstract hasher template.
  31433. *
  31434. * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  31435. */
  31436. var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  31437. /**
  31438. * Configuration options.
  31439. */
  31440. cfg: Base.extend(),
  31441. /**
  31442. * Initializes a newly created hasher.
  31443. *
  31444. * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  31445. *
  31446. * @example
  31447. *
  31448. * var hasher = CryptoJS.algo.SHA256.create();
  31449. */
  31450. init: function (cfg) {
  31451. // Apply config defaults
  31452. this.cfg = this.cfg.extend(cfg);
  31453. // Set initial values
  31454. this.reset();
  31455. },
  31456. /**
  31457. * Resets this hasher to its initial state.
  31458. *
  31459. * @example
  31460. *
  31461. * hasher.reset();
  31462. */
  31463. reset: function () {
  31464. // Reset data buffer
  31465. BufferedBlockAlgorithm.reset.call(this);
  31466. // Perform concrete-hasher logic
  31467. this._doReset();
  31468. },
  31469. /**
  31470. * Updates this hasher with a message.
  31471. *
  31472. * @param {WordArray|string} messageUpdate The message to append.
  31473. *
  31474. * @return {Hasher} This hasher.
  31475. *
  31476. * @example
  31477. *
  31478. * hasher.update('message');
  31479. * hasher.update(wordArray);
  31480. */
  31481. update: function (messageUpdate) {
  31482. // Append
  31483. this._append(messageUpdate);
  31484. // Update the hash
  31485. this._process();
  31486. // Chainable
  31487. return this;
  31488. },
  31489. /**
  31490. * Finalizes the hash computation.
  31491. * Note that the finalize operation is effectively a destructive, read-once operation.
  31492. *
  31493. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  31494. *
  31495. * @return {WordArray} The hash.
  31496. *
  31497. * @example
  31498. *
  31499. * var hash = hasher.finalize();
  31500. * var hash = hasher.finalize('message');
  31501. * var hash = hasher.finalize(wordArray);
  31502. */
  31503. finalize: function (messageUpdate) {
  31504. // Final message update
  31505. if (messageUpdate) {
  31506. this._append(messageUpdate);
  31507. }
  31508. // Perform concrete-hasher logic
  31509. var hash = this._doFinalize();
  31510. return hash;
  31511. },
  31512. blockSize: 512/32,
  31513. /**
  31514. * Creates a shortcut function to a hasher's object interface.
  31515. *
  31516. * @param {Hasher} hasher The hasher to create a helper for.
  31517. *
  31518. * @return {Function} The shortcut function.
  31519. *
  31520. * @static
  31521. *
  31522. * @example
  31523. *
  31524. * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  31525. */
  31526. _createHelper: function (hasher) {
  31527. return function (message, cfg) {
  31528. return new hasher.init(cfg).finalize(message);
  31529. };
  31530. },
  31531. /**
  31532. * Creates a shortcut function to the HMAC's object interface.
  31533. *
  31534. * @param {Hasher} hasher The hasher to use in this HMAC helper.
  31535. *
  31536. * @return {Function} The shortcut function.
  31537. *
  31538. * @static
  31539. *
  31540. * @example
  31541. *
  31542. * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  31543. */
  31544. _createHmacHelper: function (hasher) {
  31545. return function (message, key) {
  31546. return new C_algo.HMAC.init(hasher, key).finalize(message);
  31547. };
  31548. }
  31549. });
  31550. /**
  31551. * Algorithm namespace.
  31552. */
  31553. var C_algo = C.algo = {};
  31554. return C;
  31555. }(Math));
  31556. return CryptoJS;
  31557. }));
  31558. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  31559. },{"crypto":undefined}],600:[function(_dereq_,module,exports){
  31560. ;(function (root, factory) {
  31561. if (typeof exports === "object") {
  31562. // CommonJS
  31563. module.exports = exports = factory(_dereq_("./core"));
  31564. }
  31565. else if (typeof define === "function" && define.amd) {
  31566. // AMD
  31567. define(["./core"], factory);
  31568. }
  31569. else {
  31570. // Global (browser)
  31571. factory(root.CryptoJS);
  31572. }
  31573. }(this, function (CryptoJS) {
  31574. (function () {
  31575. // Shortcuts
  31576. var C = CryptoJS;
  31577. var C_lib = C.lib;
  31578. var WordArray = C_lib.WordArray;
  31579. var C_enc = C.enc;
  31580. /**
  31581. * Base64 encoding strategy.
  31582. */
  31583. var Base64 = C_enc.Base64 = {
  31584. /**
  31585. * Converts a word array to a Base64 string.
  31586. *
  31587. * @param {WordArray} wordArray The word array.
  31588. *
  31589. * @return {string} The Base64 string.
  31590. *
  31591. * @static
  31592. *
  31593. * @example
  31594. *
  31595. * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  31596. */
  31597. stringify: function (wordArray) {
  31598. // Shortcuts
  31599. var words = wordArray.words;
  31600. var sigBytes = wordArray.sigBytes;
  31601. var map = this._map;
  31602. // Clamp excess bits
  31603. wordArray.clamp();
  31604. // Convert
  31605. var base64Chars = [];
  31606. for (var i = 0; i < sigBytes; i += 3) {
  31607. var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  31608. var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  31609. var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  31610. var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  31611. for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  31612. base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  31613. }
  31614. }
  31615. // Add padding
  31616. var paddingChar = map.charAt(64);
  31617. if (paddingChar) {
  31618. while (base64Chars.length % 4) {
  31619. base64Chars.push(paddingChar);
  31620. }
  31621. }
  31622. return base64Chars.join('');
  31623. },
  31624. /**
  31625. * Converts a Base64 string to a word array.
  31626. *
  31627. * @param {string} base64Str The Base64 string.
  31628. *
  31629. * @return {WordArray} The word array.
  31630. *
  31631. * @static
  31632. *
  31633. * @example
  31634. *
  31635. * var wordArray = CryptoJS.enc.Base64.parse(base64String);
  31636. */
  31637. parse: function (base64Str) {
  31638. // Shortcuts
  31639. var base64StrLength = base64Str.length;
  31640. var map = this._map;
  31641. var reverseMap = this._reverseMap;
  31642. if (!reverseMap) {
  31643. reverseMap = this._reverseMap = [];
  31644. for (var j = 0; j < map.length; j++) {
  31645. reverseMap[map.charCodeAt(j)] = j;
  31646. }
  31647. }
  31648. // Ignore padding
  31649. var paddingChar = map.charAt(64);
  31650. if (paddingChar) {
  31651. var paddingIndex = base64Str.indexOf(paddingChar);
  31652. if (paddingIndex !== -1) {
  31653. base64StrLength = paddingIndex;
  31654. }
  31655. }
  31656. // Convert
  31657. return parseLoop(base64Str, base64StrLength, reverseMap);
  31658. },
  31659. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
  31660. };
  31661. function parseLoop(base64Str, base64StrLength, reverseMap) {
  31662. var words = [];
  31663. var nBytes = 0;
  31664. for (var i = 0; i < base64StrLength; i++) {
  31665. if (i % 4) {
  31666. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  31667. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  31668. var bitsCombined = bits1 | bits2;
  31669. words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
  31670. nBytes++;
  31671. }
  31672. }
  31673. return WordArray.create(words, nBytes);
  31674. }
  31675. }());
  31676. return CryptoJS.enc.Base64;
  31677. }));
  31678. },{"./core":599}],601:[function(_dereq_,module,exports){
  31679. ;(function (root, factory) {
  31680. if (typeof exports === "object") {
  31681. // CommonJS
  31682. module.exports = exports = factory(_dereq_("./core"));
  31683. }
  31684. else if (typeof define === "function" && define.amd) {
  31685. // AMD
  31686. define(["./core"], factory);
  31687. }
  31688. else {
  31689. // Global (browser)
  31690. factory(root.CryptoJS);
  31691. }
  31692. }(this, function (CryptoJS) {
  31693. return CryptoJS.enc.Utf8;
  31694. }));
  31695. },{"./core":599}],602:[function(_dereq_,module,exports){
  31696. ;(function (root, factory, undef) {
  31697. if (typeof exports === "object") {
  31698. // CommonJS
  31699. module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac"));
  31700. }
  31701. else if (typeof define === "function" && define.amd) {
  31702. // AMD
  31703. define(["./core", "./sha1", "./hmac"], factory);
  31704. }
  31705. else {
  31706. // Global (browser)
  31707. factory(root.CryptoJS);
  31708. }
  31709. }(this, function (CryptoJS) {
  31710. (function () {
  31711. // Shortcuts
  31712. var C = CryptoJS;
  31713. var C_lib = C.lib;
  31714. var Base = C_lib.Base;
  31715. var WordArray = C_lib.WordArray;
  31716. var C_algo = C.algo;
  31717. var MD5 = C_algo.MD5;
  31718. /**
  31719. * This key derivation function is meant to conform with EVP_BytesToKey.
  31720. * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  31721. */
  31722. var EvpKDF = C_algo.EvpKDF = Base.extend({
  31723. /**
  31724. * Configuration options.
  31725. *
  31726. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  31727. * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  31728. * @property {number} iterations The number of iterations to perform. Default: 1
  31729. */
  31730. cfg: Base.extend({
  31731. keySize: 128/32,
  31732. hasher: MD5,
  31733. iterations: 1
  31734. }),
  31735. /**
  31736. * Initializes a newly created key derivation function.
  31737. *
  31738. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  31739. *
  31740. * @example
  31741. *
  31742. * var kdf = CryptoJS.algo.EvpKDF.create();
  31743. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  31744. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  31745. */
  31746. init: function (cfg) {
  31747. this.cfg = this.cfg.extend(cfg);
  31748. },
  31749. /**
  31750. * Derives a key from a password.
  31751. *
  31752. * @param {WordArray|string} password The password.
  31753. * @param {WordArray|string} salt A salt.
  31754. *
  31755. * @return {WordArray} The derived key.
  31756. *
  31757. * @example
  31758. *
  31759. * var key = kdf.compute(password, salt);
  31760. */
  31761. compute: function (password, salt) {
  31762. var block;
  31763. // Shortcut
  31764. var cfg = this.cfg;
  31765. // Init hasher
  31766. var hasher = cfg.hasher.create();
  31767. // Initial values
  31768. var derivedKey = WordArray.create();
  31769. // Shortcuts
  31770. var derivedKeyWords = derivedKey.words;
  31771. var keySize = cfg.keySize;
  31772. var iterations = cfg.iterations;
  31773. // Generate key
  31774. while (derivedKeyWords.length < keySize) {
  31775. if (block) {
  31776. hasher.update(block);
  31777. }
  31778. block = hasher.update(password).finalize(salt);
  31779. hasher.reset();
  31780. // Iterations
  31781. for (var i = 1; i < iterations; i++) {
  31782. block = hasher.finalize(block);
  31783. hasher.reset();
  31784. }
  31785. derivedKey.concat(block);
  31786. }
  31787. derivedKey.sigBytes = keySize * 4;
  31788. return derivedKey;
  31789. }
  31790. });
  31791. /**
  31792. * Derives a key from a password.
  31793. *
  31794. * @param {WordArray|string} password The password.
  31795. * @param {WordArray|string} salt A salt.
  31796. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  31797. *
  31798. * @return {WordArray} The derived key.
  31799. *
  31800. * @static
  31801. *
  31802. * @example
  31803. *
  31804. * var key = CryptoJS.EvpKDF(password, salt);
  31805. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  31806. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  31807. */
  31808. C.EvpKDF = function (password, salt, cfg) {
  31809. return EvpKDF.create(cfg).compute(password, salt);
  31810. };
  31811. }());
  31812. return CryptoJS.EvpKDF;
  31813. }));
  31814. },{"./core":599,"./hmac":603,"./sha1":605}],603:[function(_dereq_,module,exports){
  31815. ;(function (root, factory) {
  31816. if (typeof exports === "object") {
  31817. // CommonJS
  31818. module.exports = exports = factory(_dereq_("./core"));
  31819. }
  31820. else if (typeof define === "function" && define.amd) {
  31821. // AMD
  31822. define(["./core"], factory);
  31823. }
  31824. else {
  31825. // Global (browser)
  31826. factory(root.CryptoJS);
  31827. }
  31828. }(this, function (CryptoJS) {
  31829. (function () {
  31830. // Shortcuts
  31831. var C = CryptoJS;
  31832. var C_lib = C.lib;
  31833. var Base = C_lib.Base;
  31834. var C_enc = C.enc;
  31835. var Utf8 = C_enc.Utf8;
  31836. var C_algo = C.algo;
  31837. /**
  31838. * HMAC algorithm.
  31839. */
  31840. var HMAC = C_algo.HMAC = Base.extend({
  31841. /**
  31842. * Initializes a newly created HMAC.
  31843. *
  31844. * @param {Hasher} hasher The hash algorithm to use.
  31845. * @param {WordArray|string} key The secret key.
  31846. *
  31847. * @example
  31848. *
  31849. * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  31850. */
  31851. init: function (hasher, key) {
  31852. // Init hasher
  31853. hasher = this._hasher = new hasher.init();
  31854. // Convert string to WordArray, else assume WordArray already
  31855. if (typeof key == 'string') {
  31856. key = Utf8.parse(key);
  31857. }
  31858. // Shortcuts
  31859. var hasherBlockSize = hasher.blockSize;
  31860. var hasherBlockSizeBytes = hasherBlockSize * 4;
  31861. // Allow arbitrary length keys
  31862. if (key.sigBytes > hasherBlockSizeBytes) {
  31863. key = hasher.finalize(key);
  31864. }
  31865. // Clamp excess bits
  31866. key.clamp();
  31867. // Clone key for inner and outer pads
  31868. var oKey = this._oKey = key.clone();
  31869. var iKey = this._iKey = key.clone();
  31870. // Shortcuts
  31871. var oKeyWords = oKey.words;
  31872. var iKeyWords = iKey.words;
  31873. // XOR keys with pad constants
  31874. for (var i = 0; i < hasherBlockSize; i++) {
  31875. oKeyWords[i] ^= 0x5c5c5c5c;
  31876. iKeyWords[i] ^= 0x36363636;
  31877. }
  31878. oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  31879. // Set initial values
  31880. this.reset();
  31881. },
  31882. /**
  31883. * Resets this HMAC to its initial state.
  31884. *
  31885. * @example
  31886. *
  31887. * hmacHasher.reset();
  31888. */
  31889. reset: function () {
  31890. // Shortcut
  31891. var hasher = this._hasher;
  31892. // Reset
  31893. hasher.reset();
  31894. hasher.update(this._iKey);
  31895. },
  31896. /**
  31897. * Updates this HMAC with a message.
  31898. *
  31899. * @param {WordArray|string} messageUpdate The message to append.
  31900. *
  31901. * @return {HMAC} This HMAC instance.
  31902. *
  31903. * @example
  31904. *
  31905. * hmacHasher.update('message');
  31906. * hmacHasher.update(wordArray);
  31907. */
  31908. update: function (messageUpdate) {
  31909. this._hasher.update(messageUpdate);
  31910. // Chainable
  31911. return this;
  31912. },
  31913. /**
  31914. * Finalizes the HMAC computation.
  31915. * Note that the finalize operation is effectively a destructive, read-once operation.
  31916. *
  31917. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  31918. *
  31919. * @return {WordArray} The HMAC.
  31920. *
  31921. * @example
  31922. *
  31923. * var hmac = hmacHasher.finalize();
  31924. * var hmac = hmacHasher.finalize('message');
  31925. * var hmac = hmacHasher.finalize(wordArray);
  31926. */
  31927. finalize: function (messageUpdate) {
  31928. // Shortcut
  31929. var hasher = this._hasher;
  31930. // Compute HMAC
  31931. var innerHash = hasher.finalize(messageUpdate);
  31932. hasher.reset();
  31933. var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
  31934. return hmac;
  31935. }
  31936. });
  31937. }());
  31938. }));
  31939. },{"./core":599}],604:[function(_dereq_,module,exports){
  31940. ;(function (root, factory) {
  31941. if (typeof exports === "object") {
  31942. // CommonJS
  31943. module.exports = exports = factory(_dereq_("./core"));
  31944. }
  31945. else if (typeof define === "function" && define.amd) {
  31946. // AMD
  31947. define(["./core"], factory);
  31948. }
  31949. else {
  31950. // Global (browser)
  31951. factory(root.CryptoJS);
  31952. }
  31953. }(this, function (CryptoJS) {
  31954. (function (Math) {
  31955. // Shortcuts
  31956. var C = CryptoJS;
  31957. var C_lib = C.lib;
  31958. var WordArray = C_lib.WordArray;
  31959. var Hasher = C_lib.Hasher;
  31960. var C_algo = C.algo;
  31961. // Constants table
  31962. var T = [];
  31963. // Compute constants
  31964. (function () {
  31965. for (var i = 0; i < 64; i++) {
  31966. T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
  31967. }
  31968. }());
  31969. /**
  31970. * MD5 hash algorithm.
  31971. */
  31972. var MD5 = C_algo.MD5 = Hasher.extend({
  31973. _doReset: function () {
  31974. this._hash = new WordArray.init([
  31975. 0x67452301, 0xefcdab89,
  31976. 0x98badcfe, 0x10325476
  31977. ]);
  31978. },
  31979. _doProcessBlock: function (M, offset) {
  31980. // Swap endian
  31981. for (var i = 0; i < 16; i++) {
  31982. // Shortcuts
  31983. var offset_i = offset + i;
  31984. var M_offset_i = M[offset_i];
  31985. M[offset_i] = (
  31986. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  31987. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  31988. );
  31989. }
  31990. // Shortcuts
  31991. var H = this._hash.words;
  31992. var M_offset_0 = M[offset + 0];
  31993. var M_offset_1 = M[offset + 1];
  31994. var M_offset_2 = M[offset + 2];
  31995. var M_offset_3 = M[offset + 3];
  31996. var M_offset_4 = M[offset + 4];
  31997. var M_offset_5 = M[offset + 5];
  31998. var M_offset_6 = M[offset + 6];
  31999. var M_offset_7 = M[offset + 7];
  32000. var M_offset_8 = M[offset + 8];
  32001. var M_offset_9 = M[offset + 9];
  32002. var M_offset_10 = M[offset + 10];
  32003. var M_offset_11 = M[offset + 11];
  32004. var M_offset_12 = M[offset + 12];
  32005. var M_offset_13 = M[offset + 13];
  32006. var M_offset_14 = M[offset + 14];
  32007. var M_offset_15 = M[offset + 15];
  32008. // Working varialbes
  32009. var a = H[0];
  32010. var b = H[1];
  32011. var c = H[2];
  32012. var d = H[3];
  32013. // Computation
  32014. a = FF(a, b, c, d, M_offset_0, 7, T[0]);
  32015. d = FF(d, a, b, c, M_offset_1, 12, T[1]);
  32016. c = FF(c, d, a, b, M_offset_2, 17, T[2]);
  32017. b = FF(b, c, d, a, M_offset_3, 22, T[3]);
  32018. a = FF(a, b, c, d, M_offset_4, 7, T[4]);
  32019. d = FF(d, a, b, c, M_offset_5, 12, T[5]);
  32020. c = FF(c, d, a, b, M_offset_6, 17, T[6]);
  32021. b = FF(b, c, d, a, M_offset_7, 22, T[7]);
  32022. a = FF(a, b, c, d, M_offset_8, 7, T[8]);
  32023. d = FF(d, a, b, c, M_offset_9, 12, T[9]);
  32024. c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  32025. b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  32026. a = FF(a, b, c, d, M_offset_12, 7, T[12]);
  32027. d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  32028. c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  32029. b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  32030. a = GG(a, b, c, d, M_offset_1, 5, T[16]);
  32031. d = GG(d, a, b, c, M_offset_6, 9, T[17]);
  32032. c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  32033. b = GG(b, c, d, a, M_offset_0, 20, T[19]);
  32034. a = GG(a, b, c, d, M_offset_5, 5, T[20]);
  32035. d = GG(d, a, b, c, M_offset_10, 9, T[21]);
  32036. c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  32037. b = GG(b, c, d, a, M_offset_4, 20, T[23]);
  32038. a = GG(a, b, c, d, M_offset_9, 5, T[24]);
  32039. d = GG(d, a, b, c, M_offset_14, 9, T[25]);
  32040. c = GG(c, d, a, b, M_offset_3, 14, T[26]);
  32041. b = GG(b, c, d, a, M_offset_8, 20, T[27]);
  32042. a = GG(a, b, c, d, M_offset_13, 5, T[28]);
  32043. d = GG(d, a, b, c, M_offset_2, 9, T[29]);
  32044. c = GG(c, d, a, b, M_offset_7, 14, T[30]);
  32045. b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  32046. a = HH(a, b, c, d, M_offset_5, 4, T[32]);
  32047. d = HH(d, a, b, c, M_offset_8, 11, T[33]);
  32048. c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  32049. b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  32050. a = HH(a, b, c, d, M_offset_1, 4, T[36]);
  32051. d = HH(d, a, b, c, M_offset_4, 11, T[37]);
  32052. c = HH(c, d, a, b, M_offset_7, 16, T[38]);
  32053. b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  32054. a = HH(a, b, c, d, M_offset_13, 4, T[40]);
  32055. d = HH(d, a, b, c, M_offset_0, 11, T[41]);
  32056. c = HH(c, d, a, b, M_offset_3, 16, T[42]);
  32057. b = HH(b, c, d, a, M_offset_6, 23, T[43]);
  32058. a = HH(a, b, c, d, M_offset_9, 4, T[44]);
  32059. d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  32060. c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  32061. b = HH(b, c, d, a, M_offset_2, 23, T[47]);
  32062. a = II(a, b, c, d, M_offset_0, 6, T[48]);
  32063. d = II(d, a, b, c, M_offset_7, 10, T[49]);
  32064. c = II(c, d, a, b, M_offset_14, 15, T[50]);
  32065. b = II(b, c, d, a, M_offset_5, 21, T[51]);
  32066. a = II(a, b, c, d, M_offset_12, 6, T[52]);
  32067. d = II(d, a, b, c, M_offset_3, 10, T[53]);
  32068. c = II(c, d, a, b, M_offset_10, 15, T[54]);
  32069. b = II(b, c, d, a, M_offset_1, 21, T[55]);
  32070. a = II(a, b, c, d, M_offset_8, 6, T[56]);
  32071. d = II(d, a, b, c, M_offset_15, 10, T[57]);
  32072. c = II(c, d, a, b, M_offset_6, 15, T[58]);
  32073. b = II(b, c, d, a, M_offset_13, 21, T[59]);
  32074. a = II(a, b, c, d, M_offset_4, 6, T[60]);
  32075. d = II(d, a, b, c, M_offset_11, 10, T[61]);
  32076. c = II(c, d, a, b, M_offset_2, 15, T[62]);
  32077. b = II(b, c, d, a, M_offset_9, 21, T[63]);
  32078. // Intermediate hash value
  32079. H[0] = (H[0] + a) | 0;
  32080. H[1] = (H[1] + b) | 0;
  32081. H[2] = (H[2] + c) | 0;
  32082. H[3] = (H[3] + d) | 0;
  32083. },
  32084. _doFinalize: function () {
  32085. // Shortcuts
  32086. var data = this._data;
  32087. var dataWords = data.words;
  32088. var nBitsTotal = this._nDataBytes * 8;
  32089. var nBitsLeft = data.sigBytes * 8;
  32090. // Add padding
  32091. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  32092. var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  32093. var nBitsTotalL = nBitsTotal;
  32094. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
  32095. (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
  32096. (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
  32097. );
  32098. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  32099. (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
  32100. (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
  32101. );
  32102. data.sigBytes = (dataWords.length + 1) * 4;
  32103. // Hash final blocks
  32104. this._process();
  32105. // Shortcuts
  32106. var hash = this._hash;
  32107. var H = hash.words;
  32108. // Swap endian
  32109. for (var i = 0; i < 4; i++) {
  32110. // Shortcut
  32111. var H_i = H[i];
  32112. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  32113. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
  32114. }
  32115. // Return final computed hash
  32116. return hash;
  32117. },
  32118. clone: function () {
  32119. var clone = Hasher.clone.call(this);
  32120. clone._hash = this._hash.clone();
  32121. return clone;
  32122. }
  32123. });
  32124. function FF(a, b, c, d, x, s, t) {
  32125. var n = a + ((b & c) | (~b & d)) + x + t;
  32126. return ((n << s) | (n >>> (32 - s))) + b;
  32127. }
  32128. function GG(a, b, c, d, x, s, t) {
  32129. var n = a + ((b & d) | (c & ~d)) + x + t;
  32130. return ((n << s) | (n >>> (32 - s))) + b;
  32131. }
  32132. function HH(a, b, c, d, x, s, t) {
  32133. var n = a + (b ^ c ^ d) + x + t;
  32134. return ((n << s) | (n >>> (32 - s))) + b;
  32135. }
  32136. function II(a, b, c, d, x, s, t) {
  32137. var n = a + (c ^ (b | ~d)) + x + t;
  32138. return ((n << s) | (n >>> (32 - s))) + b;
  32139. }
  32140. /**
  32141. * Shortcut function to the hasher's object interface.
  32142. *
  32143. * @param {WordArray|string} message The message to hash.
  32144. *
  32145. * @return {WordArray} The hash.
  32146. *
  32147. * @static
  32148. *
  32149. * @example
  32150. *
  32151. * var hash = CryptoJS.MD5('message');
  32152. * var hash = CryptoJS.MD5(wordArray);
  32153. */
  32154. C.MD5 = Hasher._createHelper(MD5);
  32155. /**
  32156. * Shortcut function to the HMAC's object interface.
  32157. *
  32158. * @param {WordArray|string} message The message to hash.
  32159. * @param {WordArray|string} key The secret key.
  32160. *
  32161. * @return {WordArray} The HMAC.
  32162. *
  32163. * @static
  32164. *
  32165. * @example
  32166. *
  32167. * var hmac = CryptoJS.HmacMD5(message, key);
  32168. */
  32169. C.HmacMD5 = Hasher._createHmacHelper(MD5);
  32170. }(Math));
  32171. return CryptoJS.MD5;
  32172. }));
  32173. },{"./core":599}],605:[function(_dereq_,module,exports){
  32174. ;(function (root, factory) {
  32175. if (typeof exports === "object") {
  32176. // CommonJS
  32177. module.exports = exports = factory(_dereq_("./core"));
  32178. }
  32179. else if (typeof define === "function" && define.amd) {
  32180. // AMD
  32181. define(["./core"], factory);
  32182. }
  32183. else {
  32184. // Global (browser)
  32185. factory(root.CryptoJS);
  32186. }
  32187. }(this, function (CryptoJS) {
  32188. (function () {
  32189. // Shortcuts
  32190. var C = CryptoJS;
  32191. var C_lib = C.lib;
  32192. var WordArray = C_lib.WordArray;
  32193. var Hasher = C_lib.Hasher;
  32194. var C_algo = C.algo;
  32195. // Reusable object
  32196. var W = [];
  32197. /**
  32198. * SHA-1 hash algorithm.
  32199. */
  32200. var SHA1 = C_algo.SHA1 = Hasher.extend({
  32201. _doReset: function () {
  32202. this._hash = new WordArray.init([
  32203. 0x67452301, 0xefcdab89,
  32204. 0x98badcfe, 0x10325476,
  32205. 0xc3d2e1f0
  32206. ]);
  32207. },
  32208. _doProcessBlock: function (M, offset) {
  32209. // Shortcut
  32210. var H = this._hash.words;
  32211. // Working variables
  32212. var a = H[0];
  32213. var b = H[1];
  32214. var c = H[2];
  32215. var d = H[3];
  32216. var e = H[4];
  32217. // Computation
  32218. for (var i = 0; i < 80; i++) {
  32219. if (i < 16) {
  32220. W[i] = M[offset + i] | 0;
  32221. } else {
  32222. var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
  32223. W[i] = (n << 1) | (n >>> 31);
  32224. }
  32225. var t = ((a << 5) | (a >>> 27)) + e + W[i];
  32226. if (i < 20) {
  32227. t += ((b & c) | (~b & d)) + 0x5a827999;
  32228. } else if (i < 40) {
  32229. t += (b ^ c ^ d) + 0x6ed9eba1;
  32230. } else if (i < 60) {
  32231. t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
  32232. } else /* if (i < 80) */ {
  32233. t += (b ^ c ^ d) - 0x359d3e2a;
  32234. }
  32235. e = d;
  32236. d = c;
  32237. c = (b << 30) | (b >>> 2);
  32238. b = a;
  32239. a = t;
  32240. }
  32241. // Intermediate hash value
  32242. H[0] = (H[0] + a) | 0;
  32243. H[1] = (H[1] + b) | 0;
  32244. H[2] = (H[2] + c) | 0;
  32245. H[3] = (H[3] + d) | 0;
  32246. H[4] = (H[4] + e) | 0;
  32247. },
  32248. _doFinalize: function () {
  32249. // Shortcuts
  32250. var data = this._data;
  32251. var dataWords = data.words;
  32252. var nBitsTotal = this._nDataBytes * 8;
  32253. var nBitsLeft = data.sigBytes * 8;
  32254. // Add padding
  32255. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  32256. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  32257. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
  32258. data.sigBytes = dataWords.length * 4;
  32259. // Hash final blocks
  32260. this._process();
  32261. // Return final computed hash
  32262. return this._hash;
  32263. },
  32264. clone: function () {
  32265. var clone = Hasher.clone.call(this);
  32266. clone._hash = this._hash.clone();
  32267. return clone;
  32268. }
  32269. });
  32270. /**
  32271. * Shortcut function to the hasher's object interface.
  32272. *
  32273. * @param {WordArray|string} message The message to hash.
  32274. *
  32275. * @return {WordArray} The hash.
  32276. *
  32277. * @static
  32278. *
  32279. * @example
  32280. *
  32281. * var hash = CryptoJS.SHA1('message');
  32282. * var hash = CryptoJS.SHA1(wordArray);
  32283. */
  32284. C.SHA1 = Hasher._createHelper(SHA1);
  32285. /**
  32286. * Shortcut function to the HMAC's object interface.
  32287. *
  32288. * @param {WordArray|string} message The message to hash.
  32289. * @param {WordArray|string} key The secret key.
  32290. *
  32291. * @return {WordArray} The HMAC.
  32292. *
  32293. * @static
  32294. *
  32295. * @example
  32296. *
  32297. * var hmac = CryptoJS.HmacSHA1(message, key);
  32298. */
  32299. C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
  32300. }());
  32301. return CryptoJS.SHA1;
  32302. }));
  32303. },{"./core":599}],606:[function(_dereq_,module,exports){
  32304. // Copyright Joyent, Inc. and other Node contributors.
  32305. //
  32306. // Permission is hereby granted, free of charge, to any person obtaining a
  32307. // copy of this software and associated documentation files (the
  32308. // "Software"), to deal in the Software without restriction, including
  32309. // without limitation the rights to use, copy, modify, merge, publish,
  32310. // distribute, sublicense, and/or sell copies of the Software, and to permit
  32311. // persons to whom the Software is furnished to do so, subject to the
  32312. // following conditions:
  32313. //
  32314. // The above copyright notice and this permission notice shall be included
  32315. // in all copies or substantial portions of the Software.
  32316. //
  32317. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  32318. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  32319. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  32320. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  32321. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  32322. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  32323. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  32324. var objectCreate = Object.create || objectCreatePolyfill
  32325. var objectKeys = Object.keys || objectKeysPolyfill
  32326. var bind = Function.prototype.bind || functionBindPolyfill
  32327. function EventEmitter() {
  32328. if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
  32329. this._events = objectCreate(null);
  32330. this._eventsCount = 0;
  32331. }
  32332. this._maxListeners = this._maxListeners || undefined;
  32333. }
  32334. module.exports = EventEmitter;
  32335. // Backwards-compat with node 0.10.x
  32336. EventEmitter.EventEmitter = EventEmitter;
  32337. EventEmitter.prototype._events = undefined;
  32338. EventEmitter.prototype._maxListeners = undefined;
  32339. // By default EventEmitters will print a warning if more than 10 listeners are
  32340. // added to it. This is a useful default which helps finding memory leaks.
  32341. var defaultMaxListeners = 10;
  32342. var hasDefineProperty;
  32343. try {
  32344. var o = {};
  32345. if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
  32346. hasDefineProperty = o.x === 0;
  32347. } catch (err) { hasDefineProperty = false }
  32348. if (hasDefineProperty) {
  32349. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  32350. enumerable: true,
  32351. get: function() {
  32352. return defaultMaxListeners;
  32353. },
  32354. set: function(arg) {
  32355. // check whether the input is a positive number (whose value is zero or
  32356. // greater and not a NaN).
  32357. if (typeof arg !== 'number' || arg < 0 || arg !== arg)
  32358. throw new TypeError('"defaultMaxListeners" must be a positive number');
  32359. defaultMaxListeners = arg;
  32360. }
  32361. });
  32362. } else {
  32363. EventEmitter.defaultMaxListeners = defaultMaxListeners;
  32364. }
  32365. // Obviously not all Emitters should be limited to 10. This function allows
  32366. // that to be increased. Set to zero for unlimited.
  32367. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  32368. if (typeof n !== 'number' || n < 0 || isNaN(n))
  32369. throw new TypeError('"n" argument must be a positive number');
  32370. this._maxListeners = n;
  32371. return this;
  32372. };
  32373. function $getMaxListeners(that) {
  32374. if (that._maxListeners === undefined)
  32375. return EventEmitter.defaultMaxListeners;
  32376. return that._maxListeners;
  32377. }
  32378. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  32379. return $getMaxListeners(this);
  32380. };
  32381. // These standalone emit* functions are used to optimize calling of event
  32382. // handlers for fast cases because emit() itself often has a variable number of
  32383. // arguments and can be deoptimized because of that. These functions always have
  32384. // the same number of arguments and thus do not get deoptimized, so the code
  32385. // inside them can execute faster.
  32386. function emitNone(handler, isFn, self) {
  32387. if (isFn)
  32388. handler.call(self);
  32389. else {
  32390. var len = handler.length;
  32391. var listeners = arrayClone(handler, len);
  32392. for (var i = 0; i < len; ++i)
  32393. listeners[i].call(self);
  32394. }
  32395. }
  32396. function emitOne(handler, isFn, self, arg1) {
  32397. if (isFn)
  32398. handler.call(self, arg1);
  32399. else {
  32400. var len = handler.length;
  32401. var listeners = arrayClone(handler, len);
  32402. for (var i = 0; i < len; ++i)
  32403. listeners[i].call(self, arg1);
  32404. }
  32405. }
  32406. function emitTwo(handler, isFn, self, arg1, arg2) {
  32407. if (isFn)
  32408. handler.call(self, arg1, arg2);
  32409. else {
  32410. var len = handler.length;
  32411. var listeners = arrayClone(handler, len);
  32412. for (var i = 0; i < len; ++i)
  32413. listeners[i].call(self, arg1, arg2);
  32414. }
  32415. }
  32416. function emitThree(handler, isFn, self, arg1, arg2, arg3) {
  32417. if (isFn)
  32418. handler.call(self, arg1, arg2, arg3);
  32419. else {
  32420. var len = handler.length;
  32421. var listeners = arrayClone(handler, len);
  32422. for (var i = 0; i < len; ++i)
  32423. listeners[i].call(self, arg1, arg2, arg3);
  32424. }
  32425. }
  32426. function emitMany(handler, isFn, self, args) {
  32427. if (isFn)
  32428. handler.apply(self, args);
  32429. else {
  32430. var len = handler.length;
  32431. var listeners = arrayClone(handler, len);
  32432. for (var i = 0; i < len; ++i)
  32433. listeners[i].apply(self, args);
  32434. }
  32435. }
  32436. EventEmitter.prototype.emit = function emit(type) {
  32437. var er, handler, len, args, i, events;
  32438. var doError = (type === 'error');
  32439. events = this._events;
  32440. if (events)
  32441. doError = (doError && events.error == null);
  32442. else if (!doError)
  32443. return false;
  32444. // If there is no 'error' event listener then throw.
  32445. if (doError) {
  32446. if (arguments.length > 1)
  32447. er = arguments[1];
  32448. if (er instanceof Error) {
  32449. throw er; // Unhandled 'error' event
  32450. } else {
  32451. // At least give some kind of context to the user
  32452. var err = new Error('Unhandled "error" event. (' + er + ')');
  32453. err.context = er;
  32454. throw err;
  32455. }
  32456. return false;
  32457. }
  32458. handler = events[type];
  32459. if (!handler)
  32460. return false;
  32461. var isFn = typeof handler === 'function';
  32462. len = arguments.length;
  32463. switch (len) {
  32464. // fast cases
  32465. case 1:
  32466. emitNone(handler, isFn, this);
  32467. break;
  32468. case 2:
  32469. emitOne(handler, isFn, this, arguments[1]);
  32470. break;
  32471. case 3:
  32472. emitTwo(handler, isFn, this, arguments[1], arguments[2]);
  32473. break;
  32474. case 4:
  32475. emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
  32476. break;
  32477. // slower
  32478. default:
  32479. args = new Array(len - 1);
  32480. for (i = 1; i < len; i++)
  32481. args[i - 1] = arguments[i];
  32482. emitMany(handler, isFn, this, args);
  32483. }
  32484. return true;
  32485. };
  32486. function _addListener(target, type, listener, prepend) {
  32487. var m;
  32488. var events;
  32489. var existing;
  32490. if (typeof listener !== 'function')
  32491. throw new TypeError('"listener" argument must be a function');
  32492. events = target._events;
  32493. if (!events) {
  32494. events = target._events = objectCreate(null);
  32495. target._eventsCount = 0;
  32496. } else {
  32497. // To avoid recursion in the case that type === "newListener"! Before
  32498. // adding it to the listeners, first emit "newListener".
  32499. if (events.newListener) {
  32500. target.emit('newListener', type,
  32501. listener.listener ? listener.listener : listener);
  32502. // Re-assign `events` because a newListener handler could have caused the
  32503. // this._events to be assigned to a new object
  32504. events = target._events;
  32505. }
  32506. existing = events[type];
  32507. }
  32508. if (!existing) {
  32509. // Optimize the case of one listener. Don't need the extra array object.
  32510. existing = events[type] = listener;
  32511. ++target._eventsCount;
  32512. } else {
  32513. if (typeof existing === 'function') {
  32514. // Adding the second element, need to change to array.
  32515. existing = events[type] =
  32516. prepend ? [listener, existing] : [existing, listener];
  32517. } else {
  32518. // If we've already got an array, just append.
  32519. if (prepend) {
  32520. existing.unshift(listener);
  32521. } else {
  32522. existing.push(listener);
  32523. }
  32524. }
  32525. // Check for listener leak
  32526. if (!existing.warned) {
  32527. m = $getMaxListeners(target);
  32528. if (m && m > 0 && existing.length > m) {
  32529. existing.warned = true;
  32530. var w = new Error('Possible EventEmitter memory leak detected. ' +
  32531. existing.length + ' "' + String(type) + '" listeners ' +
  32532. 'added. Use emitter.setMaxListeners() to ' +
  32533. 'increase limit.');
  32534. w.name = 'MaxListenersExceededWarning';
  32535. w.emitter = target;
  32536. w.type = type;
  32537. w.count = existing.length;
  32538. if (typeof console === 'object' && console.warn) {
  32539. console.warn('%s: %s', w.name, w.message);
  32540. }
  32541. }
  32542. }
  32543. }
  32544. return target;
  32545. }
  32546. EventEmitter.prototype.addListener = function addListener(type, listener) {
  32547. return _addListener(this, type, listener, false);
  32548. };
  32549. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  32550. EventEmitter.prototype.prependListener =
  32551. function prependListener(type, listener) {
  32552. return _addListener(this, type, listener, true);
  32553. };
  32554. function onceWrapper() {
  32555. if (!this.fired) {
  32556. this.target.removeListener(this.type, this.wrapFn);
  32557. this.fired = true;
  32558. switch (arguments.length) {
  32559. case 0:
  32560. return this.listener.call(this.target);
  32561. case 1:
  32562. return this.listener.call(this.target, arguments[0]);
  32563. case 2:
  32564. return this.listener.call(this.target, arguments[0], arguments[1]);
  32565. case 3:
  32566. return this.listener.call(this.target, arguments[0], arguments[1],
  32567. arguments[2]);
  32568. default:
  32569. var args = new Array(arguments.length);
  32570. for (var i = 0; i < args.length; ++i)
  32571. args[i] = arguments[i];
  32572. this.listener.apply(this.target, args);
  32573. }
  32574. }
  32575. }
  32576. function _onceWrap(target, type, listener) {
  32577. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  32578. var wrapped = bind.call(onceWrapper, state);
  32579. wrapped.listener = listener;
  32580. state.wrapFn = wrapped;
  32581. return wrapped;
  32582. }
  32583. EventEmitter.prototype.once = function once(type, listener) {
  32584. if (typeof listener !== 'function')
  32585. throw new TypeError('"listener" argument must be a function');
  32586. this.on(type, _onceWrap(this, type, listener));
  32587. return this;
  32588. };
  32589. EventEmitter.prototype.prependOnceListener =
  32590. function prependOnceListener(type, listener) {
  32591. if (typeof listener !== 'function')
  32592. throw new TypeError('"listener" argument must be a function');
  32593. this.prependListener(type, _onceWrap(this, type, listener));
  32594. return this;
  32595. };
  32596. // Emits a 'removeListener' event if and only if the listener was removed.
  32597. EventEmitter.prototype.removeListener =
  32598. function removeListener(type, listener) {
  32599. var list, events, position, i, originalListener;
  32600. if (typeof listener !== 'function')
  32601. throw new TypeError('"listener" argument must be a function');
  32602. events = this._events;
  32603. if (!events)
  32604. return this;
  32605. list = events[type];
  32606. if (!list)
  32607. return this;
  32608. if (list === listener || list.listener === listener) {
  32609. if (--this._eventsCount === 0)
  32610. this._events = objectCreate(null);
  32611. else {
  32612. delete events[type];
  32613. if (events.removeListener)
  32614. this.emit('removeListener', type, list.listener || listener);
  32615. }
  32616. } else if (typeof list !== 'function') {
  32617. position = -1;
  32618. for (i = list.length - 1; i >= 0; i--) {
  32619. if (list[i] === listener || list[i].listener === listener) {
  32620. originalListener = list[i].listener;
  32621. position = i;
  32622. break;
  32623. }
  32624. }
  32625. if (position < 0)
  32626. return this;
  32627. if (position === 0)
  32628. list.shift();
  32629. else
  32630. spliceOne(list, position);
  32631. if (list.length === 1)
  32632. events[type] = list[0];
  32633. if (events.removeListener)
  32634. this.emit('removeListener', type, originalListener || listener);
  32635. }
  32636. return this;
  32637. };
  32638. EventEmitter.prototype.removeAllListeners =
  32639. function removeAllListeners(type) {
  32640. var listeners, events, i;
  32641. events = this._events;
  32642. if (!events)
  32643. return this;
  32644. // not listening for removeListener, no need to emit
  32645. if (!events.removeListener) {
  32646. if (arguments.length === 0) {
  32647. this._events = objectCreate(null);
  32648. this._eventsCount = 0;
  32649. } else if (events[type]) {
  32650. if (--this._eventsCount === 0)
  32651. this._events = objectCreate(null);
  32652. else
  32653. delete events[type];
  32654. }
  32655. return this;
  32656. }
  32657. // emit removeListener for all listeners on all events
  32658. if (arguments.length === 0) {
  32659. var keys = objectKeys(events);
  32660. var key;
  32661. for (i = 0; i < keys.length; ++i) {
  32662. key = keys[i];
  32663. if (key === 'removeListener') continue;
  32664. this.removeAllListeners(key);
  32665. }
  32666. this.removeAllListeners('removeListener');
  32667. this._events = objectCreate(null);
  32668. this._eventsCount = 0;
  32669. return this;
  32670. }
  32671. listeners = events[type];
  32672. if (typeof listeners === 'function') {
  32673. this.removeListener(type, listeners);
  32674. } else if (listeners) {
  32675. // LIFO order
  32676. for (i = listeners.length - 1; i >= 0; i--) {
  32677. this.removeListener(type, listeners[i]);
  32678. }
  32679. }
  32680. return this;
  32681. };
  32682. function _listeners(target, type, unwrap) {
  32683. var events = target._events;
  32684. if (!events)
  32685. return [];
  32686. var evlistener = events[type];
  32687. if (!evlistener)
  32688. return [];
  32689. if (typeof evlistener === 'function')
  32690. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  32691. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  32692. }
  32693. EventEmitter.prototype.listeners = function listeners(type) {
  32694. return _listeners(this, type, true);
  32695. };
  32696. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  32697. return _listeners(this, type, false);
  32698. };
  32699. EventEmitter.listenerCount = function(emitter, type) {
  32700. if (typeof emitter.listenerCount === 'function') {
  32701. return emitter.listenerCount(type);
  32702. } else {
  32703. return listenerCount.call(emitter, type);
  32704. }
  32705. };
  32706. EventEmitter.prototype.listenerCount = listenerCount;
  32707. function listenerCount(type) {
  32708. var events = this._events;
  32709. if (events) {
  32710. var evlistener = events[type];
  32711. if (typeof evlistener === 'function') {
  32712. return 1;
  32713. } else if (evlistener) {
  32714. return evlistener.length;
  32715. }
  32716. }
  32717. return 0;
  32718. }
  32719. EventEmitter.prototype.eventNames = function eventNames() {
  32720. return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
  32721. };
  32722. // About 1.5x faster than the two-arg version of Array#splice().
  32723. function spliceOne(list, index) {
  32724. for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
  32725. list[i] = list[k];
  32726. list.pop();
  32727. }
  32728. function arrayClone(arr, n) {
  32729. var copy = new Array(n);
  32730. for (var i = 0; i < n; ++i)
  32731. copy[i] = arr[i];
  32732. return copy;
  32733. }
  32734. function unwrapListeners(arr) {
  32735. var ret = new Array(arr.length);
  32736. for (var i = 0; i < ret.length; ++i) {
  32737. ret[i] = arr[i].listener || arr[i];
  32738. }
  32739. return ret;
  32740. }
  32741. function objectCreatePolyfill(proto) {
  32742. var F = function() {};
  32743. F.prototype = proto;
  32744. return new F;
  32745. }
  32746. function objectKeysPolyfill(obj) {
  32747. var keys = [];
  32748. for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
  32749. keys.push(k);
  32750. }
  32751. return k;
  32752. }
  32753. function functionBindPolyfill(context) {
  32754. var fn = this;
  32755. return function () {
  32756. return fn.apply(context, arguments);
  32757. };
  32758. }
  32759. },{}]},{},[17])(17)
  32760. });