1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["AV"] = factory();
- else
- root["AV"] = factory();
- })(typeof self !== 'undefined' ? self : this, function() {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 277);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var global = __webpack_require__(7);
- var apply = __webpack_require__(75);
- var uncurryThis = __webpack_require__(4);
- var isCallable = __webpack_require__(8);
- var getOwnPropertyDescriptor = __webpack_require__(62).f;
- var isForced = __webpack_require__(159);
- var path = __webpack_require__(5);
- var bind = __webpack_require__(48);
- var createNonEnumerableProperty = __webpack_require__(37);
- var hasOwn = __webpack_require__(13);
- var wrapConstructor = function (NativeConstructor) {
- var Wrapper = function (a, b, c) {
- if (this instanceof Wrapper) {
- switch (arguments.length) {
- case 0: return new NativeConstructor();
- case 1: return new NativeConstructor(a);
- case 2: return new NativeConstructor(a, b);
- } return new NativeConstructor(a, b, c);
- } return apply(NativeConstructor, this, arguments);
- };
- Wrapper.prototype = NativeConstructor.prototype;
- return Wrapper;
- };
- /*
- options.target - name of the target object
- options.global - target is the global object
- options.stat - export as static methods of target
- options.proto - export as prototype methods of target
- options.real - real prototype method for the `pure` version
- options.forced - export even if the native feature is available
- options.bind - bind methods to the target, required for the `pure` version
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
- options.sham - add a flag to not completely full polyfills
- options.enumerable - export as enumerable property
- options.dontCallGetSet - prevent calling a getter on target
- options.name - the .name of the function if it does not match the key
- */
- module.exports = function (options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var PROTO = options.proto;
- var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
- var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
- var targetPrototype = target.prototype;
- var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
- var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
- for (key in source) {
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
- // contains in native
- USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
- targetProperty = target[key];
- if (USE_NATIVE) if (options.dontCallGetSet) {
- descriptor = getOwnPropertyDescriptor(nativeSource, key);
- nativeProperty = descriptor && descriptor.value;
- } else nativeProperty = nativeSource[key];
- // export native or implementation
- sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
- if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
- // bind timers to global for call from export context
- if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
- // wrap global constructors for prevent changs in this version
- else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
- // make static versions for prototype methods
- else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
- // default case
- else resultProperty = sourceProperty;
- // add a flag to not completely full polyfills
- if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
- createNonEnumerableProperty(resultProperty, 'sham', true);
- }
- createNonEnumerableProperty(target, key, resultProperty);
- if (PROTO) {
- VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
- if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
- createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
- }
- // export virtual prototype methods
- createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
- // export real prototype methods
- if (options.real && targetPrototype && !targetPrototype[key]) {
- createNonEnumerableProperty(targetPrototype, key, sourceProperty);
- }
- }
- }
- };
- /***/ }),
- /* 1 */
- /***/ (function(module, exports) {
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 2 */
- /***/ (function(module, exports) {
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- /***/ }),
- /* 3 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(318);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(132);
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; });
- /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; });
- // ESM Exports
- // ===========
- // This module is the package entry point for ES module users. In other words,
- // it is the module they are interfacing with when they import from the whole
- // package instead of from a submodule, like this:
- //
- // ```js
- // import { map } from 'underscore';
- // ```
- //
- // The difference with `./index-default`, which is the package entry point for
- // CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
- // default exports are considered to be siblings, so when you have a default
- // export, its properties are not automatically available as named exports. For
- // this reason, we re-export the named exports in addition to providing the same
- // default export as in `./index-default`.
- /***/ }),
- /* 4 */
- /***/ (function(module, exports, __webpack_require__) {
- var NATIVE_BIND = __webpack_require__(76);
- var FunctionPrototype = Function.prototype;
- var bind = FunctionPrototype.bind;
- var call = FunctionPrototype.call;
- var uncurryThis = NATIVE_BIND && bind.bind(call, call);
- module.exports = NATIVE_BIND ? function (fn) {
- return fn && uncurryThis(fn);
- } : function (fn) {
- return fn && function () {
- return call.apply(fn, arguments);
- };
- };
- /***/ }),
- /* 5 */
- /***/ (function(module, exports) {
- module.exports = {};
- /***/ }),
- /* 6 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
- // Current version.
- var VERSION = '1.12.1';
- // Establish the root object, `window` (`self`) in the browser, `global`
- // on the server, or `this` in some virtual machines. We use `self`
- // instead of `window` for `WebWorker` support.
- var root = typeof self == 'object' && self.self === self && self ||
- typeof global == 'object' && global.global === global && global ||
- Function('return this')() ||
- {};
- // Save bytes in the minified (but not gzipped) version:
- var ArrayProto = Array.prototype, ObjProto = Object.prototype;
- var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
- // Create quick reference variables for speed access to core prototypes.
- var push = ArrayProto.push,
- slice = ArrayProto.slice,
- toString = ObjProto.toString,
- hasOwnProperty = ObjProto.hasOwnProperty;
- // Modern feature detection.
- var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
- supportsDataView = typeof DataView !== 'undefined';
- // All **ECMAScript 5+** native function implementations that we hope to use
- // are declared here.
- var nativeIsArray = Array.isArray,
- nativeKeys = Object.keys,
- nativeCreate = Object.create,
- nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
- // Create references to these builtin functions because we override them.
- var _isNaN = isNaN,
- _isFinite = isFinite;
- // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
- var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
- var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
- 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
- // The largest integer that can be represented exactly.
- var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(74)))
- /***/ }),
- /* 7 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
- return it && it.Math == Math && it;
- };
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- module.exports =
- // eslint-disable-next-line es-x/no-global-this -- safe
- check(typeof globalThis == 'object' && globalThis) ||
- check(typeof window == 'object' && window) ||
- // eslint-disable-next-line no-restricted-globals -- safe
- check(typeof self == 'object' && self) ||
- check(typeof global == 'object' && global) ||
- // eslint-disable-next-line no-new-func -- fallback
- (function () { return this; })() || Function('return this')();
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
- /***/ }),
- /* 8 */
- /***/ (function(module, exports) {
- // `IsCallable` abstract operation
- // https://tc39.es/ecma262/#sec-iscallable
- module.exports = function (argument) {
- return typeof argument == 'function';
- };
- /***/ }),
- /* 9 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var shared = __webpack_require__(79);
- var hasOwn = __webpack_require__(13);
- var uid = __webpack_require__(99);
- var NATIVE_SYMBOL = __webpack_require__(64);
- var USE_SYMBOL_AS_UID = __webpack_require__(157);
- var WellKnownSymbolsStore = shared('wks');
- var Symbol = global.Symbol;
- var symbolFor = Symbol && Symbol['for'];
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
- module.exports = function (name) {
- if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
- var description = 'Symbol.' + name;
- if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
- WellKnownSymbolsStore[name] = Symbol[name];
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
- WellKnownSymbolsStore[name] = symbolFor(description);
- } else {
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
- }
- } return WellKnownSymbolsStore[name];
- };
- /***/ }),
- /* 10 */
- /***/ (function(module, exports, __webpack_require__) {
- var path = __webpack_require__(5);
- var hasOwn = __webpack_require__(13);
- var wrappedWellKnownSymbolModule = __webpack_require__(148);
- var defineProperty = __webpack_require__(23).f;
- module.exports = function (NAME) {
- var Symbol = path.Symbol || (path.Symbol = {});
- if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
- value: wrappedWellKnownSymbolModule.f(NAME)
- });
- };
- /***/ }),
- /* 11 */
- /***/ (function(module, exports, __webpack_require__) {
- var isCallable = __webpack_require__(8);
- module.exports = function (it) {
- return typeof it == 'object' ? it !== null : isCallable(it);
- };
- /***/ }),
- /* 12 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(281);
- /***/ }),
- /* 13 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var toObject = __webpack_require__(34);
- var hasOwnProperty = uncurryThis({}.hasOwnProperty);
- // `HasOwnProperty` abstract operation
- // https://tc39.es/ecma262/#sec-hasownproperty
- // eslint-disable-next-line es-x/no-object-hasown -- safe
- module.exports = Object.hasOwn || function hasOwn(it, key) {
- return hasOwnProperty(toObject(it), key);
- };
- /***/ }),
- /* 14 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- // Detect IE8's incomplete defineProperty implementation
- module.exports = !fails(function () {
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
- });
- /***/ }),
- /* 15 */
- /***/ (function(module, exports, __webpack_require__) {
- var NATIVE_BIND = __webpack_require__(76);
- var call = Function.prototype.call;
- module.exports = NATIVE_BIND ? call.bind(call) : function () {
- return call.apply(call, arguments);
- };
- /***/ }),
- /* 16 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = keys;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(190);
- // Retrieve the names of an object's own properties.
- // Delegates to **ECMAScript 5**'s native `Object.keys`.
- function keys(obj) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
- if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
- var keys = [];
- for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
- // Ahem, IE < 9.
- if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
- return keys;
- }
- /***/ }),
- /* 17 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Internal function for creating a `toString`-based type tester.
- function tagTester(name) {
- var tag = '[object ' + name + ']';
- return function(obj) {
- return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
- };
- }
- /***/ }),
- /* 18 */
- /***/ (function(module, exports, __webpack_require__) {
- var path = __webpack_require__(5);
- var global = __webpack_require__(7);
- var isCallable = __webpack_require__(8);
- var aFunction = function (variable) {
- return isCallable(variable) ? variable : undefined;
- };
- module.exports = function (namespace, method) {
- return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
- : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
- };
- /***/ }),
- /* 19 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- module.exports = uncurryThis({}.isPrototypeOf);
- /***/ }),
- /* 20 */
- /***/ (function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(11);
- var $String = String;
- var $TypeError = TypeError;
- // `Assert: Type(argument) is Object`
- module.exports = function (argument) {
- if (isObject(argument)) return argument;
- throw $TypeError($String(argument) + ' is not an object');
- };
- /***/ }),
- /* 21 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = cb;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(201);
- // The function we call internally to generate a callback. It invokes
- // `_.iteratee` if overridden, otherwise `baseIteratee`.
- function cb(value, context, argCount) {
- if (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee !== __WEBPACK_IMPORTED_MODULE_2__iteratee_js__["a" /* default */]) return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee(value, context);
- return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
- }
- /***/ }),
- /* 22 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(390);
- /***/ }),
- /* 23 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var IE8_DOM_DEFINE = __webpack_require__(158);
- var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
- var anObject = __webpack_require__(20);
- var toPropertyKey = __webpack_require__(96);
- var $TypeError = TypeError;
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- var $defineProperty = Object.defineProperty;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var ENUMERABLE = 'enumerable';
- var CONFIGURABLE = 'configurable';
- var WRITABLE = 'writable';
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
- var current = $getOwnPropertyDescriptor(O, P);
- if (current && current[WRITABLE]) {
- O[P] = Attributes.value;
- Attributes = {
- configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
- writable: false
- };
- }
- } return $defineProperty(O, P, Attributes);
- } : $defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return $defineProperty(O, P, Attributes);
- } catch (error) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- /***/ }),
- /* 24 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
- // Some functions take a variable number of arguments, or a few expected
- // arguments at the beginning and then a variable number of values to operate
- // on. This helper accumulates all remaining arguments past the function’s
- // argument length (or an explicit `startIndex`), into an array that becomes
- // the last argument. Similar to ES6’s "rest parameter".
- function restArguments(func, startIndex) {
- startIndex = startIndex == null ? func.length - 1 : +startIndex;
- return function() {
- var length = Math.max(arguments.length - startIndex, 0),
- rest = Array(length),
- index = 0;
- for (; index < length; index++) {
- rest[index] = arguments[index + startIndex];
- }
- switch (startIndex) {
- case 0: return func.call(this, rest);
- case 1: return func.call(this, arguments[0], rest);
- case 2: return func.call(this, arguments[0], arguments[1], rest);
- }
- var args = Array(startIndex + 1);
- for (index = 0; index < startIndex; index++) {
- args[index] = arguments[index];
- }
- args[startIndex] = rest;
- return func.apply(this, args);
- };
- }
- /***/ }),
- /* 25 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = _;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // If Underscore is called as a function, it returns a wrapped object that can
- // be used OO-style. This wrapper holds altered versions of all functions added
- // through `_.mixin`. Wrapped objects may be chained.
- function _(obj) {
- if (obj instanceof _) return obj;
- if (!(this instanceof _)) return new _(obj);
- this._wrapped = obj;
- }
- _.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
- // Extracts the result from a wrapped and chained object.
- _.prototype.value = function() {
- return this._wrapped;
- };
- // Provide unwrapping proxies for some methods used in engine operations
- // such as arithmetic and JSON stringification.
- _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
- _.prototype.toString = function() {
- return String(this._wrapped);
- };
- /***/ }),
- /* 26 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
- // Internal helper for collection methods to determine whether a collection
- // should be iterated as an array or as an object.
- // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
- // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
- /***/ }),
- /* 27 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3);
- var md5 = __webpack_require__(526);
- var _require = __webpack_require__(3),
- extend = _require.extend;
- var AV = __webpack_require__(69);
- var AVError = __webpack_require__(46);
- var _require2 = __webpack_require__(30),
- getSessionToken = _require2.getSessionToken;
- var ajax = __webpack_require__(116); // 计算 X-LC-Sign 的签名方法
- var sign = function sign(key, isMasterKey) {
- var _context2;
- var now = new Date().getTime();
- var signature = md5(now + key);
- if (isMasterKey) {
- var _context;
- return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master");
- }
- return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now);
- };
- var setAppKey = function setAppKey(headers, signKey) {
- if (signKey) {
- headers['X-LC-Sign'] = sign(AV.applicationKey);
- } else {
- headers['X-LC-Key'] = AV.applicationKey;
- }
- };
- var setHeaders = function setHeaders() {
- var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var signKey = arguments.length > 1 ? arguments[1] : undefined;
- var headers = {
- 'X-LC-Id': AV.applicationId,
- 'Content-Type': 'application/json;charset=UTF-8'
- };
- var useMasterKey = false;
- if (typeof authOptions.useMasterKey === 'boolean') {
- useMasterKey = authOptions.useMasterKey;
- } else if (typeof AV._config.useMasterKey === 'boolean') {
- useMasterKey = AV._config.useMasterKey;
- }
- if (useMasterKey) {
- if (AV.masterKey) {
- if (signKey) {
- headers['X-LC-Sign'] = sign(AV.masterKey, true);
- } else {
- headers['X-LC-Key'] = "".concat(AV.masterKey, ",master");
- }
- } else {
- console.warn('masterKey is not set, fall back to use appKey');
- setAppKey(headers, signKey);
- }
- } else {
- setAppKey(headers, signKey);
- }
- if (AV.hookKey) {
- headers['X-LC-Hook-Key'] = AV.hookKey;
- }
- if (AV._config.production !== null) {
- headers['X-LC-Prod'] = String(AV._config.production);
- }
- headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
- return _promise.default.resolve().then(function () {
- // Pass the session token
- var sessionToken = getSessionToken(authOptions);
- if (sessionToken) {
- headers['X-LC-Session'] = sessionToken;
- } else if (!AV._config.disableCurrentUser) {
- return AV.User.currentAsync().then(function (currentUser) {
- if (currentUser && currentUser._sessionToken) {
- headers['X-LC-Session'] = currentUser._sessionToken;
- }
- return headers;
- });
- }
- return headers;
- });
- };
- var createApiUrl = function createApiUrl(_ref) {
- var _ref$service = _ref.service,
- service = _ref$service === void 0 ? 'api' : _ref$service,
- _ref$version = _ref.version,
- version = _ref$version === void 0 ? '1.1' : _ref$version,
- path = _ref.path;
- var apiURL = AV._config.serverURLs[service];
- if (!apiURL) throw new Error("undefined server URL for ".concat(service));
- if (apiURL.charAt(apiURL.length - 1) !== '/') {
- apiURL += '/';
- }
- apiURL += version;
- if (path) {
- apiURL += path;
- }
- return apiURL;
- };
- /**
- * Low level REST API client. Call REST endpoints with authorization headers.
- * @function AV.request
- * @since 3.0.0
- * @param {Object} options
- * @param {String} options.method HTTP method
- * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
- * @param {Object} [options.query] query string dict
- * @param {Object} [options.data] HTTP body
- * @param {AuthOptions} [options.authOptions]
- * @param {String} [options.service = 'api']
- * @param {String} [options.version = '1.1']
- */
- var request = function request(_ref2) {
- var service = _ref2.service,
- version = _ref2.version,
- method = _ref2.method,
- path = _ref2.path,
- query = _ref2.query,
- data = _ref2.data,
- authOptions = _ref2.authOptions,
- _ref2$signKey = _ref2.signKey,
- signKey = _ref2$signKey === void 0 ? true : _ref2$signKey;
- if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
- throw new Error('Not initialized');
- }
- if (AV._appRouter) {
- AV._appRouter.refresh();
- }
- var timeout = AV._config.requestTimeout;
- var url = createApiUrl({
- service: service,
- path: path,
- version: version
- });
- return setHeaders(authOptions, signKey).then(function (headers) {
- return ajax({
- method: method,
- url: url,
- query: query,
- data: data,
- headers: headers,
- timeout: timeout
- }).catch(function (error) {
- var errorJSON = {
- code: error.code || -1,
- error: error.message || error.responseText
- };
- if (error.response && error.response.code) {
- errorJSON = error.response;
- } else if (error.responseText) {
- try {
- errorJSON = JSON.parse(error.responseText);
- } catch (e) {// If we fail to parse the error text, that's okay.
- }
- }
- errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
- if (!AV._sharedConfig.keepErrorRawMessage) {
- var _context3, _context4;
- errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]");
- } // Transform the error into an instance of AVError by trying to parse
- // the error string as JSON.
- var err = new AVError(errorJSON.code, errorJSON.error);
- delete errorJSON.error;
- throw _.extend(err, errorJSON);
- });
- });
- }; // lagecy request
- var _request = function _request(route, className, objectId, method, data, authOptions, query) {
- var path = '';
- if (route) path += "/".concat(route);
- if (className) path += "/".concat(className);
- if (objectId) path += "/".concat(objectId); // for migeration
- if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
- if (data && data._where) throw new Error('_where should be in the query');
- if (method && method.toLowerCase() === 'get') {
- query = extend({}, query, data);
- data = null;
- }
- return request({
- method: method,
- path: path,
- query: query,
- data: data,
- authOptions: authOptions
- });
- };
- AV.request = request;
- module.exports = {
- _request: _request,
- request: request
- };
- /***/ }),
- /* 28 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
- // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
- // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
- var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
- if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
- isFunction = function(obj) {
- return typeof obj == 'function' || false;
- };
- }
- /* harmony default export */ __webpack_exports__["a"] = (isFunction);
- /***/ }),
- /* 29 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
- // Internal helper to obtain the `length` property of an object.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
- /***/ }),
- /* 30 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _keys = _interopRequireDefault(__webpack_require__(59));
- var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3); // Helper function to check null or undefined.
- var isNullOrUndefined = function isNullOrUndefined(x) {
- return _.isNull(x) || _.isUndefined(x);
- };
- var ensureArray = function ensureArray(target) {
- if (_.isArray(target)) {
- return target;
- }
- if (target === undefined || target === null) {
- return [];
- }
- return [target];
- };
- var transformFetchOptions = function transformFetchOptions() {
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- keys = (0, _keys.default)(_ref),
- include = _ref.include,
- includeACL = _ref.includeACL;
- var fetchOptions = {};
- if (keys) {
- fetchOptions.keys = ensureArray(keys).join(',');
- }
- if (include) {
- fetchOptions.include = ensureArray(include).join(',');
- }
- if (includeACL) {
- fetchOptions.returnACL = includeACL;
- }
- return fetchOptions;
- };
- var getSessionToken = function getSessionToken(authOptions) {
- if (authOptions.sessionToken) {
- return authOptions.sessionToken;
- }
- if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
- return authOptions.user.getSessionToken();
- }
- };
- var tap = function tap(interceptor) {
- return function (value) {
- return interceptor(value), value;
- };
- }; // Shared empty constructor function to aid in prototype-chain creation.
- var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses.
- // Similar to `goog.inherits`, but uses a hash of prototype properties and
- // class properties to be extended.
- var inherits = function inherits(parent, protoProps, staticProps) {
- var child; // The constructor function for the new subclass is either defined by you
- // (the "constructor" property in your `extend` definition), or defaulted
- // by us to simply call the parent's constructor.
- if (protoProps && protoProps.hasOwnProperty('constructor')) {
- child = protoProps.constructor;
- } else {
- /** @ignore */
- child = function child() {
- parent.apply(this, arguments);
- };
- } // Inherit class (static) properties from parent.
- _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling
- // `parent`'s constructor function.
- EmptyConstructor.prototype = parent.prototype;
- child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass,
- // if supplied.
- if (protoProps) {
- _.extend(child.prototype, protoProps);
- } // Add static properties to the constructor function, if supplied.
- if (staticProps) {
- _.extend(child, staticProps);
- } // Correctly set child's `prototype.constructor`.
- child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is
- // needed later.
- child.__super__ = parent.prototype;
- return child;
- };
- var parseDate = function parseDate(iso8601) {
- return new Date(iso8601);
- };
- var setValue = function setValue(target, key, value) {
- // '.' is not allowed in Class keys, escaping is not in concern now.
- var segs = key.split('.');
- var lastSeg = segs.pop();
- var currentTarget = target;
- segs.forEach(function (seg) {
- if (currentTarget[seg] === undefined) currentTarget[seg] = {};
- currentTarget = currentTarget[seg];
- });
- currentTarget[lastSeg] = value;
- return target;
- };
- var findValue = function findValue(target, key) {
- var segs = key.split('.');
- var firstSeg = segs[0];
- var lastSeg = segs.pop();
- var currentTarget = target;
- for (var i = 0; i < segs.length; i++) {
- currentTarget = currentTarget[segs[i]];
- if (currentTarget === undefined) {
- return [undefined, undefined, lastSeg];
- }
- }
- var value = currentTarget[lastSeg];
- return [value, currentTarget, lastSeg, firstSeg];
- };
- var isPlainObject = function isPlainObject(obj) {
- return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
- };
- var continueWhile = function continueWhile(predicate, asyncFunction) {
- if (predicate()) {
- return asyncFunction().then(function () {
- return continueWhile(predicate, asyncFunction);
- });
- }
- return _promise.default.resolve();
- };
- module.exports = {
- isNullOrUndefined: isNullOrUndefined,
- ensureArray: ensureArray,
- transformFetchOptions: transformFetchOptions,
- getSessionToken: getSessionToken,
- tap: tap,
- inherits: inherits,
- parseDate: parseDate,
- setValue: setValue,
- findValue: findValue,
- isPlainObject: isPlainObject,
- continueWhile: continueWhile
- };
- /***/ }),
- /* 31 */
- /***/ (function(module, exports, __webpack_require__) {
- var isCallable = __webpack_require__(8);
- var tryToString = __webpack_require__(78);
- var $TypeError = TypeError;
- // `Assert: IsCallable(argument) is true`
- module.exports = function (argument) {
- if (isCallable(argument)) return argument;
- throw $TypeError(tryToString(argument) + ' is not a function');
- };
- /***/ }),
- /* 32 */
- /***/ (function(module, exports, __webpack_require__) {
- // toObject with fallback for non-array-like ES3 strings
- var IndexedObject = __webpack_require__(95);
- var requireObjectCoercible = __webpack_require__(121);
- module.exports = function (it) {
- return IndexedObject(requireObjectCoercible(it));
- };
- /***/ }),
- /* 33 */
- /***/ (function(module, exports) {
- module.exports = true;
- /***/ }),
- /* 34 */
- /***/ (function(module, exports, __webpack_require__) {
- var requireObjectCoercible = __webpack_require__(121);
- var $Object = Object;
- // `ToObject` abstract operation
- // https://tc39.es/ecma262/#sec-toobject
- module.exports = function (argument) {
- return $Object(requireObjectCoercible(argument));
- };
- /***/ }),
- /* 35 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(395);
- /***/ }),
- /* 36 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(402);
- /***/ }),
- /* 37 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var definePropertyModule = __webpack_require__(23);
- var createPropertyDescriptor = __webpack_require__(47);
- module.exports = DESCRIPTORS ? function (object, key, value) {
- return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- /***/ }),
- /* 38 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var toIndexedObject = __webpack_require__(32);
- var addToUnscopables = __webpack_require__(169);
- var Iterators = __webpack_require__(50);
- var InternalStateModule = __webpack_require__(43);
- var defineProperty = __webpack_require__(23).f;
- var defineIterator = __webpack_require__(131);
- var IS_PURE = __webpack_require__(33);
- var DESCRIPTORS = __webpack_require__(14);
- var ARRAY_ITERATOR = 'Array Iterator';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
- // `Array.prototype.entries` method
- // https://tc39.es/ecma262/#sec-array.prototype.entries
- // `Array.prototype.keys` method
- // https://tc39.es/ecma262/#sec-array.prototype.keys
- // `Array.prototype.values` method
- // https://tc39.es/ecma262/#sec-array.prototype.values
- // `Array.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
- // `CreateArrayIterator` internal method
- // https://tc39.es/ecma262/#sec-createarrayiterator
- module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
- setInternalState(this, {
- type: ARRAY_ITERATOR,
- target: toIndexedObject(iterated), // target
- index: 0, // next index
- kind: kind // kind
- });
- // `%ArrayIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
- }, function () {
- var state = getInternalState(this);
- var target = state.target;
- var kind = state.kind;
- var index = state.index++;
- if (!target || index >= target.length) {
- state.target = undefined;
- return { value: undefined, done: true };
- }
- if (kind == 'keys') return { value: index, done: false };
- if (kind == 'values') return { value: target[index], done: false };
- return { value: [index, target[index]], done: false };
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values%
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
- var values = Iterators.Arguments = Iterators.Array;
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('keys');
- addToUnscopables('values');
- addToUnscopables('entries');
- // V8 ~ Chrome 45- bug
- if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
- defineProperty(values, 'name', { value: 'values' });
- } catch (error) { /* empty */ }
- /***/ }),
- /* 39 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- var DOMIterables = __webpack_require__(317);
- var global = __webpack_require__(7);
- var classof = __webpack_require__(51);
- var createNonEnumerableProperty = __webpack_require__(37);
- var Iterators = __webpack_require__(50);
- var wellKnownSymbol = __webpack_require__(9);
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- for (var COLLECTION_NAME in DOMIterables) {
- var Collection = global[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
- createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
- }
- Iterators[COLLECTION_NAME] = Iterators.Array;
- }
- /***/ }),
- /* 40 */
- /***/ (function(module, exports, __webpack_require__) {
- var path = __webpack_require__(5);
- module.exports = function (CONSTRUCTOR) {
- return path[CONSTRUCTOR + 'Prototype'];
- };
- /***/ }),
- /* 41 */
- /***/ (function(module, exports, __webpack_require__) {
- var toLength = __webpack_require__(291);
- // `LengthOfArrayLike` abstract operation
- // https://tc39.es/ecma262/#sec-lengthofarraylike
- module.exports = function (obj) {
- return toLength(obj.length);
- };
- /***/ }),
- /* 42 */
- /***/ (function(module, exports, __webpack_require__) {
- var bind = __webpack_require__(48);
- var call = __webpack_require__(15);
- var anObject = __webpack_require__(20);
- var tryToString = __webpack_require__(78);
- var isArrayIteratorMethod = __webpack_require__(166);
- var lengthOfArrayLike = __webpack_require__(41);
- var isPrototypeOf = __webpack_require__(19);
- var getIterator = __webpack_require__(167);
- var getIteratorMethod = __webpack_require__(106);
- var iteratorClose = __webpack_require__(168);
- var $TypeError = TypeError;
- var Result = function (stopped, result) {
- this.stopped = stopped;
- this.result = result;
- };
- var ResultPrototype = Result.prototype;
- module.exports = function (iterable, unboundFunction, options) {
- var that = options && options.that;
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
- var INTERRUPTED = !!(options && options.INTERRUPTED);
- var fn = bind(unboundFunction, that);
- var iterator, iterFn, index, length, result, next, step;
- var stop = function (condition) {
- if (iterator) iteratorClose(iterator, 'normal', condition);
- return new Result(true, condition);
- };
- var callFn = function (value) {
- if (AS_ENTRIES) {
- anObject(value);
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
- } return INTERRUPTED ? fn(value, stop) : fn(value);
- };
- if (IS_ITERATOR) {
- iterator = iterable;
- } else {
- iterFn = getIteratorMethod(iterable);
- if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
- // optimisation for array iterators
- if (isArrayIteratorMethod(iterFn)) {
- for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
- result = callFn(iterable[index]);
- if (result && isPrototypeOf(ResultPrototype, result)) return result;
- } return new Result(false);
- }
- iterator = getIterator(iterable, iterFn);
- }
- next = iterator.next;
- while (!(step = call(next, iterator)).done) {
- try {
- result = callFn(step.value);
- } catch (error) {
- iteratorClose(iterator, 'throw', error);
- }
- if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
- } return new Result(false);
- };
- /***/ }),
- /* 43 */
- /***/ (function(module, exports, __webpack_require__) {
- var NATIVE_WEAK_MAP = __webpack_require__(170);
- var global = __webpack_require__(7);
- var uncurryThis = __webpack_require__(4);
- var isObject = __webpack_require__(11);
- var createNonEnumerableProperty = __webpack_require__(37);
- var hasOwn = __webpack_require__(13);
- var shared = __webpack_require__(123);
- var sharedKey = __webpack_require__(101);
- var hiddenKeys = __webpack_require__(80);
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
- var TypeError = global.TypeError;
- var WeakMap = global.WeakMap;
- var set, get, has;
- var enforce = function (it) {
- return has(it) ? get(it) : set(it, {});
- };
- var getterFor = function (TYPE) {
- return function (it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
- } return state;
- };
- };
- if (NATIVE_WEAK_MAP || shared.state) {
- var store = shared.state || (shared.state = new WeakMap());
- var wmget = uncurryThis(store.get);
- var wmhas = uncurryThis(store.has);
- var wmset = uncurryThis(store.set);
- set = function (it, metadata) {
- if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- wmset(store, it, metadata);
- return metadata;
- };
- get = function (it) {
- return wmget(store, it) || {};
- };
- has = function (it) {
- return wmhas(store, it);
- };
- } else {
- var STATE = sharedKey('state');
- hiddenKeys[STATE] = true;
- set = function (it, metadata) {
- if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function (it) {
- return hasOwn(it, STATE) ? it[STATE] : {};
- };
- has = function (it) {
- return hasOwn(it, STATE);
- };
- }
- module.exports = {
- set: set,
- get: get,
- has: has,
- enforce: enforce,
- getterFor: getterFor
- };
- /***/ }),
- /* 44 */
- /***/ (function(module, exports, __webpack_require__) {
- var createNonEnumerableProperty = __webpack_require__(37);
- module.exports = function (target, key, value, options) {
- if (options && options.enumerable) target[key] = value;
- else createNonEnumerableProperty(target, key, value);
- return target;
- };
- /***/ }),
- /* 45 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = has;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Internal function to check whether `key` is an own property name of `obj`.
- function has(obj, key) {
- return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
- }
- /***/ }),
- /* 46 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238));
- var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
- var _ = __webpack_require__(3);
- /**
- * @class AV.Error
- */
- function AVError(code, message) {
- if (this instanceof AVError ? this.constructor : void 0) {
- var error = new Error(message);
- (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
- error.code = code;
- return error;
- }
- return new AVError(code, message);
- }
- AVError.prototype = Object.create(Error.prototype, {
- constructor: {
- value: Error,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- (0, _setPrototypeOf.default)(AVError, Error);
- _.extend(AVError,
- /** @lends AV.Error */
- {
- /**
- * Error code indicating some error other than those enumerated here.
- * @constant
- */
- OTHER_CAUSE: -1,
- /**
- * Error code indicating that something has gone wrong with the server.
- * If you get this error code, it is AV's fault.
- * @constant
- */
- INTERNAL_SERVER_ERROR: 1,
- /**
- * Error code indicating the connection to the AV servers failed.
- * @constant
- */
- CONNECTION_FAILED: 100,
- /**
- * Error code indicating the specified object doesn't exist.
- * @constant
- */
- OBJECT_NOT_FOUND: 101,
- /**
- * Error code indicating you tried to query with a datatype that doesn't
- * support it, like exact matching an array or object.
- * @constant
- */
- INVALID_QUERY: 102,
- /**
- * Error code indicating a missing or invalid classname. Classnames are
- * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
- * only valid characters.
- * @constant
- */
- INVALID_CLASS_NAME: 103,
- /**
- * Error code indicating an unspecified object id.
- * @constant
- */
- MISSING_OBJECT_ID: 104,
- /**
- * Error code indicating an invalid key name. Keys are case-sensitive. They
- * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
- * @constant
- */
- INVALID_KEY_NAME: 105,
- /**
- * Error code indicating a malformed pointer. You should not see this unless
- * you have been mucking about changing internal AV code.
- * @constant
- */
- INVALID_POINTER: 106,
- /**
- * Error code indicating that badly formed JSON was received upstream. This
- * either indicates you have done something unusual with modifying how
- * things encode to JSON, or the network is failing badly.
- * @constant
- */
- INVALID_JSON: 107,
- /**
- * Error code indicating that the feature you tried to access is only
- * available internally for testing purposes.
- * @constant
- */
- COMMAND_UNAVAILABLE: 108,
- /**
- * You must call AV.initialize before using the AV library.
- * @constant
- */
- NOT_INITIALIZED: 109,
- /**
- * Error code indicating that a field was set to an inconsistent type.
- * @constant
- */
- INCORRECT_TYPE: 111,
- /**
- * Error code indicating an invalid channel name. A channel name is either
- * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
- * characters.
- * @constant
- */
- INVALID_CHANNEL_NAME: 112,
- /**
- * Error code indicating that push is misconfigured.
- * @constant
- */
- PUSH_MISCONFIGURED: 115,
- /**
- * Error code indicating that the object is too large.
- * @constant
- */
- OBJECT_TOO_LARGE: 116,
- /**
- * Error code indicating that the operation isn't allowed for clients.
- * @constant
- */
- OPERATION_FORBIDDEN: 119,
- /**
- * Error code indicating the result was not found in the cache.
- * @constant
- */
- CACHE_MISS: 120,
- /**
- * Error code indicating that an invalid key was used in a nested
- * JSONObject.
- * @constant
- */
- INVALID_NESTED_KEY: 121,
- /**
- * Error code indicating that an invalid filename was used for AVFile.
- * A valid file name contains only a-zA-Z0-9_. characters and is between 1
- * and 128 characters.
- * @constant
- */
- INVALID_FILE_NAME: 122,
- /**
- * Error code indicating an invalid ACL was provided.
- * @constant
- */
- INVALID_ACL: 123,
- /**
- * Error code indicating that the request timed out on the server. Typically
- * this indicates that the request is too expensive to run.
- * @constant
- */
- TIMEOUT: 124,
- /**
- * Error code indicating that the email address was invalid.
- * @constant
- */
- INVALID_EMAIL_ADDRESS: 125,
- /**
- * Error code indicating a missing content type.
- * @constant
- */
- MISSING_CONTENT_TYPE: 126,
- /**
- * Error code indicating a missing content length.
- * @constant
- */
- MISSING_CONTENT_LENGTH: 127,
- /**
- * Error code indicating an invalid content length.
- * @constant
- */
- INVALID_CONTENT_LENGTH: 128,
- /**
- * Error code indicating a file that was too large.
- * @constant
- */
- FILE_TOO_LARGE: 129,
- /**
- * Error code indicating an error saving a file.
- * @constant
- */
- FILE_SAVE_ERROR: 130,
- /**
- * Error code indicating an error deleting a file.
- * @constant
- */
- FILE_DELETE_ERROR: 153,
- /**
- * Error code indicating that a unique field was given a value that is
- * already taken.
- * @constant
- */
- DUPLICATE_VALUE: 137,
- /**
- * Error code indicating that a role's name is invalid.
- * @constant
- */
- INVALID_ROLE_NAME: 139,
- /**
- * Error code indicating that an application quota was exceeded. Upgrade to
- * resolve.
- * @constant
- */
- EXCEEDED_QUOTA: 140,
- /**
- * Error code indicating that a Cloud Code script failed.
- * @constant
- */
- SCRIPT_FAILED: 141,
- /**
- * Error code indicating that a Cloud Code validation failed.
- * @constant
- */
- VALIDATION_ERROR: 142,
- /**
- * Error code indicating that invalid image data was provided.
- * @constant
- */
- INVALID_IMAGE_DATA: 150,
- /**
- * Error code indicating an unsaved file.
- * @constant
- */
- UNSAVED_FILE_ERROR: 151,
- /**
- * Error code indicating an invalid push time.
- * @constant
- */
- INVALID_PUSH_TIME_ERROR: 152,
- /**
- * Error code indicating that the username is missing or empty.
- * @constant
- */
- USERNAME_MISSING: 200,
- /**
- * Error code indicating that the password is missing or empty.
- * @constant
- */
- PASSWORD_MISSING: 201,
- /**
- * Error code indicating that the username has already been taken.
- * @constant
- */
- USERNAME_TAKEN: 202,
- /**
- * Error code indicating that the email has already been taken.
- * @constant
- */
- EMAIL_TAKEN: 203,
- /**
- * Error code indicating that the email is missing, but must be specified.
- * @constant
- */
- EMAIL_MISSING: 204,
- /**
- * Error code indicating that a user with the specified email was not found.
- * @constant
- */
- EMAIL_NOT_FOUND: 205,
- /**
- * Error code indicating that a user object without a valid session could
- * not be altered.
- * @constant
- */
- SESSION_MISSING: 206,
- /**
- * Error code indicating that a user can only be created through signup.
- * @constant
- */
- MUST_CREATE_USER_THROUGH_SIGNUP: 207,
- /**
- * Error code indicating that an an account being linked is already linked
- * to another user.
- * @constant
- */
- ACCOUNT_ALREADY_LINKED: 208,
- /**
- * Error code indicating that a user cannot be linked to an account because
- * that account's id could not be found.
- * @constant
- */
- LINKED_ID_MISSING: 250,
- /**
- * Error code indicating that a user with a linked (e.g. Facebook) account
- * has an invalid session.
- * @constant
- */
- INVALID_LINKED_SESSION: 251,
- /**
- * Error code indicating that a service being linked (e.g. Facebook or
- * Twitter) is unsupported.
- * @constant
- */
- UNSUPPORTED_SERVICE: 252,
- /**
- * Error code indicating a real error code is unavailable because
- * we had to use an XDomainRequest object to allow CORS requests in
- * Internet Explorer, which strips the body from HTTP responses that have
- * a non-2XX status code.
- * @constant
- */
- X_DOMAIN_REQUEST: 602
- });
- module.exports = AVError;
- /***/ }),
- /* 47 */
- /***/ (function(module, exports) {
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- /***/ }),
- /* 48 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var aCallable = __webpack_require__(31);
- var NATIVE_BIND = __webpack_require__(76);
- var bind = uncurryThis(uncurryThis.bind);
- // optional / simple context binding
- module.exports = function (fn, that) {
- aCallable(fn);
- return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- /***/ }),
- /* 49 */
- /***/ (function(module, exports, __webpack_require__) {
- /* global ActiveXObject -- old IE, WSH */
- var anObject = __webpack_require__(20);
- var definePropertiesModule = __webpack_require__(128);
- var enumBugKeys = __webpack_require__(127);
- var hiddenKeys = __webpack_require__(80);
- var html = __webpack_require__(165);
- var documentCreateElement = __webpack_require__(124);
- var sharedKey = __webpack_require__(101);
- var GT = '>';
- var LT = '<';
- var PROTOTYPE = 'prototype';
- var SCRIPT = 'script';
- var IE_PROTO = sharedKey('IE_PROTO');
- var EmptyConstructor = function () { /* empty */ };
- var scriptTag = function (content) {
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
- };
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
- var NullProtoObjectViaActiveX = function (activeXDocument) {
- activeXDocument.write(scriptTag(''));
- activeXDocument.close();
- var temp = activeXDocument.parentWindow.Object;
- activeXDocument = null; // avoid memory leak
- return temp;
- };
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var NullProtoObjectViaIFrame = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = documentCreateElement('iframe');
- var JS = 'java' + SCRIPT + ':';
- var iframeDocument;
- iframe.style.display = 'none';
- html.appendChild(iframe);
- // https://github.com/zloirock/core-js/issues/475
- iframe.src = String(JS);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(scriptTag('document.F=Object'));
- iframeDocument.close();
- return iframeDocument.F;
- };
- // Check for document.domain and active x support
- // No need to use active x approach when document.domain is not set
- // see https://github.com/es-shims/es5-shim/issues/150
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
- // avoid IE GC bug
- var activeXDocument;
- var NullProtoObject = function () {
- try {
- activeXDocument = new ActiveXObject('htmlfile');
- } catch (error) { /* ignore */ }
- NullProtoObject = typeof document != 'undefined'
- ? document.domain && activeXDocument
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
- : NullProtoObjectViaIFrame()
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
- var length = enumBugKeys.length;
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
- return NullProtoObject();
- };
- hiddenKeys[IE_PROTO] = true;
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- // eslint-disable-next-line es-x/no-object-create -- safe
- module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- EmptyConstructor[PROTOTYPE] = anObject(O);
- result = new EmptyConstructor();
- EmptyConstructor[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = NullProtoObject();
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
- };
- /***/ }),
- /* 50 */
- /***/ (function(module, exports) {
- module.exports = {};
- /***/ }),
- /* 51 */
- /***/ (function(module, exports, __webpack_require__) {
- var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
- var isCallable = __webpack_require__(8);
- var classofRaw = __webpack_require__(63);
- var wellKnownSymbol = __webpack_require__(9);
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var $Object = Object;
- // ES3 wrong here
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (error) { /* empty */ }
- };
- // getting tag from ES6+ `Object.prototype.toString`
- module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
- var O, tag, result;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
- // builtinTag case
- : CORRECT_ARGUMENTS ? classofRaw(O)
- // ES3 arguments fallback
- : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
- };
- /***/ }),
- /* 52 */
- /***/ (function(module, exports, __webpack_require__) {
- var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
- var defineProperty = __webpack_require__(23).f;
- var createNonEnumerableProperty = __webpack_require__(37);
- var hasOwn = __webpack_require__(13);
- var toString = __webpack_require__(298);
- var wellKnownSymbol = __webpack_require__(9);
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- module.exports = function (it, TAG, STATIC, SET_METHOD) {
- if (it) {
- var target = STATIC ? it : it.prototype;
- if (!hasOwn(target, TO_STRING_TAG)) {
- defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
- }
- if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
- createNonEnumerableProperty(target, 'toString', toString);
- }
- }
- };
- /***/ }),
- /* 53 */
- /***/ (function(module, exports) {
- // empty
- /***/ }),
- /* 54 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var aCallable = __webpack_require__(31);
- var PromiseCapability = function (C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aCallable(resolve);
- this.reject = aCallable(reject);
- };
- // `NewPromiseCapability` abstract operation
- // https://tc39.es/ecma262/#sec-newpromisecapability
- module.exports.f = function (C) {
- return new PromiseCapability(C);
- };
- /***/ }),
- /* 55 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var charAt = __webpack_require__(316).charAt;
- var toString = __webpack_require__(81);
- var InternalStateModule = __webpack_require__(43);
- var defineIterator = __webpack_require__(131);
- var STRING_ITERATOR = 'String Iterator';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
- // `String.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
- defineIterator(String, 'String', function (iterated) {
- setInternalState(this, {
- type: STRING_ITERATOR,
- string: toString(iterated),
- index: 0
- });
- // `%StringIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
- }, function next() {
- var state = getInternalState(this);
- var string = state.string;
- var index = state.index;
- var point;
- if (index >= string.length) return { value: undefined, done: true };
- point = charAt(string, index);
- state.index += point.length;
- return { value: point, done: false };
- });
- /***/ }),
- /* 56 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
- // Is a given variable an object?
- function isObject(obj) {
- var type = typeof obj;
- return type === 'function' || type === 'object' && !!obj;
- }
- /***/ }),
- /* 57 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(17);
- // Is a given value an array?
- // Delegates to ECMA5's native `Array.isArray`.
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
- /***/ }),
- /* 58 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = each;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
- // The cornerstone for collection functions, an `each`
- // implementation, aka `forEach`.
- // Handles raw objects in addition to array-likes. Treats all
- // sparse array-likes as if they were dense.
- function each(obj, iteratee, context) {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
- var i, length;
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
- for (i = 0, length = obj.length; i < length; i++) {
- iteratee(obj[i], i, obj);
- }
- } else {
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
- for (i = 0, length = _keys.length; i < length; i++) {
- iteratee(obj[_keys[i]], _keys[i], obj);
- }
- }
- return obj;
- }
- /***/ }),
- /* 59 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(408);
- /***/ }),
- /* 60 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /* eslint-env browser */
- /**
- * This is the web browser implementation of `debug()`.
- */
- exports.log = log;
- exports.formatArgs = formatArgs;
- exports.save = save;
- exports.load = load;
- exports.useColors = useColors;
- exports.storage = localstorage();
- /**
- * Colors.
- */
- exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
- /**
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
- * and the Firebug extension (any Firefox version) are known
- * to support "%c" CSS customizations.
- *
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
- */
- // eslint-disable-next-line complexity
- function useColors() {
- // NB: In an Electron preload script, document will be defined but not fully
- // initialized. Since we know we're in Chrome, we'll just detect this case
- // explicitly
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
- return true;
- } // Internet Explorer and Edge do not support colors.
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
- return false;
- } // Is webkit? http://stackoverflow.com/a/16459606/376773
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
- }
- /**
- * Colorize log arguments if enabled.
- *
- * @api public
- */
- function formatArgs(args) {
- args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
- if (!this.useColors) {
- return;
- }
- var c = 'color: ' + this.color;
- args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
- // arguments passed either before or after the %c, so we need to
- // figure out the correct index to insert the CSS into
- var index = 0;
- var lastC = 0;
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
- if (match === '%%') {
- return;
- }
- index++;
- if (match === '%c') {
- // We only are interested in the *last* %c
- // (the user may have provided their own)
- lastC = index;
- }
- });
- args.splice(lastC, 0, c);
- }
- /**
- * Invokes `console.log()` when available.
- * No-op when `console.log` is not a "function".
- *
- * @api public
- */
- function log() {
- var _console;
- // This hackery is required for IE8/9, where
- // the `console.log` function doesn't have 'apply'
- return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
- }
- /**
- * Save `namespaces`.
- *
- * @param {String} namespaces
- * @api private
- */
- function save(namespaces) {
- try {
- if (namespaces) {
- exports.storage.setItem('debug', namespaces);
- } else {
- exports.storage.removeItem('debug');
- }
- } catch (error) {// Swallow
- // XXX (@Qix-) should we be logging these?
- }
- }
- /**
- * Load `namespaces`.
- *
- * @return {String} returns the previously persisted debug modes
- * @api private
- */
- function load() {
- var r;
- try {
- r = exports.storage.getItem('debug');
- } catch (error) {} // Swallow
- // XXX (@Qix-) should we be logging these?
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
- if (!r && typeof process !== 'undefined' && 'env' in process) {
- r = process.env.DEBUG;
- }
- return r;
- }
- /**
- * Localstorage attempts to return the localstorage.
- *
- * This is necessary because safari throws
- * when a user disables cookies/localstorage
- * and you attempt to access it.
- *
- * @return {LocalStorage}
- * @api private
- */
- function localstorage() {
- try {
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
- // The Browser also has localStorage in the global context.
- return localStorage;
- } catch (error) {// Swallow
- // XXX (@Qix-) should we be logging these?
- }
- }
- module.exports = __webpack_require__(413)(exports);
- var formatters = module.exports.formatters;
- /**
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
- */
- formatters.j = function (v) {
- try {
- return JSON.stringify(v);
- } catch (error) {
- return '[UnexpectedJSONParseError]: ' + error.message;
- }
- };
- /***/ }),
- /* 61 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(240);
- /***/ }),
- /* 62 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var call = __webpack_require__(15);
- var propertyIsEnumerableModule = __webpack_require__(120);
- var createPropertyDescriptor = __webpack_require__(47);
- var toIndexedObject = __webpack_require__(32);
- var toPropertyKey = __webpack_require__(96);
- var hasOwn = __webpack_require__(13);
- var IE8_DOM_DEFINE = __webpack_require__(158);
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPropertyKey(P);
- if (IE8_DOM_DEFINE) try {
- return $getOwnPropertyDescriptor(O, P);
- } catch (error) { /* empty */ }
- if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
- };
- /***/ }),
- /* 63 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var toString = uncurryThis({}.toString);
- var stringSlice = uncurryThis(''.slice);
- module.exports = function (it) {
- return stringSlice(toString(it), 8, -1);
- };
- /***/ }),
- /* 64 */
- /***/ (function(module, exports, __webpack_require__) {
- /* eslint-disable es-x/no-symbol -- required for testing */
- var V8_VERSION = __webpack_require__(77);
- var fails = __webpack_require__(2);
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
- module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
- var symbol = Symbol();
- // Chrome 38 Symbol has incorrect toString conversion
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
- });
- /***/ }),
- /* 65 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- module.exports = global.Promise;
- /***/ }),
- /* 66 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = values;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
- // Retrieve the values of an object's properties.
- function values(obj) {
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
- var length = _keys.length;
- var values = Array(length);
- for (var i = 0; i < length; i++) {
- values[i] = obj[_keys[i]];
- }
- return values;
- }
- /***/ }),
- /* 67 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(57);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135);
- // Internal implementation of a recursive `flatten` function.
- function flatten(input, depth, strict, output) {
- output = output || [];
- if (!depth && depth !== 0) {
- depth = Infinity;
- } else if (depth <= 0) {
- return output.concat(input);
- }
- var idx = output.length;
- for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
- var value = input[i];
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(value) && (Object(__WEBPACK_IMPORTED_MODULE_2__isArray_js__["a" /* default */])(value) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(value))) {
- // Flatten current level of array or arguments object.
- if (depth > 1) {
- flatten(value, depth - 1, strict, output);
- idx = output.length;
- } else {
- var j = 0, len = value.length;
- while (j < len) output[idx++] = value[j++];
- }
- } else if (!strict) {
- output[idx++] = value;
- }
- }
- return output;
- }
- /***/ }),
- /* 68 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = map;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
- // Return the results of applying the iteratee to each element.
- function map(obj, iteratee, context) {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
- var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
- length = (_keys || obj).length,
- results = Array(length);
- for (var index = 0; index < length; index++) {
- var currentKey = _keys ? _keys[index] : index;
- results[index] = iteratee(obj[currentKey], currentKey, obj);
- }
- return results;
- }
- /***/ }),
- /* 69 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _keys = _interopRequireDefault(__webpack_require__(115));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _indexOf = _interopRequireDefault(__webpack_require__(71));
- var _keys2 = _interopRequireDefault(__webpack_require__(59));
- var _ = __webpack_require__(3);
- var uuid = __webpack_require__(232);
- var debug = __webpack_require__(60);
- var _require = __webpack_require__(30),
- inherits = _require.inherits,
- parseDate = _require.parseDate;
- var version = __webpack_require__(234);
- var _require2 = __webpack_require__(72),
- setAdapters = _require2.setAdapters,
- adapterManager = _require2.adapterManager;
- var AV = global.AV || {}; // All internal configuration items
- AV._config = {
- serverURLs: {},
- useMasterKey: false,
- production: null,
- realtime: null,
- requestTimeout: null
- };
- var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
- AV._sharedConfig = {
- userAgent: initialUserAgent,
- liveQueryRealtime: null
- };
- adapterManager.on('platformInfo', function (platformInfo) {
- var ua = initialUserAgent;
- if (platformInfo) {
- if (platformInfo.userAgent) {
- ua = platformInfo.userAgent;
- } else {
- var comments = platformInfo.name;
- if (platformInfo.version) {
- comments += "/".concat(platformInfo.version);
- }
- if (platformInfo.extra) {
- comments += "; ".concat(platformInfo.extra);
- }
- ua += " (".concat(comments, ")");
- }
- }
- AV._sharedConfig.userAgent = ua;
- });
- /**
- * Contains all AV API classes and functions.
- * @namespace AV
- */
- /**
- * Returns prefix for localStorage keys used by this instance of AV.
- * @param {String} path The relative suffix to append to it.
- * null or undefined is treated as the empty string.
- * @return {String} The full key name.
- * @private
- */
- AV._getAVPath = function (path) {
- if (!AV.applicationId) {
- throw new Error('You need to call AV.initialize before using AV.');
- }
- if (!path) {
- path = '';
- }
- if (!_.isString(path)) {
- throw new Error("Tried to get a localStorage path that wasn't a String.");
- }
- if (path[0] === '/') {
- path = path.substring(1);
- }
- return 'AV/' + AV.applicationId + '/' + path;
- };
- /**
- * Returns the unique string for this app on this machine.
- * Gets reset when localStorage is cleared.
- * @private
- */
- AV._installationId = null;
- AV._getInstallationId = function () {
- // See if it's cached in RAM.
- if (AV._installationId) {
- return _promise.default.resolve(AV._installationId);
- } // Try to get it from localStorage.
- var path = AV._getAVPath('installationId');
- return AV.localStorage.getItemAsync(path).then(function (_installationId) {
- AV._installationId = _installationId;
- if (!AV._installationId) {
- // It wasn't in localStorage, so create a new one.
- AV._installationId = _installationId = uuid();
- return AV.localStorage.setItemAsync(path, _installationId).then(function () {
- return _installationId;
- });
- }
- return _installationId;
- });
- };
- AV._subscriptionId = null;
- AV._refreshSubscriptionId = function () {
- var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
- var subscriptionId = AV._subscriptionId = uuid();
- return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
- return subscriptionId;
- });
- };
- AV._getSubscriptionId = function () {
- // See if it's cached in RAM.
- if (AV._subscriptionId) {
- return _promise.default.resolve(AV._subscriptionId);
- } // Try to get it from localStorage.
- var path = AV._getAVPath('subscriptionId');
- return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
- AV._subscriptionId = _subscriptionId;
- if (!AV._subscriptionId) {
- // It wasn't in localStorage, so create a new one.
- _subscriptionId = AV._refreshSubscriptionId(path);
- }
- return _subscriptionId;
- });
- };
- AV._parseDate = parseDate; // A self-propagating extend function.
- AV._extend = function (protoProps, classProps) {
- var child = inherits(this, protoProps, classProps);
- child.extend = this.extend;
- return child;
- };
- /**
- * Converts a value in a AV Object into the appropriate representation.
- * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
- * if seenObjects is falsey. Otherwise any AV.Objects not in
- * seenObjects will be fully embedded rather than encoded
- * as a pointer. This array will be used to prevent going into an infinite
- * loop because we have circular references. If <seenObjects>
- * is set, then none of the AV Objects that are serialized can be dirty.
- * @private
- */
- AV._encode = function (value, seenObjects, disallowObjects) {
- var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
- if (value instanceof AV.Object) {
- if (disallowObjects) {
- throw new Error('AV.Objects not allowed here');
- }
- if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
- return value._toPointer();
- }
- return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
- }
- if (value instanceof AV.ACL) {
- return value.toJSON();
- }
- if (_.isDate(value)) {
- return full ? {
- __type: 'Date',
- iso: value.toJSON()
- } : value.toJSON();
- }
- if (value instanceof AV.GeoPoint) {
- return value.toJSON();
- }
- if (_.isArray(value)) {
- return (0, _map.default)(_).call(_, value, function (x) {
- return AV._encode(x, seenObjects, disallowObjects, full);
- });
- }
- if (_.isRegExp(value)) {
- return value.source;
- }
- if (value instanceof AV.Relation) {
- return value.toJSON();
- }
- if (value instanceof AV.Op) {
- return value.toJSON();
- }
- if (value instanceof AV.File) {
- if (!value.url() && !value.id) {
- throw new Error('Tried to save an object containing an unsaved file.');
- }
- return value._toFullJSON(seenObjects, full);
- }
- if (_.isObject(value)) {
- return _.mapObject(value, function (v, k) {
- return AV._encode(v, seenObjects, disallowObjects, full);
- });
- }
- return value;
- };
- /**
- * The inverse function of AV._encode.
- * @private
- */
- AV._decode = function (value, key) {
- if (!_.isObject(value) || _.isDate(value)) {
- return value;
- }
- if (_.isArray(value)) {
- return (0, _map.default)(_).call(_, value, function (v) {
- return AV._decode(v);
- });
- }
- if (value instanceof AV.Object) {
- return value;
- }
- if (value instanceof AV.File) {
- return value;
- }
- if (value instanceof AV.Op) {
- return value;
- }
- if (value instanceof AV.GeoPoint) {
- return value;
- }
- if (value instanceof AV.ACL) {
- return value;
- }
- if (key === 'ACL') {
- return new AV.ACL(value);
- }
- if (value.__op) {
- return AV.Op._decode(value);
- }
- var className;
- if (value.__type === 'Pointer') {
- className = value.className;
- var pointer = AV.Object._create(className);
- if ((0, _keys.default)(value).length > 3) {
- var v = _.clone(value);
- delete v.__type;
- delete v.className;
- pointer._finishFetch(v, true);
- } else {
- pointer._finishFetch({
- objectId: value.objectId
- }, false);
- }
- return pointer;
- }
- if (value.__type === 'Object') {
- // It's an Object included in a query result.
- className = value.className;
- var _v = _.clone(value);
- delete _v.__type;
- delete _v.className;
- var object = AV.Object._create(className);
- object._finishFetch(_v, true);
- return object;
- }
- if (value.__type === 'Date') {
- return AV._parseDate(value.iso);
- }
- if (value.__type === 'GeoPoint') {
- return new AV.GeoPoint({
- latitude: value.latitude,
- longitude: value.longitude
- });
- }
- if (value.__type === 'Relation') {
- if (!key) throw new Error('key missing decoding a Relation');
- var relation = new AV.Relation(null, key);
- relation.targetClassName = value.className;
- return relation;
- }
- if (value.__type === 'File') {
- var file = new AV.File(value.name);
- var _v2 = _.clone(value);
- delete _v2.__type;
- file._finishFetch(_v2);
- return file;
- }
- return _.mapObject(value, AV._decode);
- };
- /**
- * The inverse function of {@link AV.Object#toFullJSON}.
- * @since 3.0.0
- * @method
- * @param {Object}
- * return {AV.Object|AV.File|any}
- */
- AV.parseJSON = AV._decode;
- /**
- * Similar to JSON.parse, except that AV internal types will be used if possible.
- * Inverse to {@link AV.stringify}
- * @since 3.14.0
- * @param {string} text the string to parse.
- * @return {AV.Object|AV.File|any}
- */
- AV.parse = function (text) {
- return AV.parseJSON(JSON.parse(text));
- };
- /**
- * Serialize a target containing AV.Object, similar to JSON.stringify.
- * Inverse to {@link AV.parse}
- * @since 3.14.0
- * @return {string}
- */
- AV.stringify = function (target) {
- return (0, _stringify.default)(AV._encode(target, [], false, true));
- };
- AV._encodeObjectOrArray = function (value) {
- var encodeAVObject = function encodeAVObject(object) {
- if (object && object._toFullJSON) {
- object = object._toFullJSON([]);
- }
- return _.mapObject(object, function (value) {
- return AV._encode(value, []);
- });
- };
- if (_.isArray(value)) {
- return (0, _map.default)(value).call(value, function (object) {
- return encodeAVObject(object);
- });
- } else {
- return encodeAVObject(value);
- }
- };
- AV._arrayEach = _.each;
- /**
- * Does a deep traversal of every item in object, calling func on every one.
- * @param {Object} object The object or array to traverse deeply.
- * @param {Function} func The function to call for every item. It will
- * be passed the item as an argument. If it returns a truthy value, that
- * value will replace the item in its parent container.
- * @returns {} the result of calling func on the top-level object itself.
- * @private
- */
- AV._traverse = function (object, func, seen) {
- if (object instanceof AV.Object) {
- seen = seen || [];
- if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
- // We've already visited this object in this call.
- return;
- }
- seen.push(object);
- AV._traverse(object.attributes, func, seen);
- return func(object);
- }
- if (object instanceof AV.Relation || object instanceof AV.File) {
- // Nothing needs to be done, but we don't want to recurse into the
- // object's parent infinitely, so we catch this case.
- return func(object);
- }
- if (_.isArray(object)) {
- _.each(object, function (child, index) {
- var newChild = AV._traverse(child, func, seen);
- if (newChild) {
- object[index] = newChild;
- }
- });
- return func(object);
- }
- if (_.isObject(object)) {
- AV._each(object, function (child, key) {
- var newChild = AV._traverse(child, func, seen);
- if (newChild) {
- object[key] = newChild;
- }
- });
- return func(object);
- }
- return func(object);
- };
- /**
- * This is like _.each, except:
- * * it doesn't work for so-called array-like objects,
- * * it does work for dictionaries with a "length" attribute.
- * @private
- */
- AV._objectEach = AV._each = function (obj, callback) {
- if (_.isObject(obj)) {
- _.each((0, _keys2.default)(_).call(_, obj), function (key) {
- callback(obj[key], key);
- });
- } else {
- _.each(obj, callback);
- }
- };
- /**
- * @namespace
- * @since 3.14.0
- */
- AV.debug = {
- /**
- * Enable debug
- */
- enable: function enable() {
- var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
- return debug.enable(namespaces);
- },
- /**
- * Disable debug
- */
- disable: debug.disable
- };
- /**
- * Specify Adapters
- * @since 4.4.0
- * @function
- * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
- */
- AV.setAdapters = setAdapters;
- module.exports = AV;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
- /***/ }),
- /* 70 */
- /***/ (function(module, exports, __webpack_require__) {
- var bind = __webpack_require__(48);
- var uncurryThis = __webpack_require__(4);
- var IndexedObject = __webpack_require__(95);
- var toObject = __webpack_require__(34);
- var lengthOfArrayLike = __webpack_require__(41);
- var arraySpeciesCreate = __webpack_require__(229);
- var push = uncurryThis([].push);
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
- var createMethod = function (TYPE) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var IS_FILTER_REJECT = TYPE == 7;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- return function ($this, callbackfn, that, specificCreate) {
- var O = toObject($this);
- var self = IndexedObject(O);
- var boundFunction = bind(callbackfn, that);
- var length = lengthOfArrayLike(self);
- var index = 0;
- var create = specificCreate || arraySpeciesCreate;
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
- var value, result;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- value = self[index];
- result = boundFunction(value, index, O);
- if (TYPE) {
- if (IS_MAP) target[index] = result; // map
- else if (result) switch (TYPE) {
- case 3: return true; // some
- case 5: return value; // find
- case 6: return index; // findIndex
- case 2: push(target, value); // filter
- } else switch (TYPE) {
- case 4: return false; // every
- case 7: push(target, value); // filterReject
- }
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
- };
- };
- module.exports = {
- // `Array.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- forEach: createMethod(0),
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- map: createMethod(1),
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- filter: createMethod(2),
- // `Array.prototype.some` method
- // https://tc39.es/ecma262/#sec-array.prototype.some
- some: createMethod(3),
- // `Array.prototype.every` method
- // https://tc39.es/ecma262/#sec-array.prototype.every
- every: createMethod(4),
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- find: createMethod(5),
- // `Array.prototype.findIndex` method
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
- findIndex: createMethod(6),
- // `Array.prototype.filterReject` method
- // https://github.com/tc39/proposal-array-filtering
- filterReject: createMethod(7)
- };
- /***/ }),
- /* 71 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(404);
- /***/ }),
- /* 72 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _keys = _interopRequireDefault(__webpack_require__(59));
- var _ = __webpack_require__(3);
- var EventEmitter = __webpack_require__(235);
- var _require = __webpack_require__(30),
- inherits = _require.inherits;
- var AdapterManager = inherits(EventEmitter, {
- constructor: function constructor() {
- EventEmitter.apply(this);
- this._adapters = {};
- },
- getAdapter: function getAdapter(name) {
- var adapter = this._adapters[name];
- if (adapter === undefined) {
- throw new Error("".concat(name, " adapter is not configured"));
- }
- return adapter;
- },
- setAdapters: function setAdapters(newAdapters) {
- var _this = this;
- _.extend(this._adapters, newAdapters);
- (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
- return _this.emit(name, newAdapters[name]);
- });
- }
- });
- var adapterManager = new AdapterManager();
- module.exports = {
- getAdapter: adapterManager.getAdapter.bind(adapterManager),
- setAdapters: adapterManager.setAdapters.bind(adapterManager),
- adapterManager: adapterManager
- };
- /***/ }),
- /* 73 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Symbol = __webpack_require__(242);
- var _Symbol$iterator = __webpack_require__(459);
- function _typeof(obj) {
- "@babel/helpers - typeof";
- return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
- }
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 74 */
- /***/ (function(module, exports) {
- var g;
- // This works in non-strict mode
- g = (function() {
- return this;
- })();
- try {
- // This works if eval is allowed (see CSP)
- g = g || Function("return this")() || (1,eval)("this");
- } catch(e) {
- // This works if the window reference is available
- if(typeof window === "object")
- g = window;
- }
- // g can still be undefined, but nothing to do about it...
- // We return undefined, instead of nothing here, so it's
- // easier to handle this case. if(!global) { ...}
- module.exports = g;
- /***/ }),
- /* 75 */
- /***/ (function(module, exports, __webpack_require__) {
- var NATIVE_BIND = __webpack_require__(76);
- var FunctionPrototype = Function.prototype;
- var apply = FunctionPrototype.apply;
- var call = FunctionPrototype.call;
- // eslint-disable-next-line es-x/no-reflect -- safe
- module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
- return call.apply(apply, arguments);
- });
- /***/ }),
- /* 76 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- module.exports = !fails(function () {
- // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
- var test = (function () { /* empty */ }).bind();
- // eslint-disable-next-line no-prototype-builtins -- safe
- return typeof test != 'function' || test.hasOwnProperty('prototype');
- });
- /***/ }),
- /* 77 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var userAgent = __webpack_require__(98);
- var process = global.process;
- var Deno = global.Deno;
- var versions = process && process.versions || Deno && Deno.version;
- var v8 = versions && versions.v8;
- var match, version;
- if (v8) {
- match = v8.split('.');
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
- // but their correct versions are not interesting for us
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
- }
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
- // so check `userAgent` even if `.v8` exists, but 0
- if (!version && userAgent) {
- match = userAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = userAgent.match(/Chrome\/(\d+)/);
- if (match) version = +match[1];
- }
- }
- module.exports = version;
- /***/ }),
- /* 78 */
- /***/ (function(module, exports) {
- var $String = String;
- module.exports = function (argument) {
- try {
- return $String(argument);
- } catch (error) {
- return 'Object';
- }
- };
- /***/ }),
- /* 79 */
- /***/ (function(module, exports, __webpack_require__) {
- var IS_PURE = __webpack_require__(33);
- var store = __webpack_require__(123);
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: '3.23.3',
- mode: IS_PURE ? 'pure' : 'global',
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
- license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
- source: 'https://github.com/zloirock/core-js'
- });
- /***/ }),
- /* 80 */
- /***/ (function(module, exports) {
- module.exports = {};
- /***/ }),
- /* 81 */
- /***/ (function(module, exports, __webpack_require__) {
- var classof = __webpack_require__(51);
- var $String = String;
- module.exports = function (argument) {
- if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
- return $String(argument);
- };
- /***/ }),
- /* 82 */
- /***/ (function(module, exports) {
- module.exports = function (exec) {
- try {
- return { error: false, value: exec() };
- } catch (error) {
- return { error: true, value: error };
- }
- };
- /***/ }),
- /* 83 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var NativePromiseConstructor = __webpack_require__(65);
- var isCallable = __webpack_require__(8);
- var isForced = __webpack_require__(159);
- var inspectSource = __webpack_require__(130);
- var wellKnownSymbol = __webpack_require__(9);
- var IS_BROWSER = __webpack_require__(307);
- var IS_PURE = __webpack_require__(33);
- var V8_VERSION = __webpack_require__(77);
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- var SPECIES = wellKnownSymbol('species');
- var SUBCLASSING = false;
- var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
- var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
- var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
- var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // We can't detect it synchronously, so just check versions
- if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
- // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
- if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
- // We can't use @@species feature detection in V8 since it causes
- // deoptimization and performance degradation
- // https://github.com/zloirock/core-js/issues/679
- if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
- // Detect correctness of subclassing with @@species support
- var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
- var FakePromise = function (exec) {
- exec(function () { /* empty */ }, function () { /* empty */ });
- };
- var constructor = promise.constructor = {};
- constructor[SPECIES] = FakePromise;
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
- if (!SUBCLASSING) return true;
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
- });
- module.exports = {
- CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
- REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
- SUBCLASSING: SUBCLASSING
- };
- /***/ }),
- /* 84 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(324);
- // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
- // In IE 11, the most common among them, this problem also applies to
- // `Map`, `WeakMap` and `Set`.
- var hasStringTagBug = (
- __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
- ),
- isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
- /***/ }),
- /* 85 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(190);
- // Retrieve all the enumerable property names of an object.
- function allKeys(obj) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
- var keys = [];
- for (var key in obj) keys.push(key);
- // Ahem, IE < 9.
- if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
- return keys;
- }
- /***/ }),
- /* 86 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(199);
- // Internal wrapper for `_.toPath` to enable minification.
- // Similar to `cb` for `_.iteratee`.
- function toPath(path) {
- return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
- }
- /***/ }),
- /* 87 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
- // Internal function that returns an efficient (for current engines) version
- // of the passed-in callback, to be repeatedly applied in other Underscore
- // functions.
- function optimizeCb(func, context, argCount) {
- if (context === void 0) return func;
- switch (argCount == null ? 3 : argCount) {
- case 1: return function(value) {
- return func.call(context, value);
- };
- // The 2-argument case is omitted because we’re not using it.
- case 3: return function(value, index, collection) {
- return func.call(context, value, index, collection);
- };
- case 4: return function(accumulator, value, index, collection) {
- return func.call(context, accumulator, value, index, collection);
- };
- }
- return function() {
- return func.apply(context, arguments);
- };
- }
- /***/ }),
- /* 88 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = filter;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
- // Return all the elements that pass a truth test.
- function filter(obj, predicate, context) {
- var results = [];
- predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
- Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
- if (predicate(value, index, list)) results.push(value);
- });
- return results;
- }
- /***/ }),
- /* 89 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = contains;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(215);
- // Determine if the array or object contains a given item (using `===`).
- function contains(obj, item, fromIndex, guard) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
- if (typeof fromIndex != 'number' || guard) fromIndex = 0;
- return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
- }
- /***/ }),
- /* 90 */
- /***/ (function(module, exports, __webpack_require__) {
- var classof = __webpack_require__(63);
- // `IsArray` abstract operation
- // https://tc39.es/ecma262/#sec-isarray
- // eslint-disable-next-line es-x/no-array-isarray -- safe
- module.exports = Array.isArray || function isArray(argument) {
- return classof(argument) == 'Array';
- };
- /***/ }),
- /* 91 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var toPropertyKey = __webpack_require__(96);
- var definePropertyModule = __webpack_require__(23);
- var createPropertyDescriptor = __webpack_require__(47);
- module.exports = function (object, key, value) {
- var propertyKey = toPropertyKey(key);
- if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
- else object[propertyKey] = value;
- };
- /***/ }),
- /* 92 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(241);
- /***/ }),
- /* 93 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(472);
- /***/ }),
- /* 94 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var uncurryThis = __webpack_require__(4);
- var hiddenKeys = __webpack_require__(80);
- var isObject = __webpack_require__(11);
- var hasOwn = __webpack_require__(13);
- var defineProperty = __webpack_require__(23).f;
- var getOwnPropertyNamesModule = __webpack_require__(103);
- var getOwnPropertyNamesExternalModule = __webpack_require__(245);
- var isExtensible = __webpack_require__(261);
- var uid = __webpack_require__(99);
- var FREEZING = __webpack_require__(262);
- var REQUIRED = false;
- var METADATA = uid('meta');
- var id = 0;
- var setMetadata = function (it) {
- defineProperty(it, METADATA, { value: {
- objectID: 'O' + id++, // object ID
- weakData: {} // weak collections IDs
- } });
- };
- var fastKey = function (it, create) {
- // return a primitive with prefix
- if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!hasOwn(it, METADATA)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return 'F';
- // not necessary to add metadata
- if (!create) return 'E';
- // add missing metadata
- setMetadata(it);
- // return object ID
- } return it[METADATA].objectID;
- };
- var getWeakData = function (it, create) {
- if (!hasOwn(it, METADATA)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return true;
- // not necessary to add metadata
- if (!create) return false;
- // add missing metadata
- setMetadata(it);
- // return the store of weak collections IDs
- } return it[METADATA].weakData;
- };
- // add metadata on freeze-family methods calling
- var onFreeze = function (it) {
- if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
- return it;
- };
- var enable = function () {
- meta.enable = function () { /* empty */ };
- REQUIRED = true;
- var getOwnPropertyNames = getOwnPropertyNamesModule.f;
- var splice = uncurryThis([].splice);
- var test = {};
- test[METADATA] = 1;
- // prevent exposing of metadata key
- if (getOwnPropertyNames(test).length) {
- getOwnPropertyNamesModule.f = function (it) {
- var result = getOwnPropertyNames(it);
- for (var i = 0, length = result.length; i < length; i++) {
- if (result[i] === METADATA) {
- splice(result, i, 1);
- break;
- }
- } return result;
- };
- $({ target: 'Object', stat: true, forced: true }, {
- getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
- });
- }
- };
- var meta = module.exports = {
- enable: enable,
- fastKey: fastKey,
- getWeakData: getWeakData,
- onFreeze: onFreeze
- };
- hiddenKeys[METADATA] = true;
- /***/ }),
- /* 95 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var fails = __webpack_require__(2);
- var classof = __webpack_require__(63);
- var $Object = Object;
- var split = uncurryThis(''.split);
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- module.exports = fails(function () {
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
- // eslint-disable-next-line no-prototype-builtins -- safe
- return !$Object('z').propertyIsEnumerable(0);
- }) ? function (it) {
- return classof(it) == 'String' ? split(it, '') : $Object(it);
- } : $Object;
- /***/ }),
- /* 96 */
- /***/ (function(module, exports, __webpack_require__) {
- var toPrimitive = __webpack_require__(285);
- var isSymbol = __webpack_require__(97);
- // `ToPropertyKey` abstract operation
- // https://tc39.es/ecma262/#sec-topropertykey
- module.exports = function (argument) {
- var key = toPrimitive(argument, 'string');
- return isSymbol(key) ? key : key + '';
- };
- /***/ }),
- /* 97 */
- /***/ (function(module, exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(18);
- var isCallable = __webpack_require__(8);
- var isPrototypeOf = __webpack_require__(19);
- var USE_SYMBOL_AS_UID = __webpack_require__(157);
- var $Object = Object;
- module.exports = USE_SYMBOL_AS_UID ? function (it) {
- return typeof it == 'symbol';
- } : function (it) {
- var $Symbol = getBuiltIn('Symbol');
- return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
- };
- /***/ }),
- /* 98 */
- /***/ (function(module, exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(18);
- module.exports = getBuiltIn('navigator', 'userAgent') || '';
- /***/ }),
- /* 99 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var id = 0;
- var postfix = Math.random();
- var toString = uncurryThis(1.0.toString);
- module.exports = function (key) {
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
- };
- /***/ }),
- /* 100 */
- /***/ (function(module, exports, __webpack_require__) {
- var hasOwn = __webpack_require__(13);
- var isCallable = __webpack_require__(8);
- var toObject = __webpack_require__(34);
- var sharedKey = __webpack_require__(101);
- var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
- var IE_PROTO = sharedKey('IE_PROTO');
- var $Object = Object;
- var ObjectPrototype = $Object.prototype;
- // `Object.getPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.getprototypeof
- // eslint-disable-next-line es-x/no-object-getprototypeof -- safe
- module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
- var object = toObject(O);
- if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
- var constructor = object.constructor;
- if (isCallable(constructor) && object instanceof constructor) {
- return constructor.prototype;
- } return object instanceof $Object ? ObjectPrototype : null;
- };
- /***/ }),
- /* 101 */
- /***/ (function(module, exports, __webpack_require__) {
- var shared = __webpack_require__(79);
- var uid = __webpack_require__(99);
- var keys = shared('keys');
- module.exports = function (key) {
- return keys[key] || (keys[key] = uid(key));
- };
- /***/ }),
- /* 102 */
- /***/ (function(module, exports, __webpack_require__) {
- /* eslint-disable no-proto -- safe */
- var uncurryThis = __webpack_require__(4);
- var anObject = __webpack_require__(20);
- var aPossiblePrototype = __webpack_require__(288);
- // `Object.setPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.setprototypeof
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
- module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
- var CORRECT_SETTER = false;
- var test = {};
- var setter;
- try {
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
- setter(test, []);
- CORRECT_SETTER = test instanceof Array;
- } catch (error) { /* empty */ }
- return function setPrototypeOf(O, proto) {
- anObject(O);
- aPossiblePrototype(proto);
- if (CORRECT_SETTER) setter(O, proto);
- else O.__proto__ = proto;
- return O;
- };
- }() : undefined);
- /***/ }),
- /* 103 */
- /***/ (function(module, exports, __webpack_require__) {
- var internalObjectKeys = __webpack_require__(163);
- var enumBugKeys = __webpack_require__(127);
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
- exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return internalObjectKeys(O, hiddenKeys);
- };
- /***/ }),
- /* 104 */
- /***/ (function(module, exports) {
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
- exports.f = Object.getOwnPropertySymbols;
- /***/ }),
- /* 105 */
- /***/ (function(module, exports, __webpack_require__) {
- var internalObjectKeys = __webpack_require__(163);
- var enumBugKeys = __webpack_require__(127);
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- // eslint-disable-next-line es-x/no-object-keys -- safe
- module.exports = Object.keys || function keys(O) {
- return internalObjectKeys(O, enumBugKeys);
- };
- /***/ }),
- /* 106 */
- /***/ (function(module, exports, __webpack_require__) {
- var classof = __webpack_require__(51);
- var getMethod = __webpack_require__(122);
- var Iterators = __webpack_require__(50);
- var wellKnownSymbol = __webpack_require__(9);
- var ITERATOR = wellKnownSymbol('iterator');
- module.exports = function (it) {
- if (it != undefined) return getMethod(it, ITERATOR)
- || getMethod(it, '@@iterator')
- || Iterators[classof(it)];
- };
- /***/ }),
- /* 107 */
- /***/ (function(module, exports, __webpack_require__) {
- var classof = __webpack_require__(63);
- var global = __webpack_require__(7);
- module.exports = classof(global.process) == 'process';
- /***/ }),
- /* 108 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var $TypeError = TypeError;
- module.exports = function (it, Prototype) {
- if (isPrototypeOf(Prototype, it)) return it;
- throw $TypeError('Incorrect invocation');
- };
- /***/ }),
- /* 109 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var fails = __webpack_require__(2);
- var isCallable = __webpack_require__(8);
- var classof = __webpack_require__(51);
- var getBuiltIn = __webpack_require__(18);
- var inspectSource = __webpack_require__(130);
- var noop = function () { /* empty */ };
- var empty = [];
- var construct = getBuiltIn('Reflect', 'construct');
- var constructorRegExp = /^\s*(?:class|function)\b/;
- var exec = uncurryThis(constructorRegExp.exec);
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
- var isConstructorModern = function isConstructor(argument) {
- if (!isCallable(argument)) return false;
- try {
- construct(noop, empty, argument);
- return true;
- } catch (error) {
- return false;
- }
- };
- var isConstructorLegacy = function isConstructor(argument) {
- if (!isCallable(argument)) return false;
- switch (classof(argument)) {
- case 'AsyncFunction':
- case 'GeneratorFunction':
- case 'AsyncGeneratorFunction': return false;
- }
- try {
- // we can't check .prototype since constructors produced by .bind haven't it
- // `Function#toString` throws on some built-it function in some legacy engines
- // (for example, `DOMQuad` and similar in FF41-)
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
- } catch (error) {
- return true;
- }
- };
- isConstructorLegacy.sham = true;
- // `IsConstructor` abstract operation
- // https://tc39.es/ecma262/#sec-isconstructor
- module.exports = !construct || fails(function () {
- var called;
- return isConstructorModern(isConstructorModern.call)
- || !isConstructorModern(Object)
- || !isConstructorModern(function () { called = true; })
- || called;
- }) ? isConstructorLegacy : isConstructorModern;
- /***/ }),
- /* 110 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- module.exports = uncurryThis([].slice);
- /***/ }),
- /* 111 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(139);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(191);
- // Returns a predicate for checking whether an object has a given set of
- // `key:value` pairs.
- function matcher(attrs) {
- attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
- return function(obj) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
- };
- }
- /***/ }),
- /* 112 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(207);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
- // Partially apply a function by creating a version that has had some of its
- // arguments pre-filled, without changing its dynamic `this` context. `_` acts
- // as a placeholder by default, allowing any combination of arguments to be
- // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
- var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
- var placeholder = partial.placeholder;
- var bound = function() {
- var position = 0, length = boundArgs.length;
- var args = Array(length);
- for (var i = 0; i < length; i++) {
- args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
- }
- while (position < arguments.length) args.push(arguments[position++]);
- return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
- };
- return bound;
- });
- partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
- /* harmony default export */ __webpack_exports__["a"] = (partial);
- /***/ }),
- /* 113 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = group;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
- // An internal function used for aggregate "group by" operations.
- function group(behavior, partition) {
- return function(obj, iteratee, context) {
- var result = partition ? [[], []] : {};
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
- Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
- var key = iteratee(value, index, obj);
- behavior(result, value, key);
- });
- return result;
- };
- }
- /***/ }),
- /* 114 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- var wellKnownSymbol = __webpack_require__(9);
- var V8_VERSION = __webpack_require__(77);
- var SPECIES = wellKnownSymbol('species');
- module.exports = function (METHOD_NAME) {
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/677
- return V8_VERSION >= 51 || !fails(function () {
- var array = [];
- var constructor = array.constructor = {};
- constructor[SPECIES] = function () {
- return { foo: 1 };
- };
- return array[METHOD_NAME](Boolean).foo !== 1;
- });
- };
- /***/ }),
- /* 115 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(399);
- /***/ }),
- /* 116 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _typeof2 = _interopRequireDefault(__webpack_require__(73));
- var _filter = _interopRequireDefault(__webpack_require__(250));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _keys = _interopRequireDefault(__webpack_require__(115));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _ = __webpack_require__(3);
- var _require = __webpack_require__(251),
- timeout = _require.timeout;
- var debug = __webpack_require__(60);
- var debugRequest = debug('leancloud:request');
- var debugRequestError = debug('leancloud:request:error');
- var _require2 = __webpack_require__(72),
- getAdapter = _require2.getAdapter;
- var requestsCount = 0;
- var ajax = function ajax(_ref) {
- var method = _ref.method,
- url = _ref.url,
- query = _ref.query,
- data = _ref.data,
- _ref$headers = _ref.headers,
- headers = _ref$headers === void 0 ? {} : _ref$headers,
- time = _ref.timeout,
- onprogress = _ref.onprogress;
- if (query) {
- var _context, _context2, _context4;
- var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
- var _context3;
- var value = query[key];
- if (value === undefined) return undefined;
- var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
- return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
- })).call(_context, function (qs) {
- return qs;
- }).join('&');
- url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
- }
- var count = requestsCount++;
- debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
- var request = getAdapter('request');
- var promise = request(url, {
- method: method,
- headers: headers,
- data: data,
- onprogress: onprogress
- }).then(function (response) {
- debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
- if (response.ok === false) {
- var error = new Error();
- error.response = response;
- throw error;
- }
- return response.data;
- }).catch(function (error) {
- if (error.response) {
- if (!debug.enabled('leancloud:request')) {
- debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
- }
- debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
- error.statusCode = error.response.status;
- error.responseText = error.response.text;
- error.response = error.response.data;
- }
- throw error;
- });
- return time ? timeout(promise, time) : promise;
- };
- module.exports = ajax;
- /***/ }),
- /* 117 */
- /***/ (function(module, exports) {
- /* (ignored) */
- /***/ }),
- /* 118 */
- /***/ (function(module, exports, __webpack_require__) {
- var Symbol = __webpack_require__(270),
- getRawTag = __webpack_require__(640),
- objectToString = __webpack_require__(641);
- /** `Object#toString` result references. */
- var nullTag = '[object Null]',
- undefinedTag = '[object Undefined]';
- /** Built-in value references. */
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
- /**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag && symToStringTag in Object(value))
- ? getRawTag(value)
- : objectToString(value);
- }
- module.exports = baseGetTag;
- /***/ }),
- /* 119 */
- /***/ (function(module, exports) {
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return value != null && typeof value == 'object';
- }
- module.exports = isObjectLike;
- /***/ }),
- /* 120 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Nashorn ~ JDK8 bug
- var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
- // `Object.prototype.propertyIsEnumerable` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
- exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor(this, V);
- return !!descriptor && descriptor.enumerable;
- } : $propertyIsEnumerable;
- /***/ }),
- /* 121 */
- /***/ (function(module, exports) {
- var $TypeError = TypeError;
- // `RequireObjectCoercible` abstract operation
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
- module.exports = function (it) {
- if (it == undefined) throw $TypeError("Can't call method on " + it);
- return it;
- };
- /***/ }),
- /* 122 */
- /***/ (function(module, exports, __webpack_require__) {
- var aCallable = __webpack_require__(31);
- // `GetMethod` abstract operation
- // https://tc39.es/ecma262/#sec-getmethod
- module.exports = function (V, P) {
- var func = V[P];
- return func == null ? undefined : aCallable(func);
- };
- /***/ }),
- /* 123 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var defineGlobalProperty = __webpack_require__(287);
- var SHARED = '__core-js_shared__';
- var store = global[SHARED] || defineGlobalProperty(SHARED, {});
- module.exports = store;
- /***/ }),
- /* 124 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var isObject = __webpack_require__(11);
- var document = global.document;
- // typeof document.createElement is 'object' in old IE
- var EXISTS = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return EXISTS ? document.createElement(it) : {};
- };
- /***/ }),
- /* 125 */
- /***/ (function(module, exports, __webpack_require__) {
- var toIntegerOrInfinity = __webpack_require__(126);
- var max = Math.max;
- var min = Math.min;
- // Helper for a popular repeating case of the spec:
- // Let integer be ? ToInteger(index).
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
- module.exports = function (index, length) {
- var integer = toIntegerOrInfinity(index);
- return integer < 0 ? max(integer + length, 0) : min(integer, length);
- };
- /***/ }),
- /* 126 */
- /***/ (function(module, exports, __webpack_require__) {
- var trunc = __webpack_require__(290);
- // `ToIntegerOrInfinity` abstract operation
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
- module.exports = function (argument) {
- var number = +argument;
- // eslint-disable-next-line no-self-compare -- NaN check
- return number !== number || number === 0 ? 0 : trunc(number);
- };
- /***/ }),
- /* 127 */
- /***/ (function(module, exports) {
- // IE8- don't enum bug keys
- module.exports = [
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'toLocaleString',
- 'toString',
- 'valueOf'
- ];
- /***/ }),
- /* 128 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
- var definePropertyModule = __webpack_require__(23);
- var anObject = __webpack_require__(20);
- var toIndexedObject = __webpack_require__(32);
- var objectKeys = __webpack_require__(105);
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- // eslint-disable-next-line es-x/no-object-defineproperties -- safe
- exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var props = toIndexedObject(Properties);
- var keys = objectKeys(Properties);
- var length = keys.length;
- var index = 0;
- var key;
- while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
- return O;
- };
- /***/ }),
- /* 129 */
- /***/ (function(module, exports, __webpack_require__) {
- var wellKnownSymbol = __webpack_require__(9);
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var test = {};
- test[TO_STRING_TAG] = 'z';
- module.exports = String(test) === '[object z]';
- /***/ }),
- /* 130 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var isCallable = __webpack_require__(8);
- var store = __webpack_require__(123);
- var functionToString = uncurryThis(Function.toString);
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
- if (!isCallable(store.inspectSource)) {
- store.inspectSource = function (it) {
- return functionToString(it);
- };
- }
- module.exports = store.inspectSource;
- /***/ }),
- /* 131 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var call = __webpack_require__(15);
- var IS_PURE = __webpack_require__(33);
- var FunctionName = __webpack_require__(296);
- var isCallable = __webpack_require__(8);
- var createIteratorConstructor = __webpack_require__(297);
- var getPrototypeOf = __webpack_require__(100);
- var setPrototypeOf = __webpack_require__(102);
- var setToStringTag = __webpack_require__(52);
- var createNonEnumerableProperty = __webpack_require__(37);
- var defineBuiltIn = __webpack_require__(44);
- var wellKnownSymbol = __webpack_require__(9);
- var Iterators = __webpack_require__(50);
- var IteratorsCore = __webpack_require__(171);
- var PROPER_FUNCTION_NAME = FunctionName.PROPER;
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
- var ITERATOR = wellKnownSymbol('iterator');
- var KEYS = 'keys';
- var VALUES = 'values';
- var ENTRIES = 'entries';
- var returnThis = function () { return this; };
- module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
- createIteratorConstructor(IteratorConstructor, NAME, next);
- var getIterationMethod = function (KIND) {
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
- if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
- switch (KIND) {
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
- } return function () { return new IteratorConstructor(this); };
- };
- var TO_STRING_TAG = NAME + ' Iterator';
- var INCORRECT_VALUES_NAME = false;
- var IterablePrototype = Iterable.prototype;
- var nativeIterator = IterablePrototype[ITERATOR]
- || IterablePrototype['@@iterator']
- || DEFAULT && IterablePrototype[DEFAULT];
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
- var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
- var CurrentIteratorPrototype, methods, KEY;
- // fix native
- if (anyNativeIterator) {
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
- if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
- if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
- if (setPrototypeOf) {
- setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
- } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
- defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
- }
- }
- // Set @@toStringTag to native iterators
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
- if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
- }
- }
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
- if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
- if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
- createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
- } else {
- INCORRECT_VALUES_NAME = true;
- defaultIterator = function values() { return call(nativeIterator, this); };
- }
- }
- // export additional methods
- if (DEFAULT) {
- methods = {
- values: getIterationMethod(VALUES),
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
- entries: getIterationMethod(ENTRIES)
- };
- if (FORCED) for (KEY in methods) {
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
- defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
- }
- } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
- }
- // define iterator
- if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
- defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
- }
- Iterators[NAME] = defaultIterator;
- return methods;
- };
- /***/ }),
- /* 132 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(319);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(180);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(181);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(320);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(133);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(182);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(321);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(322);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(323);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(183);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(184);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(134);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(57);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(28);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(135);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(325);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(185);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(186);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(327);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(191);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(328);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(330);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(331);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(332);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(333);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(16);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(85);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(66);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(334);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(192);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(193);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(194);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(139);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(195);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(335);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(197);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(336);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(198);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(337);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(338);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(141);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(187);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(202);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(199);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(142);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(339);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(111);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(340);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(203);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(143);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(341);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(342);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(206);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(344);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(345);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(346);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(347);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(201);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(112);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(208);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(348);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(349);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(209);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(350);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(351);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(352);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(353);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(144);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(354);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(355);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(210);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(356);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(211);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(145);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(213);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(214);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(215);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(357);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(217);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(358);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(58);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(68);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(359);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(360);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(88);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(361);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(362);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(363);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(89);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(364);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(146);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(365);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(219);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(366);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(367);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(220);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(368);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(369);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(370);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(371);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(372);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(373);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(374);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(221);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(376);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(377);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(222);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(378);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(223);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(379);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(380);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(381);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(225);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(382);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(383);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(224);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(226);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(384);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(385);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(386);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(387);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(388);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(389);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
- // Named Exports
- // =============
- // Underscore.js 1.12.1
- // https://underscorejs.org
- // (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- // Underscore may be freely distributed under the MIT license.
- // Baseline setup.
- // Object Functions
- // ----------------
- // Our most fundamental functions operate on any JavaScript object.
- // Most functions in Underscore depend on at least one function in this section.
- // A group of functions that check the types of core JavaScript values.
- // These are often informally referred to as the "isType" functions.
- // Functions that treat an object as a dictionary of key-value pairs.
- // Utility Functions
- // -----------------
- // A bit of a grab bag: Predicate-generating functions for use with filters and
- // loops, string escaping and templating, create random numbers and unique ids,
- // and functions that facilitate Underscore's chaining and iteration conventions.
- // Function (ahem) Functions
- // -------------------------
- // These functions take a function as an argument and return a new function
- // as the result. Also known as higher-order functions.
- // Finders
- // -------
- // Functions that extract (the position of) a single element from an object
- // or array based on some criterion.
- // Collection Functions
- // --------------------
- // Functions that work on any collection of elements: either an array, or
- // an object of key-value pairs.
- // `_.pick` and `_.omit` are actually object functions, but we put
- // them here in order to create a more natural reading order in the
- // monolithic build as they depend on `_.contains`.
- // Array Functions
- // ---------------
- // Functions that operate on arrays (and array-likes) only, because they’re
- // expressed in terms of operations on an ordered list of values.
- // OOP
- // ---
- // These modules support the "object-oriented" calling style. See also
- // `underscore.js` and `index-default.js`.
- /***/ }),
- /* 133 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
- /***/ }),
- /* 134 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(184);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(84);
- var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
- // In IE 10 - Edge 13, we need a different heuristic
- // to determine whether an object is a `DataView`.
- function ie10IsDataView(obj) {
- return obj != null && Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj.getInt8) && Object(__WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__["a" /* default */])(obj.buffer);
- }
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
- /***/ }),
- /* 135 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
- var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
- // Define a fallback version of the method in browsers (ahem, IE < 9), where
- // there isn't any inspectable "Arguments" type.
- (function() {
- if (!isArguments(arguments)) {
- isArguments = function(obj) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
- };
- }
- }());
- /* harmony default export */ __webpack_exports__["a"] = (isArguments);
- /***/ }),
- /* 136 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
- // Internal helper to obtain the `byteLength` property of an object.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
- /***/ }),
- /* 137 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(85);
- // Since the regular `Object.prototype.toString` type tests don't work for
- // some types in IE 11, we use a fingerprinting heuristic instead, based
- // on the methods. It's not great, but it's the best we got.
- // The fingerprint method lists are defined below.
- function ie11fingerprint(methods) {
- var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
- return function(obj) {
- if (obj == null) return false;
- // `Map`, `WeakMap` and `Set` have no enumerable keys.
- var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
- if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
- for (var i = 0; i < length; i++) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
- }
- // If we are testing against `WeakMap`, we need to ensure that
- // `obj` doesn't have a `forEach` method in order to distinguish
- // it from a regular `Map`.
- return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
- };
- }
- // In the interest of compact minification, we write
- // each string in the fingerprints only once.
- var forEachName = 'forEach',
- hasName = 'has',
- commonInit = ['clear', 'delete'],
- mapTail = ['get', hasName, 'set'];
- // `Map`, `WeakMap` and `Set` each have slightly different
- // combinations of the above sublists.
- var mapMethods = commonInit.concat(forEachName, mapTail),
- weakMapMethods = commonInit.concat(mapTail),
- setMethods = ['add'].concat(commonInit, forEachName, hasName);
- /***/ }),
- /* 138 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
- // An internal function for creating assigner functions.
- function createAssigner(keysFunc, defaults) {
- return function(obj) {
- var length = arguments.length;
- if (defaults) obj = Object(obj);
- if (length < 2 || obj == null) return obj;
- for (var index = 1; index < length; index++) {
- var source = arguments[index],
- keys = keysFunc(source),
- l = keys.length;
- for (var i = 0; i < l; i++) {
- var key = keys[i];
- if (!defaults || obj[key] === void 0) obj[key] = source[key];
- }
- }
- return obj;
- };
- }
- /***/ }),
- /* 139 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
- // Assigns a given object with all the own properties in the passed-in
- // object(s).
- // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
- /***/ }),
- /* 140 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
- // Internal function to obtain a nested property in `obj` along `path`.
- function deepGet(obj, path) {
- var length = path.length;
- for (var i = 0; i < length; i++) {
- if (obj == null) return void 0;
- obj = obj[path[i]];
- }
- return length ? obj : void 0;
- }
- /***/ }),
- /* 141 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = identity;
- // Keep the identity function around for default iteratees.
- function identity(value) {
- return value;
- }
- /***/ }),
- /* 142 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = property;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(140);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
- // Creates a function that, when passed an object, will traverse that object’s
- // properties down the given `path`, specified as an array of keys or indices.
- function property(path) {
- path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
- return function(obj) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
- };
- }
- /***/ }),
- /* 143 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // A (possibly faster) way to get the current timestamp as an integer.
- /* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
- return new Date().getTime();
- });
- /***/ }),
- /* 144 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = negate;
- // Returns a negated version of the passed-in predicate.
- function negate(predicate) {
- return function() {
- return !predicate.apply(this, arguments);
- };
- }
- /***/ }),
- /* 145 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
- // Returns the first index on an array-like that passes a truth test.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
- /***/ }),
- /* 146 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(68);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(142);
- // Convenience version of a common use case of `_.map`: fetching a property.
- function pluck(obj, key) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
- }
- /***/ }),
- /* 147 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(233);
- /***/ }),
- /* 148 */
- /***/ (function(module, exports, __webpack_require__) {
- var wellKnownSymbol = __webpack_require__(9);
- exports.f = wellKnownSymbol;
- /***/ }),
- /* 149 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(243);
- /***/ }),
- /* 150 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(501);
- /***/ }),
- /* 151 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(552);
- /***/ }),
- /* 152 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(570);
- /***/ }),
- /* 153 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(574);
- /***/ }),
- /* 154 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineBuiltIn = __webpack_require__(44);
- module.exports = function (target, src, options) {
- for (var key in src) {
- if (options && options.unsafe && target[key]) target[key] = src[key];
- else defineBuiltIn(target, key, src[key], options);
- } return target;
- };
- /***/ }),
- /* 155 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var global = __webpack_require__(7);
- var InternalMetadataModule = __webpack_require__(94);
- var fails = __webpack_require__(2);
- var createNonEnumerableProperty = __webpack_require__(37);
- var iterate = __webpack_require__(42);
- var anInstance = __webpack_require__(108);
- var isCallable = __webpack_require__(8);
- var isObject = __webpack_require__(11);
- var setToStringTag = __webpack_require__(52);
- var defineProperty = __webpack_require__(23).f;
- var forEach = __webpack_require__(70).forEach;
- var DESCRIPTORS = __webpack_require__(14);
- var InternalStateModule = __webpack_require__(43);
- var setInternalState = InternalStateModule.set;
- var internalStateGetterFor = InternalStateModule.getterFor;
- module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
- var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
- var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
- var ADDER = IS_MAP ? 'set' : 'add';
- var NativeConstructor = global[CONSTRUCTOR_NAME];
- var NativePrototype = NativeConstructor && NativeConstructor.prototype;
- var exported = {};
- var Constructor;
- if (!DESCRIPTORS || !isCallable(NativeConstructor)
- || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
- ) {
- // create collection constructor
- Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
- InternalMetadataModule.enable();
- } else {
- Constructor = wrapper(function (target, iterable) {
- setInternalState(anInstance(target, Prototype), {
- type: CONSTRUCTOR_NAME,
- collection: new NativeConstructor()
- });
- if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
- });
- var Prototype = Constructor.prototype;
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
- var IS_ADDER = KEY == 'add' || KEY == 'set';
- if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
- createNonEnumerableProperty(Prototype, KEY, function (a, b) {
- var collection = getInternalState(this).collection;
- if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
- var result = collection[KEY](a === 0 ? 0 : a, b);
- return IS_ADDER ? this : result;
- });
- }
- });
- IS_WEAK || defineProperty(Prototype, 'size', {
- configurable: true,
- get: function () {
- return getInternalState(this).collection.size;
- }
- });
- }
- setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
- exported[CONSTRUCTOR_NAME] = Constructor;
- $({ global: true, forced: true }, exported);
- if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
- return Constructor;
- };
- /***/ }),
- /* 156 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = __webpack_require__(589);
- /***/ }),
- /* 157 */
- /***/ (function(module, exports, __webpack_require__) {
- /* eslint-disable es-x/no-symbol -- required for testing */
- var NATIVE_SYMBOL = __webpack_require__(64);
- module.exports = NATIVE_SYMBOL
- && !Symbol.sham
- && typeof Symbol.iterator == 'symbol';
- /***/ }),
- /* 158 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var fails = __webpack_require__(2);
- var createElement = __webpack_require__(124);
- // Thanks to IE8 for its funny defineProperty
- module.exports = !DESCRIPTORS && !fails(function () {
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- return Object.defineProperty(createElement('div'), 'a', {
- get: function () { return 7; }
- }).a != 7;
- });
- /***/ }),
- /* 159 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- var isCallable = __webpack_require__(8);
- var replacement = /#|\.prototype\./;
- var isForced = function (feature, detection) {
- var value = data[normalize(feature)];
- return value == POLYFILL ? true
- : value == NATIVE ? false
- : isCallable(detection) ? fails(detection)
- : !!detection;
- };
- var normalize = isForced.normalize = function (string) {
- return String(string).replace(replacement, '.').toLowerCase();
- };
- var data = isForced.data = {};
- var NATIVE = isForced.NATIVE = 'N';
- var POLYFILL = isForced.POLYFILL = 'P';
- module.exports = isForced;
- /***/ }),
- /* 160 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var fails = __webpack_require__(2);
- // V8 ~ Chrome 36-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
- module.exports = DESCRIPTORS && fails(function () {
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
- value: 42,
- writable: false
- }).prototype != 42;
- });
- /***/ }),
- /* 161 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- module.exports = !fails(function () {
- function F() { /* empty */ }
- F.prototype.constructor = null;
- // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
- return Object.getPrototypeOf(new F()) !== F.prototype;
- });
- /***/ }),
- /* 162 */
- /***/ (function(module, exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(18);
- var uncurryThis = __webpack_require__(4);
- var getOwnPropertyNamesModule = __webpack_require__(103);
- var getOwnPropertySymbolsModule = __webpack_require__(104);
- var anObject = __webpack_require__(20);
- var concat = uncurryThis([].concat);
- // all object keys, includes non-enumerable and symbols
- module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
- var keys = getOwnPropertyNamesModule.f(anObject(it));
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
- };
- /***/ }),
- /* 163 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var hasOwn = __webpack_require__(13);
- var toIndexedObject = __webpack_require__(32);
- var indexOf = __webpack_require__(164).indexOf;
- var hiddenKeys = __webpack_require__(80);
- var push = uncurryThis([].push);
- module.exports = function (object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (hasOwn(O, key = names[i++])) {
- ~indexOf(result, key) || push(result, key);
- }
- return result;
- };
- /***/ }),
- /* 164 */
- /***/ (function(module, exports, __webpack_require__) {
- var toIndexedObject = __webpack_require__(32);
- var toAbsoluteIndex = __webpack_require__(125);
- var lengthOfArrayLike = __webpack_require__(41);
- // `Array.prototype.{ indexOf, includes }` methods implementation
- var createMethod = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = lengthOfArrayLike(O);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare -- NaN check
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare -- NaN check
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- module.exports = {
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- includes: createMethod(true),
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- indexOf: createMethod(false)
- };
- /***/ }),
- /* 165 */
- /***/ (function(module, exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(18);
- module.exports = getBuiltIn('document', 'documentElement');
- /***/ }),
- /* 166 */
- /***/ (function(module, exports, __webpack_require__) {
- var wellKnownSymbol = __webpack_require__(9);
- var Iterators = __webpack_require__(50);
- var ITERATOR = wellKnownSymbol('iterator');
- var ArrayPrototype = Array.prototype;
- // check on default Array iterator
- module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
- };
- /***/ }),
- /* 167 */
- /***/ (function(module, exports, __webpack_require__) {
- var call = __webpack_require__(15);
- var aCallable = __webpack_require__(31);
- var anObject = __webpack_require__(20);
- var tryToString = __webpack_require__(78);
- var getIteratorMethod = __webpack_require__(106);
- var $TypeError = TypeError;
- module.exports = function (argument, usingIterator) {
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
- if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
- throw $TypeError(tryToString(argument) + ' is not iterable');
- };
- /***/ }),
- /* 168 */
- /***/ (function(module, exports, __webpack_require__) {
- var call = __webpack_require__(15);
- var anObject = __webpack_require__(20);
- var getMethod = __webpack_require__(122);
- module.exports = function (iterator, kind, value) {
- var innerResult, innerError;
- anObject(iterator);
- try {
- innerResult = getMethod(iterator, 'return');
- if (!innerResult) {
- if (kind === 'throw') throw value;
- return value;
- }
- innerResult = call(innerResult, iterator);
- } catch (error) {
- innerError = true;
- innerResult = error;
- }
- if (kind === 'throw') throw value;
- if (innerError) throw innerResult;
- anObject(innerResult);
- return value;
- };
- /***/ }),
- /* 169 */
- /***/ (function(module, exports) {
- module.exports = function () { /* empty */ };
- /***/ }),
- /* 170 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var isCallable = __webpack_require__(8);
- var inspectSource = __webpack_require__(130);
- var WeakMap = global.WeakMap;
- module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
- /***/ }),
- /* 171 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var fails = __webpack_require__(2);
- var isCallable = __webpack_require__(8);
- var create = __webpack_require__(49);
- var getPrototypeOf = __webpack_require__(100);
- var defineBuiltIn = __webpack_require__(44);
- var wellKnownSymbol = __webpack_require__(9);
- var IS_PURE = __webpack_require__(33);
- var ITERATOR = wellKnownSymbol('iterator');
- var BUGGY_SAFARI_ITERATORS = false;
- // `%IteratorPrototype%` object
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
- var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
- /* eslint-disable es-x/no-array-prototype-keys -- safe */
- if ([].keys) {
- arrayIterator = [].keys();
- // Safari 8 has buggy iterators w/o `next`
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
- else {
- PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
- }
- }
- var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
- var test = {};
- // FF44- legacy iterators case
- return IteratorPrototype[ITERATOR].call(test) !== test;
- });
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
- else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
- // `%IteratorPrototype%[@@iterator]()` method
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
- if (!isCallable(IteratorPrototype[ITERATOR])) {
- defineBuiltIn(IteratorPrototype, ITERATOR, function () {
- return this;
- });
- }
- module.exports = {
- IteratorPrototype: IteratorPrototype,
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
- };
- /***/ }),
- /* 172 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var getBuiltIn = __webpack_require__(18);
- var definePropertyModule = __webpack_require__(23);
- var wellKnownSymbol = __webpack_require__(9);
- var DESCRIPTORS = __webpack_require__(14);
- var SPECIES = wellKnownSymbol('species');
- module.exports = function (CONSTRUCTOR_NAME) {
- var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
- var defineProperty = definePropertyModule.f;
- if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
- defineProperty(Constructor, SPECIES, {
- configurable: true,
- get: function () { return this; }
- });
- }
- };
- /***/ }),
- /* 173 */
- /***/ (function(module, exports, __webpack_require__) {
- var anObject = __webpack_require__(20);
- var aConstructor = __webpack_require__(174);
- var wellKnownSymbol = __webpack_require__(9);
- var SPECIES = wellKnownSymbol('species');
- // `SpeciesConstructor` abstract operation
- // https://tc39.es/ecma262/#sec-speciesconstructor
- module.exports = function (O, defaultConstructor) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
- };
- /***/ }),
- /* 174 */
- /***/ (function(module, exports, __webpack_require__) {
- var isConstructor = __webpack_require__(109);
- var tryToString = __webpack_require__(78);
- var $TypeError = TypeError;
- // `Assert: IsConstructor(argument) is true`
- module.exports = function (argument) {
- if (isConstructor(argument)) return argument;
- throw $TypeError(tryToString(argument) + ' is not a constructor');
- };
- /***/ }),
- /* 175 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var apply = __webpack_require__(75);
- var bind = __webpack_require__(48);
- var isCallable = __webpack_require__(8);
- var hasOwn = __webpack_require__(13);
- var fails = __webpack_require__(2);
- var html = __webpack_require__(165);
- var arraySlice = __webpack_require__(110);
- var createElement = __webpack_require__(124);
- var validateArgumentsLength = __webpack_require__(301);
- var IS_IOS = __webpack_require__(176);
- var IS_NODE = __webpack_require__(107);
- var set = global.setImmediate;
- var clear = global.clearImmediate;
- var process = global.process;
- var Dispatch = global.Dispatch;
- var Function = global.Function;
- var MessageChannel = global.MessageChannel;
- var String = global.String;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var location, defer, channel, port;
- try {
- // Deno throws a ReferenceError on `location` access without `--location` flag
- location = global.location;
- } catch (error) { /* empty */ }
- var run = function (id) {
- if (hasOwn(queue, id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var runner = function (id) {
- return function () {
- run(id);
- };
- };
- var listener = function (event) {
- run(event.data);
- };
- var post = function (id) {
- // old engines have not location.origin
- global.postMessage(String(id), location.protocol + '//' + location.host);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!set || !clear) {
- set = function setImmediate(handler) {
- validateArgumentsLength(arguments.length, 1);
- var fn = isCallable(handler) ? handler : Function(handler);
- var args = arraySlice(arguments, 1);
- queue[++counter] = function () {
- apply(fn, undefined, args);
- };
- defer(counter);
- return counter;
- };
- clear = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (IS_NODE) {
- defer = function (id) {
- process.nextTick(runner(id));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(runner(id));
- };
- // Browsers with MessageChannel, includes WebWorkers
- // except iOS - https://github.com/zloirock/core-js/issues/624
- } else if (MessageChannel && !IS_IOS) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = bind(port.postMessage, port);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (
- global.addEventListener &&
- isCallable(global.postMessage) &&
- !global.importScripts &&
- location && location.protocol !== 'file:' &&
- !fails(post)
- ) {
- defer = post;
- global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in createElement('script')) {
- defer = function (id) {
- html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(runner(id), 0);
- };
- }
- }
- module.exports = {
- set: set,
- clear: clear
- };
- /***/ }),
- /* 176 */
- /***/ (function(module, exports, __webpack_require__) {
- var userAgent = __webpack_require__(98);
- module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
- /***/ }),
- /* 177 */
- /***/ (function(module, exports, __webpack_require__) {
- var NativePromiseConstructor = __webpack_require__(65);
- var checkCorrectnessOfIteration = __webpack_require__(178);
- var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
- module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
- NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
- });
- /***/ }),
- /* 178 */
- /***/ (function(module, exports, __webpack_require__) {
- var wellKnownSymbol = __webpack_require__(9);
- var ITERATOR = wellKnownSymbol('iterator');
- var SAFE_CLOSING = false;
- try {
- var called = 0;
- var iteratorWithReturn = {
- next: function () {
- return { done: !!called++ };
- },
- 'return': function () {
- SAFE_CLOSING = true;
- }
- };
- iteratorWithReturn[ITERATOR] = function () {
- return this;
- };
- // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
- Array.from(iteratorWithReturn, function () { throw 2; });
- } catch (error) { /* empty */ }
- module.exports = function (exec, SKIP_CLOSING) {
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
- var ITERATION_SUPPORT = false;
- try {
- var object = {};
- object[ITERATOR] = function () {
- return {
- next: function () {
- return { done: ITERATION_SUPPORT = true };
- }
- };
- };
- exec(object);
- } catch (error) { /* empty */ }
- return ITERATION_SUPPORT;
- };
- /***/ }),
- /* 179 */
- /***/ (function(module, exports, __webpack_require__) {
- var anObject = __webpack_require__(20);
- var isObject = __webpack_require__(11);
- var newPromiseCapability = __webpack_require__(54);
- module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- /***/ }),
- /* 180 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
- // Is a given variable undefined?
- function isUndefined(obj) {
- return obj === void 0;
- }
- /***/ }),
- /* 181 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Is a given value a boolean?
- function isBoolean(obj) {
- return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
- }
- /***/ }),
- /* 182 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
- /***/ }),
- /* 183 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
- /***/ }),
- /* 184 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
- /***/ }),
- /* 185 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(182);
- // Is the given value `NaN`?
- function isNaN(obj) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
- }
- /***/ }),
- /* 186 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(134);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(187);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(326);
- // Is a given value a typed array?
- var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
- function isTypedArray(obj) {
- // `ArrayBuffer.isView` is the most future-proof, so use it when available.
- // Otherwise, fall back on the above regular expression.
- return __WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */] ? (Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */])(obj) && !Object(__WEBPACK_IMPORTED_MODULE_1__isDataView_js__["a" /* default */])(obj)) :
- Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
- }
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["r" /* supportsArrayBuffer */] ? isTypedArray : Object(__WEBPACK_IMPORTED_MODULE_2__constant_js__["a" /* default */])(false));
- /***/ }),
- /* 187 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = constant;
- // Predicate-generating function. Often useful outside of Underscore.
- function constant(value) {
- return function() {
- return value;
- };
- }
- /***/ }),
- /* 188 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Common internal logic for `isArrayLike` and `isBufferLike`.
- function createSizePropertyCheck(getSizeProperty) {
- return function(collection) {
- var sizeProperty = getSizeProperty(collection);
- return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
- }
- }
- /***/ }),
- /* 189 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
- // Internal helper to generate a function to obtain property `key` from `obj`.
- function shallowProperty(key) {
- return function(obj) {
- return obj == null ? void 0 : obj[key];
- };
- }
- /***/ }),
- /* 190 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
- // Internal helper to create a simple lookup structure.
- // `collectNonEnumProps` used to depend on `_.contains`, but this led to
- // circular imports. `emulatedSet` is a one-off solution that only works for
- // arrays of strings.
- function emulatedSet(keys) {
- var hash = {};
- for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
- return {
- contains: function(key) { return hash[key]; },
- push: function(key) {
- hash[key] = true;
- return keys.push(key);
- }
- };
- }
- // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
- // be iterated by `for key in ...` and thus missed. Extends `keys` in place if
- // needed.
- function collectNonEnumProps(obj, keys) {
- keys = emulatedSet(keys);
- var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
- var constructor = obj.constructor;
- var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
- // Constructor is a special case.
- var prop = 'constructor';
- if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
- while (nonEnumIdx--) {
- prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
- if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
- keys.push(prop);
- }
- }
- }
- /***/ }),
- /* 191 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
- // Returns whether an object has a given set of `key:value` pairs.
- function isMatch(object, attrs) {
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
- if (object == null) return !length;
- var obj = Object(object);
- for (var i = 0; i < length; i++) {
- var key = _keys[i];
- if (attrs[key] !== obj[key] || !(key in obj)) return false;
- }
- return true;
- }
- /***/ }),
- /* 192 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = invert;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
- // Invert the keys and values of an object. The values must be serializable.
- function invert(obj) {
- var result = {};
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
- for (var i = 0, length = _keys.length; i < length; i++) {
- result[obj[_keys[i]]] = _keys[i];
- }
- return result;
- }
- /***/ }),
- /* 193 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = functions;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
- // Return a sorted list of the function names available on the object.
- function functions(obj) {
- var names = [];
- for (var key in obj) {
- if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
- }
- return names.sort();
- }
- /***/ }),
- /* 194 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
- // Extend a given object with all the properties in passed-in object(s).
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
- /***/ }),
- /* 195 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
- // Fill in a given object with default properties.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
- /***/ }),
- /* 196 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- // Create a naked function reference for surrogate-prototype-swapping.
- function ctor() {
- return function(){};
- }
- // An internal function for creating a new object that inherits from another.
- function baseCreate(prototype) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
- if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
- var Ctor = ctor();
- Ctor.prototype = prototype;
- var result = new Ctor;
- Ctor.prototype = null;
- return result;
- }
- /***/ }),
- /* 197 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = clone;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(194);
- // Create a (shallow-cloned) duplicate of an object.
- function clone(obj) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
- return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
- }
- /***/ }),
- /* 198 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = get;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(86);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(140);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(180);
- // Get the value of the (deep) property on `path` from `object`.
- // If any property in `path` does not exist or if the value is
- // `undefined`, return `defaultValue` instead.
- // The `path` is normalized through `_.toPath`.
- function get(object, path, defaultValue) {
- var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
- return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
- }
- /***/ }),
- /* 199 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
- // Normalize a (deep) property `path` to array.
- // Like `_.iteratee`, this function can be customized.
- function toPath(path) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
- }
- __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
- /***/ }),
- /* 200 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(141);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(57);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(111);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(142);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(87);
- // An internal function to generate callbacks that can be applied to each
- // element in a collection, returning the desired result — either `_.identity`,
- // an arbitrary callback, a property matcher, or a property accessor.
- function baseIteratee(value, context, argCount) {
- if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
- if (Object(__WEBPACK_IMPORTED_MODULE_2__isObject_js__["a" /* default */])(value) && !Object(__WEBPACK_IMPORTED_MODULE_3__isArray_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_4__matcher_js__["a" /* default */])(value);
- return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
- }
- /***/ }),
- /* 201 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
- // External wrapper for our callback generator. Users may customize
- // `_.iteratee` if they want additional predicate/iteratee shorthand styles.
- // This abstraction hides the internal-only `argCount` argument.
- function iteratee(value, context) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
- }
- __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
- /***/ }),
- /* 202 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = noop;
- // Predicate-generating function. Often useful outside of Underscore.
- function noop(){}
- /***/ }),
- /* 203 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = random;
- // Return a random integer between `min` and `max` (inclusive).
- function random(min, max) {
- if (max == null) {
- max = min;
- min = 0;
- }
- return min + Math.floor(Math.random() * (max - min + 1));
- }
- /***/ }),
- /* 204 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
- // Internal helper to generate functions for escaping and unescaping strings
- // to/from HTML interpolation.
- function createEscaper(map) {
- var escaper = function(match) {
- return map[match];
- };
- // Regexes for identifying a key that needs to be escaped.
- var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
- var testRegexp = RegExp(source);
- var replaceRegexp = RegExp(source, 'g');
- return function(string) {
- string = string == null ? '' : '' + string;
- return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
- };
- }
- /***/ }),
- /* 205 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // Internal list of HTML entities for escaping.
- /* harmony default export */ __webpack_exports__["a"] = ({
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": ''',
- '`': '`'
- });
- /***/ }),
- /* 206 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- // By default, Underscore uses ERB-style template delimiters. Change the
- // following template settings to use alternative delimiters.
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
- evaluate: /<%([\s\S]+?)%>/g,
- interpolate: /<%=([\s\S]+?)%>/g,
- escape: /<%-([\s\S]+?)%>/g
- });
- /***/ }),
- /* 207 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(56);
- // Internal function to execute `sourceFunc` bound to `context` with optional
- // `args`. Determines whether to execute a function as a constructor or as a
- // normal function.
- function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
- if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
- var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
- var result = sourceFunc.apply(self, args);
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
- return self;
- }
- /***/ }),
- /* 208 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(207);
- // Create a function bound to a given object (assigning `this`, and arguments,
- // optionally).
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
- var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
- return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
- });
- return bound;
- }));
- /***/ }),
- /* 209 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- // Delays a function for the given number of milliseconds, and then calls
- // it with the arguments supplied.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
- return setTimeout(function() {
- return func.apply(null, args);
- }, wait);
- }));
- /***/ }),
- /* 210 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = before;
- // Returns a function that will only be executed up to (but not including) the
- // Nth call.
- function before(times, func) {
- var memo;
- return function() {
- if (--times > 0) {
- memo = func.apply(this, arguments);
- }
- if (times <= 1) func = null;
- return memo;
- };
- }
- /***/ }),
- /* 211 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
- // Returns the first key on an object that passes a truth test.
- function findKey(obj, predicate, context) {
- predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
- for (var i = 0, length = _keys.length; i < length; i++) {
- key = _keys[i];
- if (predicate(obj[key], key, obj)) return key;
- }
- }
- /***/ }),
- /* 212 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
- // Internal function to generate `_.findIndex` and `_.findLastIndex`.
- function createPredicateIndexFinder(dir) {
- return function(array, predicate, context) {
- predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
- var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
- var index = dir > 0 ? 0 : length - 1;
- for (; index >= 0 && index < length; index += dir) {
- if (predicate(array[index], index, array)) return index;
- }
- return -1;
- };
- }
- /***/ }),
- /* 213 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
- // Returns the last index on an array-like that passes a truth test.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
- /***/ }),
- /* 214 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
- // Use a comparator function to figure out the smallest index at which
- // an object should be inserted so as to maintain order. Uses binary search.
- function sortedIndex(array, obj, iteratee, context) {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
- var value = iteratee(obj);
- var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
- while (low < high) {
- var mid = Math.floor((low + high) / 2);
- if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
- }
- return low;
- }
- /***/ }),
- /* 215 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(214);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(216);
- // Return the position of the first occurrence of an item in an array,
- // or -1 if the item is not included in the array.
- // If the array is large and already in sort order, pass `true`
- // for **isSorted** to use binary search.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__["a" /* default */])(1, __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__["a" /* default */]));
- /***/ }),
- /* 216 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(185);
- // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
- function createIndexFinder(dir, predicateFind, sortedIndex) {
- return function(array, item, idx) {
- var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
- if (typeof idx == 'number') {
- if (dir > 0) {
- i = idx >= 0 ? idx : Math.max(idx + length, i);
- } else {
- length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
- }
- } else if (sortedIndex && idx && length) {
- idx = sortedIndex(array, item);
- return array[idx] === item ? idx : -1;
- }
- if (item !== item) {
- idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
- return idx >= 0 ? idx + i : -1;
- }
- for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
- if (array[idx] === item) return idx;
- }
- return -1;
- };
- }
- /***/ }),
- /* 217 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = find;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(211);
- // Return the first value which passes a truth test.
- function find(obj, predicate, context) {
- var keyFinder = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_2__findKey_js__["a" /* default */];
- var key = keyFinder(obj, predicate, context);
- if (key !== void 0 && key !== -1) return obj[key];
- }
- /***/ }),
- /* 218 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
- // Internal helper to create a reducing function, iterating left or right.
- function createReduce(dir) {
- // Wrap code that reassigns argument variables in a separate function than
- // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
- var reducer = function(obj, iteratee, memo, initial) {
- var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
- length = (_keys || obj).length,
- index = dir > 0 ? 0 : length - 1;
- if (!initial) {
- memo = obj[_keys ? _keys[index] : index];
- index += dir;
- }
- for (; index >= 0 && index < length; index += dir) {
- var currentKey = _keys ? _keys[index] : index;
- memo = iteratee(memo, obj[currentKey], currentKey, obj);
- }
- return memo;
- };
- return function(obj, iteratee, memo, context) {
- var initial = arguments.length >= 3;
- return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
- };
- }
- /***/ }),
- /* 219 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = max;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
- // Return the maximum element (or element-based computation).
- function max(obj, iteratee, context) {
- var result = -Infinity, lastComputed = -Infinity,
- value, computed;
- if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
- obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
- for (var i = 0, length = obj.length; i < length; i++) {
- value = obj[i];
- if (value != null && value > result) {
- result = value;
- }
- }
- } else {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
- Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
- computed = iteratee(v, index, list);
- if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
- result = v;
- lastComputed = computed;
- }
- });
- }
- return result;
- }
- /***/ }),
- /* 220 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = sample;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(197);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(66);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(203);
- // Sample **n** random values from a collection using the modern version of the
- // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
- // If **n** is not specified, returns a single random element.
- // The internal `guard` argument allows it to work with `_.map`.
- function sample(obj, n, guard) {
- if (n == null || guard) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
- return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
- }
- var sample = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? Object(__WEBPACK_IMPORTED_MODULE_1__clone_js__["a" /* default */])(obj) : Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
- var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
- n = Math.max(Math.min(n, length), 0);
- var last = length - 1;
- for (var index = 0; index < n; index++) {
- var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
- var temp = sample[index];
- sample[index] = sample[rand];
- sample[rand] = temp;
- }
- return sample.slice(0, n);
- }
- /***/ }),
- /* 221 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(85);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(375);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(67);
- // Return a copy of the object only containing the allowed properties.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
- var result = {}, iteratee = keys[0];
- if (obj == null) return result;
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
- if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
- keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
- } else {
- iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
- keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
- obj = Object(obj);
- }
- for (var i = 0, length = keys.length; i < length; i++) {
- var key = keys[i];
- var value = obj[key];
- if (iteratee(value, key, obj)) result[key] = value;
- }
- return result;
- }));
- /***/ }),
- /* 222 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = initial;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Returns everything but the last entry of the array. Especially useful on
- // the arguments object. Passing **n** will return all the values in
- // the array, excluding the last N.
- function initial(array, n, guard) {
- return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
- }
- /***/ }),
- /* 223 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = rest;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Returns everything but the first entry of the `array`. Especially useful on
- // the `arguments` object. Passing an **n** will return the rest N values in the
- // `array`.
- function rest(array, n, guard) {
- return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
- }
- /***/ }),
- /* 224 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(88);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
- // Take the difference between one array and a number of other arrays.
- // Only the elements present in just the first array will remain.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
- rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
- return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
- return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
- });
- }));
- /***/ }),
- /* 225 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(181);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
- // Produce a duplicate-free version of the array. If the array has already
- // been sorted, you have the option of using a faster algorithm.
- // The faster algorithm will not work with an iteratee if the iteratee
- // is not a one-to-one function, so providing an iteratee will disable
- // the faster algorithm.
- function uniq(array, isSorted, iteratee, context) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
- context = iteratee;
- iteratee = isSorted;
- isSorted = false;
- }
- if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
- var result = [];
- var seen = [];
- for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
- var value = array[i],
- computed = iteratee ? iteratee(value, i, array) : value;
- if (isSorted && !iteratee) {
- if (!i || seen !== computed) result.push(value);
- seen = computed;
- } else if (iteratee) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
- seen.push(computed);
- result.push(value);
- }
- } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
- result.push(value);
- }
- }
- return result;
- }
- /***/ }),
- /* 226 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(219);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(146);
- // Complement of zip. Unzip accepts an array of arrays and groups
- // each array's elements on shared indices.
- function unzip(array) {
- var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
- var result = Array(length);
- for (var index = 0; index < length; index++) {
- result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
- }
- return result;
- }
- /***/ }),
- /* 227 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- // Helper function to continue chaining intermediate results.
- function chainResult(instance, obj) {
- return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
- }
- /***/ }),
- /* 228 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var fails = __webpack_require__(2);
- var isArray = __webpack_require__(90);
- var isObject = __webpack_require__(11);
- var toObject = __webpack_require__(34);
- var lengthOfArrayLike = __webpack_require__(41);
- var doesNotExceedSafeInteger = __webpack_require__(393);
- var createProperty = __webpack_require__(91);
- var arraySpeciesCreate = __webpack_require__(229);
- var arrayMethodHasSpeciesSupport = __webpack_require__(114);
- var wellKnownSymbol = __webpack_require__(9);
- var V8_VERSION = __webpack_require__(77);
- var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/679
- var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
- var array = [];
- array[IS_CONCAT_SPREADABLE] = false;
- return array.concat()[0] !== array;
- });
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
- var isConcatSpreadable = function (O) {
- if (!isObject(O)) return false;
- var spreadable = O[IS_CONCAT_SPREADABLE];
- return spreadable !== undefined ? !!spreadable : isArray(O);
- };
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
- // `Array.prototype.concat` method
- // https://tc39.es/ecma262/#sec-array.prototype.concat
- // with adding support of @@isConcatSpreadable and @@species
- $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- concat: function concat(arg) {
- var O = toObject(this);
- var A = arraySpeciesCreate(O, 0);
- var n = 0;
- var i, k, length, len, E;
- for (i = -1, length = arguments.length; i < length; i++) {
- E = i === -1 ? O : arguments[i];
- if (isConcatSpreadable(E)) {
- len = lengthOfArrayLike(E);
- doesNotExceedSafeInteger(n + len);
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
- } else {
- doesNotExceedSafeInteger(n + 1);
- createProperty(A, n++, E);
- }
- }
- A.length = n;
- return A;
- }
- });
- /***/ }),
- /* 229 */
- /***/ (function(module, exports, __webpack_require__) {
- var arraySpeciesConstructor = __webpack_require__(394);
- // `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray, length) {
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
- };
- /***/ }),
- /* 230 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var getBuiltIn = __webpack_require__(18);
- var apply = __webpack_require__(75);
- var call = __webpack_require__(15);
- var uncurryThis = __webpack_require__(4);
- var fails = __webpack_require__(2);
- var isArray = __webpack_require__(90);
- var isCallable = __webpack_require__(8);
- var isObject = __webpack_require__(11);
- var isSymbol = __webpack_require__(97);
- var arraySlice = __webpack_require__(110);
- var NATIVE_SYMBOL = __webpack_require__(64);
- var $stringify = getBuiltIn('JSON', 'stringify');
- var exec = uncurryThis(/./.exec);
- var charAt = uncurryThis(''.charAt);
- var charCodeAt = uncurryThis(''.charCodeAt);
- var replace = uncurryThis(''.replace);
- var numberToString = uncurryThis(1.0.toString);
- var tester = /[\uD800-\uDFFF]/g;
- var low = /^[\uD800-\uDBFF]$/;
- var hi = /^[\uDC00-\uDFFF]$/;
- var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
- var symbol = getBuiltIn('Symbol')();
- // MS Edge converts symbol values to JSON as {}
- return $stringify([symbol]) != '[null]'
- // WebKit converts symbol values to JSON as null
- || $stringify({ a: symbol }) != '{}'
- // V8 throws on boxed symbols
- || $stringify(Object(symbol)) != '{}';
- });
- // https://github.com/tc39/proposal-well-formed-stringify
- var ILL_FORMED_UNICODE = fails(function () {
- return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
- || $stringify('\uDEAD') !== '"\\udead"';
- });
- var stringifyWithSymbolsFix = function (it, replacer) {
- var args = arraySlice(arguments);
- var $replacer = replacer;
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
- if (!isArray(replacer)) replacer = function (key, value) {
- if (isCallable($replacer)) value = call($replacer, this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return apply($stringify, null, args);
- };
- var fixIllFormed = function (match, offset, string) {
- var prev = charAt(string, offset - 1);
- var next = charAt(string, offset + 1);
- if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
- return '\\u' + numberToString(charCodeAt(match, 0), 16);
- } return match;
- };
- if ($stringify) {
- // `JSON.stringify` method
- // https://tc39.es/ecma262/#sec-json.stringify
- $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- stringify: function stringify(it, replacer, space) {
- var args = arraySlice(arguments);
- var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
- return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
- }
- });
- }
- /***/ }),
- /* 231 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var fails = __webpack_require__(2);
- module.exports = function (METHOD_NAME, argument) {
- var method = [][METHOD_NAME];
- return !!method && fails(function () {
- // eslint-disable-next-line no-useless-call -- required for testing
- method.call(null, argument || function () { return 1; }, 1);
- });
- };
- /***/ }),
- /* 232 */
- /***/ (function(module, exports, __webpack_require__) {
- var rng = __webpack_require__(411);
- var bytesToUuid = __webpack_require__(412);
- function v4(options, buf, offset) {
- var i = buf && offset || 0;
- if (typeof(options) == 'string') {
- buf = options === 'binary' ? new Array(16) : null;
- options = null;
- }
- options = options || {};
- var rnds = options.random || (options.rng || rng)();
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
- // Copy bytes to buffer, if provided
- if (buf) {
- for (var ii = 0; ii < 16; ++ii) {
- buf[i + ii] = rnds[ii];
- }
- }
- return buf || bytesToUuid(rnds);
- }
- module.exports = v4;
- /***/ }),
- /* 233 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(415);
- module.exports = parent;
- /***/ }),
- /* 234 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = '4.13.4';
- /***/ }),
- /* 235 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var has = Object.prototype.hasOwnProperty
- , prefix = '~';
- /**
- * Constructor to create a storage for our `EE` objects.
- * An `Events` instance is a plain object whose properties are event names.
- *
- * @constructor
- * @api private
- */
- function Events() {}
- //
- // We try to not inherit from `Object.prototype`. In some engines creating an
- // instance in this way is faster than calling `Object.create(null)` directly.
- // If `Object.create(null)` is not supported we prefix the event names with a
- // character to make sure that the built-in object properties are not
- // overridden or used as an attack vector.
- //
- if (Object.create) {
- Events.prototype = Object.create(null);
- //
- // This hack is needed because the `__proto__` property is still inherited in
- // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
- //
- if (!new Events().__proto__) prefix = false;
- }
- /**
- * Representation of a single event listener.
- *
- * @param {Function} fn The listener function.
- * @param {Mixed} context The context to invoke the listener with.
- * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
- * @constructor
- * @api private
- */
- function EE(fn, context, once) {
- this.fn = fn;
- this.context = context;
- this.once = once || false;
- }
- /**
- * Minimal `EventEmitter` interface that is molded against the Node.js
- * `EventEmitter` interface.
- *
- * @constructor
- * @api public
- */
- function EventEmitter() {
- this._events = new Events();
- this._eventsCount = 0;
- }
- /**
- * Return an array listing the events for which the emitter has registered
- * listeners.
- *
- * @returns {Array}
- * @api public
- */
- EventEmitter.prototype.eventNames = function eventNames() {
- var names = []
- , events
- , name;
- if (this._eventsCount === 0) return names;
- for (name in (events = this._events)) {
- if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
- }
- if (Object.getOwnPropertySymbols) {
- return names.concat(Object.getOwnPropertySymbols(events));
- }
- return names;
- };
- /**
- * Return the listeners registered for a given event.
- *
- * @param {String|Symbol} event The event name.
- * @param {Boolean} exists Only check if there are listeners.
- * @returns {Array|Boolean}
- * @api public
- */
- EventEmitter.prototype.listeners = function listeners(event, exists) {
- var evt = prefix ? prefix + event : event
- , available = this._events[evt];
- if (exists) return !!available;
- if (!available) return [];
- if (available.fn) return [available.fn];
- for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
- ee[i] = available[i].fn;
- }
- return ee;
- };
- /**
- * Calls each of the listeners registered for a given event.
- *
- * @param {String|Symbol} event The event name.
- * @returns {Boolean} `true` if the event had listeners, else `false`.
- * @api public
- */
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
- var evt = prefix ? prefix + event : event;
- if (!this._events[evt]) return false;
- var listeners = this._events[evt]
- , len = arguments.length
- , args
- , i;
- if (listeners.fn) {
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
- switch (len) {
- case 1: return listeners.fn.call(listeners.context), true;
- case 2: return listeners.fn.call(listeners.context, a1), true;
- case 3: return listeners.fn.call(listeners.context, a1, a2), true;
- case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
- case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
- case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
- }
- for (i = 1, args = new Array(len -1); i < len; i++) {
- args[i - 1] = arguments[i];
- }
- listeners.fn.apply(listeners.context, args);
- } else {
- var length = listeners.length
- , j;
- for (i = 0; i < length; i++) {
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
- switch (len) {
- case 1: listeners[i].fn.call(listeners[i].context); break;
- case 2: listeners[i].fn.call(listeners[i].context, a1); break;
- case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
- case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
- default:
- if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
- args[j - 1] = arguments[j];
- }
- listeners[i].fn.apply(listeners[i].context, args);
- }
- }
- }
- return true;
- };
- /**
- * Add a listener for a given event.
- *
- * @param {String|Symbol} event The event name.
- * @param {Function} fn The listener function.
- * @param {Mixed} [context=this] The context to invoke the listener with.
- * @returns {EventEmitter} `this`.
- * @api public
- */
- EventEmitter.prototype.on = function on(event, fn, context) {
- var listener = new EE(fn, context || this)
- , evt = prefix ? prefix + event : event;
- if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
- else if (!this._events[evt].fn) this._events[evt].push(listener);
- else this._events[evt] = [this._events[evt], listener];
- return this;
- };
- /**
- * Add a one-time listener for a given event.
- *
- * @param {String|Symbol} event The event name.
- * @param {Function} fn The listener function.
- * @param {Mixed} [context=this] The context to invoke the listener with.
- * @returns {EventEmitter} `this`.
- * @api public
- */
- EventEmitter.prototype.once = function once(event, fn, context) {
- var listener = new EE(fn, context || this, true)
- , evt = prefix ? prefix + event : event;
- if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
- else if (!this._events[evt].fn) this._events[evt].push(listener);
- else this._events[evt] = [this._events[evt], listener];
- return this;
- };
- /**
- * Remove the listeners of a given event.
- *
- * @param {String|Symbol} event The event name.
- * @param {Function} fn Only remove the listeners that match this function.
- * @param {Mixed} context Only remove the listeners that have this context.
- * @param {Boolean} once Only remove one-time listeners.
- * @returns {EventEmitter} `this`.
- * @api public
- */
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
- var evt = prefix ? prefix + event : event;
- if (!this._events[evt]) return this;
- if (!fn) {
- if (--this._eventsCount === 0) this._events = new Events();
- else delete this._events[evt];
- return this;
- }
- var listeners = this._events[evt];
- if (listeners.fn) {
- if (
- listeners.fn === fn
- && (!once || listeners.once)
- && (!context || listeners.context === context)
- ) {
- if (--this._eventsCount === 0) this._events = new Events();
- else delete this._events[evt];
- }
- } else {
- for (var i = 0, events = [], length = listeners.length; i < length; i++) {
- if (
- listeners[i].fn !== fn
- || (once && !listeners[i].once)
- || (context && listeners[i].context !== context)
- ) {
- events.push(listeners[i]);
- }
- }
- //
- // Reset the array, or remove it completely if we have no more listeners.
- //
- if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
- else if (--this._eventsCount === 0) this._events = new Events();
- else delete this._events[evt];
- }
- return this;
- };
- /**
- * Remove all listeners, or those of the specified event.
- *
- * @param {String|Symbol} [event] The event name.
- * @returns {EventEmitter} `this`.
- * @api public
- */
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
- var evt;
- if (event) {
- evt = prefix ? prefix + event : event;
- if (this._events[evt]) {
- if (--this._eventsCount === 0) this._events = new Events();
- else delete this._events[evt];
- }
- } else {
- this._events = new Events();
- this._eventsCount = 0;
- }
- return this;
- };
- //
- // Alias methods names because people roll like that.
- //
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
- //
- // This function doesn't apply anymore.
- //
- EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
- return this;
- };
- //
- // Expose the prefix.
- //
- EventEmitter.prefixed = prefix;
- //
- // Allow `EventEmitter` to be imported as module namespace.
- //
- EventEmitter.EventEmitter = EventEmitter;
- //
- // Expose the module.
- //
- if (true) {
- module.exports = EventEmitter;
- }
- /***/ }),
- /* 236 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _require = __webpack_require__(72),
- getAdapter = _require.getAdapter;
- var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
- var localStorage = {
- get async() {
- return getAdapter('storage').async;
- }
- }; // wrap sync apis with async ones.
- syncApiNames.forEach(function (apiName) {
- localStorage[apiName + 'Async'] = function () {
- var storage = getAdapter('storage');
- return _promise.default.resolve(storage[apiName].apply(storage, arguments));
- };
- localStorage[apiName] = function () {
- var storage = getAdapter('storage');
- if (!storage.async) {
- return storage[apiName].apply(storage, arguments);
- }
- var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
- error.code = 'SYNC_API_NOT_AVAILABLE';
- throw error;
- };
- });
- module.exports = localStorage;
- /***/ }),
- /* 237 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var storage = __webpack_require__(236);
- var AV = __webpack_require__(69);
- var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
- var getCacheData = function getCacheData(cacheData, key) {
- try {
- cacheData = JSON.parse(cacheData);
- } catch (e) {
- return null;
- }
- if (cacheData) {
- var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
- if (!expired) {
- return cacheData.value;
- }
- return removeAsync(key).then(function () {
- return null;
- });
- }
- return null;
- };
- exports.getAsync = function (key) {
- var _context;
- key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
- return storage.getItemAsync(key).then(function (cache) {
- return getCacheData(cache, key);
- });
- };
- exports.setAsync = function (key, value, ttl) {
- var _context2;
- var cache = {
- value: value
- };
- if (typeof ttl === 'number') {
- cache.expiredAt = Date.now() + ttl;
- }
- return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
- };
- /***/ }),
- /* 238 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(239);
- /***/ }),
- /* 239 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(417);
- module.exports = parent;
- /***/ }),
- /* 240 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(420);
- module.exports = parent;
- /***/ }),
- /* 241 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(423);
- module.exports = parent;
- /***/ }),
- /* 242 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(426);
- /***/ }),
- /* 243 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(429);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 244 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove this module from `core-js@4` since it's split to modules listed below
- __webpack_require__(430);
- __webpack_require__(432);
- __webpack_require__(433);
- __webpack_require__(230);
- __webpack_require__(434);
- /***/ }),
- /* 245 */
- /***/ (function(module, exports, __webpack_require__) {
- /* eslint-disable es-x/no-object-getownpropertynames -- safe */
- var classof = __webpack_require__(63);
- var toIndexedObject = __webpack_require__(32);
- var $getOwnPropertyNames = __webpack_require__(103).f;
- var arraySlice = __webpack_require__(431);
- var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window) : [];
- var getWindowNames = function (it) {
- try {
- return $getOwnPropertyNames(it);
- } catch (error) {
- return arraySlice(windowNames);
- }
- };
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- module.exports.f = function getOwnPropertyNames(it) {
- return windowNames && classof(it) == 'Window'
- ? getWindowNames(it)
- : $getOwnPropertyNames(toIndexedObject(it));
- };
- /***/ }),
- /* 246 */
- /***/ (function(module, exports, __webpack_require__) {
- var call = __webpack_require__(15);
- var getBuiltIn = __webpack_require__(18);
- var wellKnownSymbol = __webpack_require__(9);
- var defineBuiltIn = __webpack_require__(44);
- module.exports = function () {
- var Symbol = getBuiltIn('Symbol');
- var SymbolPrototype = Symbol && Symbol.prototype;
- var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- // eslint-disable-next-line no-unused-vars -- required for .length
- defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
- return call(valueOf, this);
- }, { arity: 1 });
- }
- };
- /***/ }),
- /* 247 */
- /***/ (function(module, exports, __webpack_require__) {
- var NATIVE_SYMBOL = __webpack_require__(64);
- /* eslint-disable es-x/no-symbol -- safe */
- module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
- /***/ }),
- /* 248 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.iterator` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.iterator
- defineWellKnownSymbol('iterator');
- /***/ }),
- /* 249 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(463);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 250 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(464);
- /***/ }),
- /* 251 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright (c) 2015-2017 David M. Lee, II
- /**
- * Local reference to TimeoutError
- * @private
- */
- var TimeoutError;
- /**
- * Rejects a promise with a {@link TimeoutError} if it does not settle within
- * the specified timeout.
- *
- * @param {Promise} promise The promise.
- * @param {number} timeoutMillis Number of milliseconds to wait on settling.
- * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
- * `TimeoutError`, whichever settles first.
- */
- var timeout = module.exports.timeout = function(promise, timeoutMillis) {
- var error = new TimeoutError(),
- timeout;
- return Promise.race([
- promise,
- new Promise(function(resolve, reject) {
- timeout = setTimeout(function() {
- reject(error);
- }, timeoutMillis);
- }),
- ]).then(function(v) {
- clearTimeout(timeout);
- return v;
- }, function(err) {
- clearTimeout(timeout);
- throw err;
- });
- };
- /**
- * Exception indicating that the timeout expired.
- */
- TimeoutError = module.exports.TimeoutError = function() {
- Error.call(this)
- this.stack = Error().stack
- this.message = 'Timeout';
- };
- TimeoutError.prototype = Object.create(Error.prototype);
- TimeoutError.prototype.name = "TimeoutError";
- /***/ }),
- /* 252 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(253);
- /***/ }),
- /* 253 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(480);
- module.exports = parent;
- /***/ }),
- /* 254 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(484);
- /***/ }),
- /* 255 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var uncurryThis = __webpack_require__(4);
- var aCallable = __webpack_require__(31);
- var isObject = __webpack_require__(11);
- var hasOwn = __webpack_require__(13);
- var arraySlice = __webpack_require__(110);
- var NATIVE_BIND = __webpack_require__(76);
- var $Function = Function;
- var concat = uncurryThis([].concat);
- var join = uncurryThis([].join);
- var factories = {};
- var construct = function (C, argsLength, args) {
- if (!hasOwn(factories, argsLength)) {
- for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
- factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
- } return factories[argsLength](C, args);
- };
- // `Function.prototype.bind` method implementation
- // https://tc39.es/ecma262/#sec-function.prototype.bind
- module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
- var F = aCallable(this);
- var Prototype = F.prototype;
- var partArgs = arraySlice(arguments, 1);
- var boundFunction = function bound(/* args... */) {
- var args = concat(partArgs, arraySlice(arguments));
- return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
- };
- if (isObject(Prototype)) boundFunction.prototype = Prototype;
- return boundFunction;
- };
- /***/ }),
- /* 256 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(505);
- /***/ }),
- /* 257 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(508);
- /***/ }),
- /* 258 */
- /***/ (function(module, exports) {
- var charenc = {
- // UTF-8 encoding
- utf8: {
- // Convert a string to a byte array
- stringToBytes: function(str) {
- return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
- },
- // Convert a byte array to a string
- bytesToString: function(bytes) {
- return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
- }
- },
- // Binary encoding
- bin: {
- // Convert a string to a byte array
- stringToBytes: function(str) {
- for (var bytes = [], i = 0; i < str.length; i++)
- bytes.push(str.charCodeAt(i) & 0xFF);
- return bytes;
- },
- // Convert a byte array to a string
- bytesToString: function(bytes) {
- for (var str = [], i = 0; i < bytes.length; i++)
- str.push(String.fromCharCode(bytes[i]));
- return str.join('');
- }
- }
- };
- module.exports = charenc;
- /***/ }),
- /* 259 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var adapters = __webpack_require__(569);
- module.exports = function (AV) {
- AV.setAdapters(adapters);
- return AV;
- };
- /***/ }),
- /* 260 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(577);
- /***/ }),
- /* 261 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- var isObject = __webpack_require__(11);
- var classof = __webpack_require__(63);
- var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(581);
- // eslint-disable-next-line es-x/no-object-isextensible -- safe
- var $isExtensible = Object.isExtensible;
- var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
- // `Object.isExtensible` method
- // https://tc39.es/ecma262/#sec-object.isextensible
- module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
- if (!isObject(it)) return false;
- if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
- return $isExtensible ? $isExtensible(it) : true;
- } : $isExtensible;
- /***/ }),
- /* 262 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- module.exports = !fails(function () {
- // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
- return Object.isExtensible(Object.preventExtensions({}));
- });
- /***/ }),
- /* 263 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var defineProperty = __webpack_require__(23).f;
- var create = __webpack_require__(49);
- var defineBuiltIns = __webpack_require__(154);
- var bind = __webpack_require__(48);
- var anInstance = __webpack_require__(108);
- var iterate = __webpack_require__(42);
- var defineIterator = __webpack_require__(131);
- var setSpecies = __webpack_require__(172);
- var DESCRIPTORS = __webpack_require__(14);
- var fastKey = __webpack_require__(94).fastKey;
- var InternalStateModule = __webpack_require__(43);
- var setInternalState = InternalStateModule.set;
- var internalStateGetterFor = InternalStateModule.getterFor;
- module.exports = {
- getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
- var Constructor = wrapper(function (that, iterable) {
- anInstance(that, Prototype);
- setInternalState(that, {
- type: CONSTRUCTOR_NAME,
- index: create(null),
- first: undefined,
- last: undefined,
- size: 0
- });
- if (!DESCRIPTORS) that.size = 0;
- if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
- });
- var Prototype = Constructor.prototype;
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var define = function (that, key, value) {
- var state = getInternalState(that);
- var entry = getEntry(that, key);
- var previous, index;
- // change existing entry
- if (entry) {
- entry.value = value;
- // create new entry
- } else {
- state.last = entry = {
- index: index = fastKey(key, true),
- key: key,
- value: value,
- previous: previous = state.last,
- next: undefined,
- removed: false
- };
- if (!state.first) state.first = entry;
- if (previous) previous.next = entry;
- if (DESCRIPTORS) state.size++;
- else that.size++;
- // add to index
- if (index !== 'F') state.index[index] = entry;
- } return that;
- };
- var getEntry = function (that, key) {
- var state = getInternalState(that);
- // fast case
- var index = fastKey(key);
- var entry;
- if (index !== 'F') return state.index[index];
- // frozen object case
- for (entry = state.first; entry; entry = entry.next) {
- if (entry.key == key) return entry;
- }
- };
- defineBuiltIns(Prototype, {
- // `{ Map, Set }.prototype.clear()` methods
- // https://tc39.es/ecma262/#sec-map.prototype.clear
- // https://tc39.es/ecma262/#sec-set.prototype.clear
- clear: function clear() {
- var that = this;
- var state = getInternalState(that);
- var data = state.index;
- var entry = state.first;
- while (entry) {
- entry.removed = true;
- if (entry.previous) entry.previous = entry.previous.next = undefined;
- delete data[entry.index];
- entry = entry.next;
- }
- state.first = state.last = undefined;
- if (DESCRIPTORS) state.size = 0;
- else that.size = 0;
- },
- // `{ Map, Set }.prototype.delete(key)` methods
- // https://tc39.es/ecma262/#sec-map.prototype.delete
- // https://tc39.es/ecma262/#sec-set.prototype.delete
- 'delete': function (key) {
- var that = this;
- var state = getInternalState(that);
- var entry = getEntry(that, key);
- if (entry) {
- var next = entry.next;
- var prev = entry.previous;
- delete state.index[entry.index];
- entry.removed = true;
- if (prev) prev.next = next;
- if (next) next.previous = prev;
- if (state.first == entry) state.first = next;
- if (state.last == entry) state.last = prev;
- if (DESCRIPTORS) state.size--;
- else that.size--;
- } return !!entry;
- },
- // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
- // https://tc39.es/ecma262/#sec-map.prototype.foreach
- // https://tc39.es/ecma262/#sec-set.prototype.foreach
- forEach: function forEach(callbackfn /* , that = undefined */) {
- var state = getInternalState(this);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- var entry;
- while (entry = entry ? entry.next : state.first) {
- boundFunction(entry.value, entry.key, this);
- // revert to the last existing entry
- while (entry && entry.removed) entry = entry.previous;
- }
- },
- // `{ Map, Set}.prototype.has(key)` methods
- // https://tc39.es/ecma262/#sec-map.prototype.has
- // https://tc39.es/ecma262/#sec-set.prototype.has
- has: function has(key) {
- return !!getEntry(this, key);
- }
- });
- defineBuiltIns(Prototype, IS_MAP ? {
- // `Map.prototype.get(key)` method
- // https://tc39.es/ecma262/#sec-map.prototype.get
- get: function get(key) {
- var entry = getEntry(this, key);
- return entry && entry.value;
- },
- // `Map.prototype.set(key, value)` method
- // https://tc39.es/ecma262/#sec-map.prototype.set
- set: function set(key, value) {
- return define(this, key === 0 ? 0 : key, value);
- }
- } : {
- // `Set.prototype.add(value)` method
- // https://tc39.es/ecma262/#sec-set.prototype.add
- add: function add(value) {
- return define(this, value = value === 0 ? 0 : value, value);
- }
- });
- if (DESCRIPTORS) defineProperty(Prototype, 'size', {
- get: function () {
- return getInternalState(this).size;
- }
- });
- return Constructor;
- },
- setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
- var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
- var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
- // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
- // https://tc39.es/ecma262/#sec-map.prototype.entries
- // https://tc39.es/ecma262/#sec-map.prototype.keys
- // https://tc39.es/ecma262/#sec-map.prototype.values
- // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
- // https://tc39.es/ecma262/#sec-set.prototype.entries
- // https://tc39.es/ecma262/#sec-set.prototype.keys
- // https://tc39.es/ecma262/#sec-set.prototype.values
- // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
- defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
- setInternalState(this, {
- type: ITERATOR_NAME,
- target: iterated,
- state: getInternalCollectionState(iterated),
- kind: kind,
- last: undefined
- });
- }, function () {
- var state = getInternalIteratorState(this);
- var kind = state.kind;
- var entry = state.last;
- // revert to the last existing entry
- while (entry && entry.removed) entry = entry.previous;
- // get next entry
- if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
- // or finish the iteration
- state.target = undefined;
- return { value: undefined, done: true };
- }
- // return step by kind
- if (kind == 'keys') return { value: entry.key, done: false };
- if (kind == 'values') return { value: entry.value, done: false };
- return { value: [entry.key, entry.value], done: false };
- }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
- // `{ Map, Set }.prototype[@@species]` accessors
- // https://tc39.es/ecma262/#sec-get-map-@@species
- // https://tc39.es/ecma262/#sec-get-set-@@species
- setSpecies(CONSTRUCTOR_NAME);
- }
- };
- /***/ }),
- /* 264 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(608);
- /***/ }),
- /* 265 */
- /***/ (function(module, exports) {
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- module.exports = _arrayLikeToArray;
- /***/ }),
- /* 266 */
- /***/ (function(module, exports) {
- function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
- }
- module.exports = _iterableToArray;
- /***/ }),
- /* 267 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayLikeToArray = __webpack_require__(265);
- function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
- }
- module.exports = _unsupportedIterableToArray;
- /***/ }),
- /* 268 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseRandom = __webpack_require__(631);
- /**
- * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
- *
- * @private
- * @param {Array} array The array to shuffle.
- * @param {number} [size=array.length] The size of `array`.
- * @returns {Array} Returns `array`.
- */
- function shuffleSelf(array, size) {
- var index = -1,
- length = array.length,
- lastIndex = length - 1;
- size = size === undefined ? length : size;
- while (++index < size) {
- var rand = baseRandom(index, lastIndex),
- value = array[rand];
- array[rand] = array[index];
- array[index] = value;
- }
- array.length = size;
- return array;
- }
- module.exports = shuffleSelf;
- /***/ }),
- /* 269 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseValues = __webpack_require__(633),
- keys = __webpack_require__(635);
- /**
- * Creates an array of the own enumerable string keyed property values of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.values(new Foo);
- * // => [1, 2] (iteration order is not guaranteed)
- *
- * _.values('hi');
- * // => ['h', 'i']
- */
- function values(object) {
- return object == null ? [] : baseValues(object, keys(object));
- }
- module.exports = values;
- /***/ }),
- /* 270 */
- /***/ (function(module, exports, __webpack_require__) {
- var root = __webpack_require__(271);
- /** Built-in value references. */
- var Symbol = root.Symbol;
- module.exports = Symbol;
- /***/ }),
- /* 271 */
- /***/ (function(module, exports, __webpack_require__) {
- var freeGlobal = __webpack_require__(272);
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- module.exports = root;
- /***/ }),
- /* 272 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
- module.exports = freeGlobal;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
- /***/ }),
- /* 273 */
- /***/ (function(module, exports) {
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- module.exports = isArray;
- /***/ }),
- /* 274 */
- /***/ (function(module, exports) {
- module.exports = function(module) {
- if(!module.webpackPolyfill) {
- module.deprecate = function() {};
- module.paths = [];
- // module.parent = undefined by default
- if(!module.children) module.children = [];
- Object.defineProperty(module, "loaded", {
- enumerable: true,
- get: function() {
- return module.l;
- }
- });
- Object.defineProperty(module, "id", {
- enumerable: true,
- get: function() {
- return module.i;
- }
- });
- module.webpackPolyfill = 1;
- }
- return module;
- };
- /***/ }),
- /* 275 */
- /***/ (function(module, exports) {
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- module.exports = isLength;
- /***/ }),
- /* 276 */
- /***/ (function(module, exports) {
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- module.exports = overArg;
- /***/ }),
- /* 277 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var AV = __webpack_require__(278);
- var useLiveQuery = __webpack_require__(588);
- var useAdatpers = __webpack_require__(259);
- module.exports = useAdatpers(useLiveQuery(AV));
- /***/ }),
- /* 278 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var AV = __webpack_require__(279);
- var useAdatpers = __webpack_require__(259);
- module.exports = useAdatpers(AV);
- /***/ }),
- /* 279 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = __webpack_require__(280);
- /***/ }),
- /* 280 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- /*!
- * LeanCloud JavaScript SDK
- * https://leancloud.cn
- *
- * Copyright 2016 LeanCloud.cn, Inc.
- * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
- */
- var _ = __webpack_require__(3);
- var AV = __webpack_require__(69);
- AV._ = _;
- AV.version = __webpack_require__(234);
- AV.Promise = _promise.default;
- AV.localStorage = __webpack_require__(236);
- AV.Cache = __webpack_require__(237);
- AV.Error = __webpack_require__(46);
- __webpack_require__(419);
- __webpack_require__(468)(AV);
- __webpack_require__(469)(AV);
- __webpack_require__(470)(AV);
- __webpack_require__(471)(AV);
- __webpack_require__(476)(AV);
- __webpack_require__(477)(AV);
- __webpack_require__(530)(AV);
- __webpack_require__(555)(AV);
- __webpack_require__(556)(AV);
- __webpack_require__(558)(AV);
- __webpack_require__(559)(AV);
- __webpack_require__(560)(AV);
- __webpack_require__(561)(AV);
- __webpack_require__(562)(AV);
- __webpack_require__(563)(AV);
- __webpack_require__(564)(AV);
- __webpack_require__(565)(AV);
- __webpack_require__(566)(AV);
- AV.Conversation = __webpack_require__(567);
- __webpack_require__(568);
- module.exports = AV;
- /**
- * Options to controll the authentication for an operation
- * @typedef {Object} AuthOptions
- * @property {String} [sessionToken] Specify a user to excute the operation as.
- * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
- * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
- */
- /**
- * Options to controll the authentication for an SMS operation
- * @typedef {Object} SMSAuthOptions
- * @property {String} [sessionToken] Specify a user to excute the operation as.
- * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
- * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
- * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
- */
- /***/ }),
- /* 281 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(282);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 282 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(283);
- __webpack_require__(38);
- __webpack_require__(53);
- __webpack_require__(299);
- __webpack_require__(313);
- __webpack_require__(314);
- __webpack_require__(315);
- __webpack_require__(55);
- var path = __webpack_require__(5);
- module.exports = path.Promise;
- /***/ }),
- /* 283 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- __webpack_require__(284);
- /***/ }),
- /* 284 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var isPrototypeOf = __webpack_require__(19);
- var getPrototypeOf = __webpack_require__(100);
- var setPrototypeOf = __webpack_require__(102);
- var copyConstructorProperties = __webpack_require__(289);
- var create = __webpack_require__(49);
- var createNonEnumerableProperty = __webpack_require__(37);
- var createPropertyDescriptor = __webpack_require__(47);
- var clearErrorStack = __webpack_require__(292);
- var installErrorCause = __webpack_require__(293);
- var iterate = __webpack_require__(42);
- var normalizeStringArgument = __webpack_require__(294);
- var wellKnownSymbol = __webpack_require__(9);
- var ERROR_STACK_INSTALLABLE = __webpack_require__(295);
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var $Error = Error;
- var push = [].push;
- var $AggregateError = function AggregateError(errors, message /* , options */) {
- var options = arguments.length > 2 ? arguments[2] : undefined;
- var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
- var that;
- if (setPrototypeOf) {
- that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
- } else {
- that = isInstance ? this : create(AggregateErrorPrototype);
- createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
- }
- if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
- if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
- installErrorCause(that, options);
- var errorsArray = [];
- iterate(errors, push, { that: errorsArray });
- createNonEnumerableProperty(that, 'errors', errorsArray);
- return that;
- };
- if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
- else copyConstructorProperties($AggregateError, $Error, { name: true });
- var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
- constructor: createPropertyDescriptor(1, $AggregateError),
- message: createPropertyDescriptor(1, ''),
- name: createPropertyDescriptor(1, 'AggregateError')
- });
- // `AggregateError` constructor
- // https://tc39.es/ecma262/#sec-aggregate-error-constructor
- $({ global: true, constructor: true, arity: 2 }, {
- AggregateError: $AggregateError
- });
- /***/ }),
- /* 285 */
- /***/ (function(module, exports, __webpack_require__) {
- var call = __webpack_require__(15);
- var isObject = __webpack_require__(11);
- var isSymbol = __webpack_require__(97);
- var getMethod = __webpack_require__(122);
- var ordinaryToPrimitive = __webpack_require__(286);
- var wellKnownSymbol = __webpack_require__(9);
- var $TypeError = TypeError;
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- // `ToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-toprimitive
- module.exports = function (input, pref) {
- if (!isObject(input) || isSymbol(input)) return input;
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
- var result;
- if (exoticToPrim) {
- if (pref === undefined) pref = 'default';
- result = call(exoticToPrim, input, pref);
- if (!isObject(result) || isSymbol(result)) return result;
- throw $TypeError("Can't convert object to primitive value");
- }
- if (pref === undefined) pref = 'number';
- return ordinaryToPrimitive(input, pref);
- };
- /***/ }),
- /* 286 */
- /***/ (function(module, exports, __webpack_require__) {
- var call = __webpack_require__(15);
- var isCallable = __webpack_require__(8);
- var isObject = __webpack_require__(11);
- var $TypeError = TypeError;
- // `OrdinaryToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
- module.exports = function (input, pref) {
- var fn, val;
- if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
- if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
- if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
- throw $TypeError("Can't convert object to primitive value");
- };
- /***/ }),
- /* 287 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- var defineProperty = Object.defineProperty;
- module.exports = function (key, value) {
- try {
- defineProperty(global, key, { value: value, configurable: true, writable: true });
- } catch (error) {
- global[key] = value;
- } return value;
- };
- /***/ }),
- /* 288 */
- /***/ (function(module, exports, __webpack_require__) {
- var isCallable = __webpack_require__(8);
- var $String = String;
- var $TypeError = TypeError;
- module.exports = function (argument) {
- if (typeof argument == 'object' || isCallable(argument)) return argument;
- throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
- };
- /***/ }),
- /* 289 */
- /***/ (function(module, exports, __webpack_require__) {
- var hasOwn = __webpack_require__(13);
- var ownKeys = __webpack_require__(162);
- var getOwnPropertyDescriptorModule = __webpack_require__(62);
- var definePropertyModule = __webpack_require__(23);
- module.exports = function (target, source, exceptions) {
- var keys = ownKeys(source);
- var defineProperty = definePropertyModule.f;
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- }
- };
- /***/ }),
- /* 290 */
- /***/ (function(module, exports) {
- var ceil = Math.ceil;
- var floor = Math.floor;
- // `Math.trunc` method
- // https://tc39.es/ecma262/#sec-math.trunc
- // eslint-disable-next-line es-x/no-math-trunc -- safe
- module.exports = Math.trunc || function trunc(x) {
- var n = +x;
- return (n > 0 ? floor : ceil)(n);
- };
- /***/ }),
- /* 291 */
- /***/ (function(module, exports, __webpack_require__) {
- var toIntegerOrInfinity = __webpack_require__(126);
- var min = Math.min;
- // `ToLength` abstract operation
- // https://tc39.es/ecma262/#sec-tolength
- module.exports = function (argument) {
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
- };
- /***/ }),
- /* 292 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var $Error = Error;
- var replace = uncurryThis(''.replace);
- var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
- var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
- var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
- module.exports = function (stack, dropEntries) {
- if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
- while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
- } return stack;
- };
- /***/ }),
- /* 293 */
- /***/ (function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(11);
- var createNonEnumerableProperty = __webpack_require__(37);
- // `InstallErrorCause` abstract operation
- // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
- module.exports = function (O, options) {
- if (isObject(options) && 'cause' in options) {
- createNonEnumerableProperty(O, 'cause', options.cause);
- }
- };
- /***/ }),
- /* 294 */
- /***/ (function(module, exports, __webpack_require__) {
- var toString = __webpack_require__(81);
- module.exports = function (argument, $default) {
- return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
- };
- /***/ }),
- /* 295 */
- /***/ (function(module, exports, __webpack_require__) {
- var fails = __webpack_require__(2);
- var createPropertyDescriptor = __webpack_require__(47);
- module.exports = !fails(function () {
- var error = Error('a');
- if (!('stack' in error)) return true;
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
- return error.stack !== 7;
- });
- /***/ }),
- /* 296 */
- /***/ (function(module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(14);
- var hasOwn = __webpack_require__(13);
- var FunctionPrototype = Function.prototype;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
- var EXISTS = hasOwn(FunctionPrototype, 'name');
- // additional protection from minified / mangled / dropped function names
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
- module.exports = {
- EXISTS: EXISTS,
- PROPER: PROPER,
- CONFIGURABLE: CONFIGURABLE
- };
- /***/ }),
- /* 297 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var IteratorPrototype = __webpack_require__(171).IteratorPrototype;
- var create = __webpack_require__(49);
- var createPropertyDescriptor = __webpack_require__(47);
- var setToStringTag = __webpack_require__(52);
- var Iterators = __webpack_require__(50);
- var returnThis = function () { return this; };
- module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
- var TO_STRING_TAG = NAME + ' Iterator';
- IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
- setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
- Iterators[TO_STRING_TAG] = returnThis;
- return IteratorConstructor;
- };
- /***/ }),
- /* 298 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
- var classof = __webpack_require__(51);
- // `Object.prototype.toString` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
- module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
- return '[object ' + classof(this) + ']';
- };
- /***/ }),
- /* 299 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove this module from `core-js@4` since it's split to modules listed below
- __webpack_require__(300);
- __webpack_require__(308);
- __webpack_require__(309);
- __webpack_require__(310);
- __webpack_require__(311);
- __webpack_require__(312);
- /***/ }),
- /* 300 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var IS_PURE = __webpack_require__(33);
- var IS_NODE = __webpack_require__(107);
- var global = __webpack_require__(7);
- var call = __webpack_require__(15);
- var defineBuiltIn = __webpack_require__(44);
- var setPrototypeOf = __webpack_require__(102);
- var setToStringTag = __webpack_require__(52);
- var setSpecies = __webpack_require__(172);
- var aCallable = __webpack_require__(31);
- var isCallable = __webpack_require__(8);
- var isObject = __webpack_require__(11);
- var anInstance = __webpack_require__(108);
- var speciesConstructor = __webpack_require__(173);
- var task = __webpack_require__(175).set;
- var microtask = __webpack_require__(302);
- var hostReportErrors = __webpack_require__(305);
- var perform = __webpack_require__(82);
- var Queue = __webpack_require__(306);
- var InternalStateModule = __webpack_require__(43);
- var NativePromiseConstructor = __webpack_require__(65);
- var PromiseConstructorDetection = __webpack_require__(83);
- var newPromiseCapabilityModule = __webpack_require__(54);
- var PROMISE = 'Promise';
- var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
- var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
- var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
- var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
- var setInternalState = InternalStateModule.set;
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- var PromiseConstructor = NativePromiseConstructor;
- var PromisePrototype = NativePromisePrototype;
- var TypeError = global.TypeError;
- var document = global.document;
- var process = global.process;
- var newPromiseCapability = newPromiseCapabilityModule.f;
- var newGenericPromiseCapability = newPromiseCapability;
- var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
- var UNHANDLED_REJECTION = 'unhandledrejection';
- var REJECTION_HANDLED = 'rejectionhandled';
- var PENDING = 0;
- var FULFILLED = 1;
- var REJECTED = 2;
- var HANDLED = 1;
- var UNHANDLED = 2;
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
- // helpers
- var isThenable = function (it) {
- var then;
- return isObject(it) && isCallable(then = it.then) ? then : false;
- };
- var callReaction = function (reaction, state) {
- var value = state.value;
- var ok = state.state == FULFILLED;
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
- state.rejection = HANDLED;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // can throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- call(then, result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (error) {
- if (domain && !exited) domain.exit();
- reject(error);
- }
- };
- var notify = function (state, isReject) {
- if (state.notified) return;
- state.notified = true;
- microtask(function () {
- var reactions = state.reactions;
- var reaction;
- while (reaction = reactions.get()) {
- callReaction(reaction, state);
- }
- state.notified = false;
- if (isReject && !state.rejection) onUnhandled(state);
- });
- };
- var dispatchEvent = function (name, promise, reason) {
- var event, handler;
- if (DISPATCH_EVENT) {
- event = document.createEvent('Event');
- event.promise = promise;
- event.reason = reason;
- event.initEvent(name, false, true);
- global.dispatchEvent(event);
- } else event = { promise: promise, reason: reason };
- if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
- };
- var onUnhandled = function (state) {
- call(task, global, function () {
- var promise = state.facade;
- var value = state.value;
- var IS_UNHANDLED = isUnhandled(state);
- var result;
- if (IS_UNHANDLED) {
- result = perform(function () {
- if (IS_NODE) {
- process.emit('unhandledRejection', value, promise);
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
- if (result.error) throw result.value;
- }
- });
- };
- var isUnhandled = function (state) {
- return state.rejection !== HANDLED && !state.parent;
- };
- var onHandleUnhandled = function (state) {
- call(task, global, function () {
- var promise = state.facade;
- if (IS_NODE) {
- process.emit('rejectionHandled', promise);
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
- });
- };
- var bind = function (fn, state, unwrap) {
- return function (value) {
- fn(state, value, unwrap);
- };
- };
- var internalReject = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- state.value = value;
- state.state = REJECTED;
- notify(state, true);
- };
- var internalResolve = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- try {
- if (state.facade === value) throw TypeError("Promise can't be resolved itself");
- var then = isThenable(value);
- if (then) {
- microtask(function () {
- var wrapper = { done: false };
- try {
- call(then, value,
- bind(internalResolve, wrapper, state),
- bind(internalReject, wrapper, state)
- );
- } catch (error) {
- internalReject(wrapper, error, state);
- }
- });
- } else {
- state.value = value;
- state.state = FULFILLED;
- notify(state, false);
- }
- } catch (error) {
- internalReject({ done: false }, error, state);
- }
- };
- // constructor polyfill
- if (FORCED_PROMISE_CONSTRUCTOR) {
- // 25.4.3.1 Promise(executor)
- PromiseConstructor = function Promise(executor) {
- anInstance(this, PromisePrototype);
- aCallable(executor);
- call(Internal, this);
- var state = getInternalPromiseState(this);
- try {
- executor(bind(internalResolve, state), bind(internalReject, state));
- } catch (error) {
- internalReject(state, error);
- }
- };
- PromisePrototype = PromiseConstructor.prototype;
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- Internal = function Promise(executor) {
- setInternalState(this, {
- type: PROMISE,
- done: false,
- notified: false,
- parent: false,
- reactions: new Queue(),
- rejection: false,
- state: PENDING,
- value: undefined
- });
- };
- // `Promise.prototype.then` method
- // https://tc39.es/ecma262/#sec-promise.prototype.then
- Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
- var state = getInternalPromiseState(this);
- var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
- state.parent = true;
- reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
- reaction.fail = isCallable(onRejected) && onRejected;
- reaction.domain = IS_NODE ? process.domain : undefined;
- if (state.state == PENDING) state.reactions.add(reaction);
- else microtask(function () {
- callReaction(reaction, state);
- });
- return reaction.promise;
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- var state = getInternalPromiseState(promise);
- this.promise = promise;
- this.resolve = bind(internalResolve, state);
- this.reject = bind(internalReject, state);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
- return C === PromiseConstructor || C === PromiseWrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
- nativeThen = NativePromisePrototype.then;
- if (!NATIVE_PROMISE_SUBCLASSING) {
- // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
- defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
- var that = this;
- return new PromiseConstructor(function (resolve, reject) {
- call(nativeThen, that, resolve, reject);
- }).then(onFulfilled, onRejected);
- // https://github.com/zloirock/core-js/issues/640
- }, { unsafe: true });
- }
- // make `.constructor === Promise` work for native promise-based APIs
- try {
- delete NativePromisePrototype.constructor;
- } catch (error) { /* empty */ }
- // make `instanceof Promise` work for native promise-based APIs
- if (setPrototypeOf) {
- setPrototypeOf(NativePromisePrototype, PromisePrototype);
- }
- }
- }
- $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
- Promise: PromiseConstructor
- });
- setToStringTag(PromiseConstructor, PROMISE, false, true);
- setSpecies(PROMISE);
- /***/ }),
- /* 301 */
- /***/ (function(module, exports) {
- var $TypeError = TypeError;
- module.exports = function (passed, required) {
- if (passed < required) throw $TypeError('Not enough arguments');
- return passed;
- };
- /***/ }),
- /* 302 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var bind = __webpack_require__(48);
- var getOwnPropertyDescriptor = __webpack_require__(62).f;
- var macrotask = __webpack_require__(175).set;
- var IS_IOS = __webpack_require__(176);
- var IS_IOS_PEBBLE = __webpack_require__(303);
- var IS_WEBOS_WEBKIT = __webpack_require__(304);
- var IS_NODE = __webpack_require__(107);
- var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
- var document = global.document;
- var process = global.process;
- var Promise = global.Promise;
- // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
- var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
- var flush, head, last, notify, toggle, node, promise, then;
- // modern engines have queueMicrotask method
- if (!queueMicrotask) {
- flush = function () {
- var parent, fn;
- if (IS_NODE && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (error) {
- if (head) notify();
- else last = undefined;
- throw error;
- }
- } last = undefined;
- if (parent) parent.enter();
- };
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
- if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
- toggle = true;
- node = document.createTextNode('');
- new MutationObserver(flush).observe(node, { characterData: true });
- notify = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- promise = Promise.resolve(undefined);
- // workaround of WebKit ~ iOS Safari 10.1 bug
- promise.constructor = Promise;
- then = bind(promise.then, promise);
- notify = function () {
- then(flush);
- };
- // Node.js without promises
- } else if (IS_NODE) {
- notify = function () {
- process.nextTick(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessage
- // - onreadystatechange
- // - setTimeout
- } else {
- // strange IE + webpack dev server bug - use .bind(global)
- macrotask = bind(macrotask, global);
- notify = function () {
- macrotask(flush);
- };
- }
- }
- module.exports = queueMicrotask || function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- } last = task;
- };
- /***/ }),
- /* 303 */
- /***/ (function(module, exports, __webpack_require__) {
- var userAgent = __webpack_require__(98);
- var global = __webpack_require__(7);
- module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
- /***/ }),
- /* 304 */
- /***/ (function(module, exports, __webpack_require__) {
- var userAgent = __webpack_require__(98);
- module.exports = /web0s(?!.*chrome)/i.test(userAgent);
- /***/ }),
- /* 305 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- module.exports = function (a, b) {
- var console = global.console;
- if (console && console.error) {
- arguments.length == 1 ? console.error(a) : console.error(a, b);
- }
- };
- /***/ }),
- /* 306 */
- /***/ (function(module, exports) {
- var Queue = function () {
- this.head = null;
- this.tail = null;
- };
- Queue.prototype = {
- add: function (item) {
- var entry = { item: item, next: null };
- if (this.head) this.tail.next = entry;
- else this.head = entry;
- this.tail = entry;
- },
- get: function () {
- var entry = this.head;
- if (entry) {
- this.head = entry.next;
- if (this.tail === entry) this.tail = null;
- return entry.item;
- }
- }
- };
- module.exports = Queue;
- /***/ }),
- /* 307 */
- /***/ (function(module, exports) {
- module.exports = typeof window == 'object' && typeof Deno != 'object';
- /***/ }),
- /* 308 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var call = __webpack_require__(15);
- var aCallable = __webpack_require__(31);
- var newPromiseCapabilityModule = __webpack_require__(54);
- var perform = __webpack_require__(82);
- var iterate = __webpack_require__(42);
- var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
- // `Promise.all` method
- // https://tc39.es/ecma262/#sec-promise.all
- $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapabilityModule.f(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aCallable(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- remaining++;
- call($promiseResolve, C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- /***/ }),
- /* 309 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var IS_PURE = __webpack_require__(33);
- var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
- var NativePromiseConstructor = __webpack_require__(65);
- var getBuiltIn = __webpack_require__(18);
- var isCallable = __webpack_require__(8);
- var defineBuiltIn = __webpack_require__(44);
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- // `Promise.prototype.catch` method
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
- $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
- 'catch': function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
- if (!IS_PURE && isCallable(NativePromiseConstructor)) {
- var method = getBuiltIn('Promise').prototype['catch'];
- if (NativePromisePrototype['catch'] !== method) {
- defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
- }
- }
- /***/ }),
- /* 310 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var call = __webpack_require__(15);
- var aCallable = __webpack_require__(31);
- var newPromiseCapabilityModule = __webpack_require__(54);
- var perform = __webpack_require__(82);
- var iterate = __webpack_require__(42);
- var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
- // `Promise.race` method
- // https://tc39.es/ecma262/#sec-promise.race
- $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapabilityModule.f(C);
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aCallable(C.resolve);
- iterate(iterable, function (promise) {
- call($promiseResolve, C, promise).then(capability.resolve, reject);
- });
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- /***/ }),
- /* 311 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var call = __webpack_require__(15);
- var newPromiseCapabilityModule = __webpack_require__(54);
- var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
- // `Promise.reject` method
- // https://tc39.es/ecma262/#sec-promise.reject
- $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
- reject: function reject(r) {
- var capability = newPromiseCapabilityModule.f(this);
- call(capability.reject, undefined, r);
- return capability.promise;
- }
- });
- /***/ }),
- /* 312 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var getBuiltIn = __webpack_require__(18);
- var IS_PURE = __webpack_require__(33);
- var NativePromiseConstructor = __webpack_require__(65);
- var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
- var promiseResolve = __webpack_require__(179);
- var PromiseConstructorWrapper = getBuiltIn('Promise');
- var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
- // `Promise.resolve` method
- // https://tc39.es/ecma262/#sec-promise.resolve
- $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
- resolve: function resolve(x) {
- return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
- }
- });
- /***/ }),
- /* 313 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var call = __webpack_require__(15);
- var aCallable = __webpack_require__(31);
- var newPromiseCapabilityModule = __webpack_require__(54);
- var perform = __webpack_require__(82);
- var iterate = __webpack_require__(42);
- // `Promise.allSettled` method
- // https://tc39.es/ecma262/#sec-promise.allsettled
- $({ target: 'Promise', stat: true }, {
- allSettled: function allSettled(iterable) {
- var C = this;
- var capability = newPromiseCapabilityModule.f(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var promiseResolve = aCallable(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- remaining++;
- call(promiseResolve, C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = { status: 'fulfilled', value: value };
- --remaining || resolve(values);
- }, function (error) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = { status: 'rejected', reason: error };
- --remaining || resolve(values);
- });
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- /***/ }),
- /* 314 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var call = __webpack_require__(15);
- var aCallable = __webpack_require__(31);
- var getBuiltIn = __webpack_require__(18);
- var newPromiseCapabilityModule = __webpack_require__(54);
- var perform = __webpack_require__(82);
- var iterate = __webpack_require__(42);
- var PROMISE_ANY_ERROR = 'No one promise resolved';
- // `Promise.any` method
- // https://tc39.es/ecma262/#sec-promise.any
- $({ target: 'Promise', stat: true }, {
- any: function any(iterable) {
- var C = this;
- var AggregateError = getBuiltIn('AggregateError');
- var capability = newPromiseCapabilityModule.f(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var promiseResolve = aCallable(C.resolve);
- var errors = [];
- var counter = 0;
- var remaining = 1;
- var alreadyResolved = false;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyRejected = false;
- remaining++;
- call(promiseResolve, C, promise).then(function (value) {
- if (alreadyRejected || alreadyResolved) return;
- alreadyResolved = true;
- resolve(value);
- }, function (error) {
- if (alreadyRejected || alreadyResolved) return;
- alreadyRejected = true;
- errors[index] = error;
- --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
- });
- });
- --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- /***/ }),
- /* 315 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var IS_PURE = __webpack_require__(33);
- var NativePromiseConstructor = __webpack_require__(65);
- var fails = __webpack_require__(2);
- var getBuiltIn = __webpack_require__(18);
- var isCallable = __webpack_require__(8);
- var speciesConstructor = __webpack_require__(173);
- var promiseResolve = __webpack_require__(179);
- var defineBuiltIn = __webpack_require__(44);
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
- var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
- // eslint-disable-next-line unicorn/no-thenable -- required for testing
- NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
- });
- // `Promise.prototype.finally` method
- // https://tc39.es/ecma262/#sec-promise.prototype.finally
- $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
- 'finally': function (onFinally) {
- var C = speciesConstructor(this, getBuiltIn('Promise'));
- var isFunction = isCallable(onFinally);
- return this.then(
- isFunction ? function (x) {
- return promiseResolve(C, onFinally()).then(function () { return x; });
- } : onFinally,
- isFunction ? function (e) {
- return promiseResolve(C, onFinally()).then(function () { throw e; });
- } : onFinally
- );
- }
- });
- // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
- if (!IS_PURE && isCallable(NativePromiseConstructor)) {
- var method = getBuiltIn('Promise').prototype['finally'];
- if (NativePromisePrototype['finally'] !== method) {
- defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
- }
- }
- /***/ }),
- /* 316 */
- /***/ (function(module, exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(4);
- var toIntegerOrInfinity = __webpack_require__(126);
- var toString = __webpack_require__(81);
- var requireObjectCoercible = __webpack_require__(121);
- var charAt = uncurryThis(''.charAt);
- var charCodeAt = uncurryThis(''.charCodeAt);
- var stringSlice = uncurryThis(''.slice);
- var createMethod = function (CONVERT_TO_STRING) {
- return function ($this, pos) {
- var S = toString(requireObjectCoercible($this));
- var position = toIntegerOrInfinity(pos);
- var size = S.length;
- var first, second;
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
- first = charCodeAt(S, position);
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
- || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
- ? CONVERT_TO_STRING
- ? charAt(S, position)
- : first
- : CONVERT_TO_STRING
- ? stringSlice(S, position, position + 2)
- : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
- };
- };
- module.exports = {
- // `String.prototype.codePointAt` method
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
- codeAt: createMethod(false),
- // `String.prototype.at` method
- // https://github.com/mathiasbynens/String.prototype.at
- charAt: createMethod(true)
- };
- /***/ }),
- /* 317 */
- /***/ (function(module, exports) {
- // iterable DOM collections
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
- module.exports = {
- CSSRuleList: 0,
- CSSStyleDeclaration: 0,
- CSSValueList: 0,
- ClientRectList: 0,
- DOMRectList: 0,
- DOMStringList: 0,
- DOMTokenList: 1,
- DataTransferItemList: 0,
- FileList: 0,
- HTMLAllCollection: 0,
- HTMLCollection: 0,
- HTMLFormElement: 0,
- HTMLSelectElement: 0,
- MediaList: 0,
- MimeTypeArray: 0,
- NamedNodeMap: 0,
- NodeList: 1,
- PaintRequestList: 0,
- Plugin: 0,
- PluginArray: 0,
- SVGLengthList: 0,
- SVGNumberList: 0,
- SVGPathSegList: 0,
- SVGPointList: 0,
- SVGStringList: 0,
- SVGTransformList: 0,
- SourceBufferList: 0,
- StyleSheetList: 0,
- TextTrackCueList: 0,
- TextTrackList: 0,
- TouchList: 0
- };
- /***/ }),
- /* 318 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(132);
- // Default Export
- // ==============
- // In this module, we mix our bundled exports into the `_` object and export
- // the result. This is analogous to setting `module.exports = _` in CommonJS.
- // Hence, this module is also the entry point of our UMD bundle and the package
- // entry point for CommonJS and AMD users. In other words, this is (the source
- // of) the module you are interfacing with when you do any of the following:
- //
- // ```js
- // // CommonJS
- // var _ = require('underscore');
- //
- // // AMD
- // define(['underscore'], function(_) {...});
- //
- // // UMD in the browser
- // // _ is available as a global variable
- // ```
- // Add all of the Underscore functions to the wrapper object.
- var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
- // Legacy Node.js API.
- _._ = _;
- // Export the Underscore API.
- /* harmony default export */ __webpack_exports__["a"] = (_);
- /***/ }),
- /* 319 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
- // Is a given value equal to null?
- function isNull(obj) {
- return obj === null;
- }
- /***/ }),
- /* 320 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
- // Is a given value a DOM element?
- function isElement(obj) {
- return !!(obj && obj.nodeType === 1);
- }
- /***/ }),
- /* 321 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
- /***/ }),
- /* 322 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
- /***/ }),
- /* 323 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
- /***/ }),
- /* 324 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
- /***/ }),
- /* 325 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(183);
- // Is a given object a finite number?
- function isFinite(obj) {
- return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
- }
- /***/ }),
- /* 326 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(136);
- // Internal helper to determine whether we should spend extensive checks against
- // `ArrayBuffer` et al.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
- /***/ }),
- /* 327 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(16);
- // Is a given array, string, or object empty?
- // An "empty" object has no enumerable own-properties.
- function isEmpty(obj) {
- if (obj == null) return true;
- // Skip the more expensive `toString`-based type checks if `obj` has no
- // `.length`.
- var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
- if (typeof length == 'number' && (
- Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(obj)
- )) return length === 0;
- return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
- }
- /***/ }),
- /* 328 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(136);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(186);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(84);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(134);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(16);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(45);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(329);
- // We use this string twice, so give it a name for minification.
- var tagDataView = '[object DataView]';
- // Internal recursive comparison function for `_.isEqual`.
- function eq(a, b, aStack, bStack) {
- // Identical objects are equal. `0 === -0`, but they aren't identical.
- // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
- if (a === b) return a !== 0 || 1 / a === 1 / b;
- // `null` or `undefined` only equal to itself (strict comparison).
- if (a == null || b == null) return false;
- // `NaN`s are equivalent, but non-reflexive.
- if (a !== a) return b !== b;
- // Exhaust primitive checks
- var type = typeof a;
- if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
- return deepEq(a, b, aStack, bStack);
- }
- // Internal recursive comparison function for `_.isEqual`.
- function deepEq(a, b, aStack, bStack) {
- // Unwrap any wrapped objects.
- if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
- if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
- // Compare `[[Class]]` names.
- var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
- if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
- // Work around a bug in IE 10 - Edge 13.
- if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
- className = tagDataView;
- }
- switch (className) {
- // These types are compared by value.
- case '[object RegExp]':
- // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return '' + a === '' + b;
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive.
- // Object(NaN) is equivalent to NaN.
- if (+a !== +a) return +b !== +b;
- // An `egal` comparison is performed for other numeric values.
- return +a === 0 ? 1 / +a === 1 / b : +a === +b;
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a === +b;
- case '[object Symbol]':
- return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
- case '[object ArrayBuffer]':
- case tagDataView:
- // Coerce to typed array so we can fall through.
- return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
- }
- var areArrays = className === '[object Array]';
- if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
- var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
- if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
- if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
- areArrays = true;
- }
- if (!areArrays) {
- if (typeof a != 'object' || typeof b != 'object') return false;
- // Objects with different constructors are not equivalent, but `Object`s or `Array`s
- // from different frames are.
- var aCtor = a.constructor, bCtor = b.constructor;
- if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
- Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
- && ('constructor' in a && 'constructor' in b)) {
- return false;
- }
- }
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- // Initializing stack of traversed objects.
- // It's done here since we only need them for objects and arrays comparison.
- aStack = aStack || [];
- bStack = bStack || [];
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (aStack[length] === a) return bStack[length] === b;
- }
- // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- // Recursively compare objects and arrays.
- if (areArrays) {
- // Compare array lengths to determine if a deep comparison is necessary.
- length = a.length;
- if (length !== b.length) return false;
- // Deep compare the contents, ignoring non-numeric properties.
- while (length--) {
- if (!eq(a[length], b[length], aStack, bStack)) return false;
- }
- } else {
- // Deep compare objects.
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
- length = _keys.length;
- // Ensure that both objects contain the same number of properties before comparing deep equality.
- if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
- while (length--) {
- // Deep compare each member
- key = _keys[length];
- if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
- }
- }
- // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
- return true;
- }
- // Perform a deep comparison to check if two objects are equal.
- function isEqual(a, b) {
- return eq(a, b);
- }
- /***/ }),
- /* 329 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(136);
- // Internal function to wrap or shallow-copy an ArrayBuffer,
- // typed array or DataView to a new view, reusing the buffer.
- function toBufferView(bufferSource) {
- return new Uint8Array(
- bufferSource.buffer || bufferSource,
- bufferSource.byteOffset || 0,
- Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
- );
- }
- /***/ }),
- /* 330 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["b" /* mapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Map'));
- /***/ }),
- /* 331 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["d" /* weakMapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakMap'));
- /***/ }),
- /* 332 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["c" /* setMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Set'));
- /***/ }),
- /* 333 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
- /***/ }),
- /* 334 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
- // Convert an object into a list of `[key, value]` pairs.
- // The opposite of `_.object` with one argument.
- function pairs(obj) {
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
- var length = _keys.length;
- var pairs = Array(length);
- for (var i = 0; i < length; i++) {
- pairs[i] = [_keys[i], obj[_keys[i]]];
- }
- return pairs;
- }
- /***/ }),
- /* 335 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = create;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(139);
- // Creates an object that inherits from the given prototype object.
- // If additional properties are provided then they will be added to the
- // created object.
- function create(prototype, props) {
- var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
- if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
- return result;
- }
- /***/ }),
- /* 336 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = tap;
- // Invokes `interceptor` with the `obj` and then returns `obj`.
- // The primary purpose of this method is to "tap into" a method chain, in
- // order to perform operations on intermediate results within the chain.
- function tap(obj, interceptor) {
- interceptor(obj);
- return obj;
- }
- /***/ }),
- /* 337 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = has;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
- // Shortcut function for checking if an object has a given property directly on
- // itself (in other words, not on a prototype). Unlike the internal `has`
- // function, this public version can also traverse nested properties.
- function has(obj, path) {
- path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
- var length = path.length;
- for (var i = 0; i < length; i++) {
- var key = path[i];
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
- obj = obj[key];
- }
- return !!length;
- }
- /***/ }),
- /* 338 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
- // Returns the results of applying the `iteratee` to each element of `obj`.
- // In contrast to `_.map` it returns an object.
- function mapObject(obj, iteratee, context) {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
- var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
- length = _keys.length,
- results = {};
- for (var index = 0; index < length; index++) {
- var currentKey = _keys[index];
- results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
- }
- return results;
- }
- /***/ }),
- /* 339 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(202);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(198);
- // Generates a function for a given object that returns a given property.
- function propertyOf(obj) {
- if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
- return function(path) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
- };
- }
- /***/ }),
- /* 340 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = times;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
- // Run a function **n** times.
- function times(n, iteratee, context) {
- var accum = Array(Math.max(0, n));
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
- for (var i = 0; i < n; i++) accum[i] = iteratee(i);
- return accum;
- }
- /***/ }),
- /* 341 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
- // Function for escaping strings to HTML interpolation.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
- /***/ }),
- /* 342 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(343);
- // Function for unescaping strings from HTML interpolation.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
- /***/ }),
- /* 343 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(192);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
- // Internal list of HTML entities for unescaping.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
- /***/ }),
- /* 344 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = template;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(195);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(206);
- // When customizing `_.templateSettings`, if you don't want to define an
- // interpolation, evaluation or escaping regex, we need one that is
- // guaranteed not to match.
- var noMatch = /(.)^/;
- // Certain characters need to be escaped so that they can be put into a
- // string literal.
- var escapes = {
- "'": "'",
- '\\': '\\',
- '\r': 'r',
- '\n': 'n',
- '\u2028': 'u2028',
- '\u2029': 'u2029'
- };
- var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
- function escapeChar(match) {
- return '\\' + escapes[match];
- }
- var bareIdentifier = /^\s*(\w|\$)+\s*$/;
- // JavaScript micro-templating, similar to John Resig's implementation.
- // Underscore templating handles arbitrary delimiters, preserves whitespace,
- // and correctly escapes quotes within interpolated code.
- // NB: `oldSettings` only exists for backwards compatibility.
- function template(text, settings, oldSettings) {
- if (!settings && oldSettings) settings = oldSettings;
- settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
- // Combine delimiters into one regular expression via alternation.
- var matcher = RegExp([
- (settings.escape || noMatch).source,
- (settings.interpolate || noMatch).source,
- (settings.evaluate || noMatch).source
- ].join('|') + '|$', 'g');
- // Compile the template source, escaping string literals appropriately.
- var index = 0;
- var source = "__p+='";
- text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
- source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
- index = offset + match.length;
- if (escape) {
- source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
- } else if (interpolate) {
- source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
- } else if (evaluate) {
- source += "';\n" + evaluate + "\n__p+='";
- }
- // Adobe VMs need the match returned to produce the correct offset.
- return match;
- });
- source += "';\n";
- var argument = settings.variable;
- if (argument) {
- if (!bareIdentifier.test(argument)) throw new Error(argument);
- } else {
- // If a variable is not specified, place data values in local scope.
- source = 'with(obj||{}){\n' + source + '}\n';
- argument = 'obj';
- }
- source = "var __t,__p='',__j=Array.prototype.join," +
- "print=function(){__p+=__j.call(arguments,'');};\n" +
- source + 'return __p;\n';
- var render;
- try {
- render = new Function(argument, '_', source);
- } catch (e) {
- e.source = source;
- throw e;
- }
- var template = function(data) {
- return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
- };
- // Provide the compiled source as a convenience for precompilation.
- template.source = 'function(' + argument + '){\n' + source + '}';
- return template;
- }
- /***/ }),
- /* 345 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = result;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
- // Traverses the children of `obj` along `path`. If a child is a function, it
- // is invoked with its parent as context. Returns the value of the final
- // child, or `fallback` if any child is undefined.
- function result(obj, path, fallback) {
- path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
- var length = path.length;
- if (!length) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
- }
- for (var i = 0; i < length; i++) {
- var prop = obj == null ? void 0 : obj[path[i]];
- if (prop === void 0) {
- prop = fallback;
- i = length; // Ensure we don't continue iterating.
- }
- obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
- }
- return obj;
- }
- /***/ }),
- /* 346 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
- // Generate a unique integer id (unique within the entire client session).
- // Useful for temporary DOM ids.
- var idCounter = 0;
- function uniqueId(prefix) {
- var id = ++idCounter + '';
- return prefix ? prefix + id : id;
- }
- /***/ }),
- /* 347 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = chain;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- // Start chaining a wrapped Underscore object.
- function chain(obj) {
- var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
- instance._chain = true;
- return instance;
- }
- /***/ }),
- /* 348 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(208);
- // Bind a number of an object's methods to that object. Remaining arguments
- // are the method names to be bound. Useful for ensuring that all callbacks
- // defined on an object belong to it.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
- keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
- var index = keys.length;
- if (index < 1) throw new Error('bindAll must be passed function names');
- while (index--) {
- var key = keys[index];
- obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
- }
- return obj;
- }));
- /***/ }),
- /* 349 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
- // Memoize an expensive function by storing its results.
- function memoize(func, hasher) {
- var memoize = function(key) {
- var cache = memoize.cache;
- var address = '' + (hasher ? hasher.apply(this, arguments) : key);
- if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
- return cache[address];
- };
- memoize.cache = {};
- return memoize;
- }
- /***/ }),
- /* 350 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(209);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
- // Defers a function, scheduling it to run after the current call stack has
- // cleared.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__delay_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */], 1));
- /***/ }),
- /* 351 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(143);
- // Returns a function, that, when invoked, will only be triggered at most once
- // during a given window of time. Normally, the throttled function will run
- // as much as it can, without ever going more than once per `wait` duration;
- // but if you'd like to disable the execution on the leading edge, pass
- // `{leading: false}`. To disable execution on the trailing edge, ditto.
- function throttle(func, wait, options) {
- var timeout, context, args, result;
- var previous = 0;
- if (!options) options = {};
- var later = function() {
- previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
- timeout = null;
- result = func.apply(context, args);
- if (!timeout) context = args = null;
- };
- var throttled = function() {
- var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
- if (!previous && options.leading === false) previous = _now;
- var remaining = wait - (_now - previous);
- context = this;
- args = arguments;
- if (remaining <= 0 || remaining > wait) {
- if (timeout) {
- clearTimeout(timeout);
- timeout = null;
- }
- previous = _now;
- result = func.apply(context, args);
- if (!timeout) context = args = null;
- } else if (!timeout && options.trailing !== false) {
- timeout = setTimeout(later, remaining);
- }
- return result;
- };
- throttled.cancel = function() {
- clearTimeout(timeout);
- previous = 0;
- timeout = context = args = null;
- };
- return throttled;
- }
- /***/ }),
- /* 352 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(143);
- // When a sequence of calls of the returned function ends, the argument
- // function is triggered. The end of a sequence is defined by the `wait`
- // parameter. If `immediate` is passed, the argument function will be
- // triggered at the beginning of the sequence instead of at the end.
- function debounce(func, wait, immediate) {
- var timeout, previous, args, result, context;
- var later = function() {
- var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
- if (wait > passed) {
- timeout = setTimeout(later, wait - passed);
- } else {
- timeout = null;
- if (!immediate) result = func.apply(context, args);
- // This check is needed because `func` can recursively invoke `debounced`.
- if (!timeout) args = context = null;
- }
- };
- var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
- context = this;
- args = _args;
- previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
- if (!timeout) {
- timeout = setTimeout(later, wait);
- if (immediate) result = func.apply(context, args);
- }
- return result;
- });
- debounced.cancel = function() {
- clearTimeout(timeout);
- timeout = args = context = null;
- };
- return debounced;
- }
- /***/ }),
- /* 353 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
- // Returns the first function passed as an argument to the second,
- // allowing you to adjust arguments, run code before and after, and
- // conditionally execute the original function.
- function wrap(func, wrapper) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
- }
- /***/ }),
- /* 354 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = compose;
- // Returns a function that is the composition of a list of functions, each
- // consuming the return value of the function that follows.
- function compose() {
- var args = arguments;
- var start = args.length - 1;
- return function() {
- var i = start;
- var result = args[start].apply(this, arguments);
- while (i--) result = args[i].call(this, result);
- return result;
- };
- }
- /***/ }),
- /* 355 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = after;
- // Returns a function that will only be executed on and after the Nth call.
- function after(times, func) {
- return function() {
- if (--times < 1) {
- return func.apply(this, arguments);
- }
- };
- }
- /***/ }),
- /* 356 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(210);
- // Returns a function that will be executed at most one time, no matter how
- // often you call it. Useful for lazy initialization.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
- /***/ }),
- /* 357 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(213);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(216);
- // Return the position of the last occurrence of an item in an array,
- // or -1 if the item is not included in the array.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
- /***/ }),
- /* 358 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(217);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
- // Convenience version of a common use case of `_.find`: getting the first
- // object containing specific `key:value` pairs.
- function findWhere(obj, attrs) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
- }
- /***/ }),
- /* 359 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
- // **Reduce** builds up a single result from a list of values, aka `inject`,
- // or `foldl`.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
- /***/ }),
- /* 360 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
- // The right-associative version of reduce, also known as `foldr`.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
- /***/ }),
- /* 361 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = reject;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(144);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
- // Return all the elements for which a truth test fails.
- function reject(obj, predicate, context) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__negate_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(predicate)), context);
- }
- /***/ }),
- /* 362 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = every;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
- // Determine whether all of the elements pass a truth test.
- function every(obj, predicate, context) {
- predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
- var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
- length = (_keys || obj).length;
- for (var index = 0; index < length; index++) {
- var currentKey = _keys ? _keys[index] : index;
- if (!predicate(obj[currentKey], currentKey, obj)) return false;
- }
- return true;
- }
- /***/ }),
- /* 363 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = some;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
- // Determine if at least one element in the object passes a truth test.
- function some(obj, predicate, context) {
- predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
- var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
- length = (_keys || obj).length;
- for (var index = 0; index < length; index++) {
- var currentKey = _keys ? _keys[index] : index;
- if (predicate(obj[currentKey], currentKey, obj)) return true;
- }
- return false;
- }
- /***/ }),
- /* 364 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(140);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(86);
- // Invoke a method (with arguments) on every item in a collection.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
- var contextPath, func;
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
- func = path;
- } else {
- path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
- contextPath = path.slice(0, -1);
- path = path[path.length - 1];
- }
- return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
- var method = func;
- if (!method) {
- if (contextPath && contextPath.length) {
- context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
- }
- if (context == null) return void 0;
- method = context[path];
- }
- return method == null ? method : method.apply(context, args);
- });
- }));
- /***/ }),
- /* 365 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = where;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
- // Convenience version of a common use case of `_.filter`: selecting only
- // objects containing specific `key:value` pairs.
- function where(obj, attrs) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
- }
- /***/ }),
- /* 366 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = min;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
- // Return the minimum element (or element-based computation).
- function min(obj, iteratee, context) {
- var result = Infinity, lastComputed = Infinity,
- value, computed;
- if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
- obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
- for (var i = 0, length = obj.length; i < length; i++) {
- value = obj[i];
- if (value != null && value < result) {
- result = value;
- }
- }
- } else {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
- Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
- computed = iteratee(v, index, list);
- if (computed < lastComputed || computed === Infinity && result === Infinity) {
- result = v;
- lastComputed = computed;
- }
- });
- }
- return result;
- }
- /***/ }),
- /* 367 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(220);
- // Shuffle a collection.
- function shuffle(obj) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
- }
- /***/ }),
- /* 368 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(146);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
- // Sort the object's values by a criterion produced by an iteratee.
- function sortBy(obj, iteratee, context) {
- var index = 0;
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
- return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
- return {
- value: value,
- index: index++,
- criteria: iteratee(value, key, list)
- };
- }).sort(function(left, right) {
- var a = left.criteria;
- var b = right.criteria;
- if (a !== b) {
- if (a > b || a === void 0) return 1;
- if (a < b || b === void 0) return -1;
- }
- return left.index - right.index;
- }), 'value');
- }
- /***/ }),
- /* 369 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
- // Groups the object's values by a criterion. Pass either a string attribute
- // to group by, or a function that returns the criterion.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
- if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
- }));
- /***/ }),
- /* 370 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
- // Indexes the object's values by a criterion, similar to `_.groupBy`, but for
- // when you know that your index values will be unique.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
- result[key] = value;
- }));
- /***/ }),
- /* 371 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
- // Counts instances of an object that group by a certain criterion. Pass
- // either a string attribute to count by, or a function that returns the
- // criterion.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
- if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
- }));
- /***/ }),
- /* 372 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
- // Split a collection into two arrays: one whose elements all pass the given
- // truth test, and one whose elements all do not pass the truth test.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
- result[pass ? 0 : 1].push(value);
- }, true));
- /***/ }),
- /* 373 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(57);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(68);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(141);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(66);
- // Safely create a real, live array from anything iterable.
- var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
- function toArray(obj) {
- if (!obj) return [];
- if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
- if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
- // Keep surrogate pair characters together.
- return obj.match(reStrSymbol);
- }
- if (Object(__WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__["a" /* default */])(obj)) return Object(__WEBPACK_IMPORTED_MODULE_4__map_js__["a" /* default */])(obj, __WEBPACK_IMPORTED_MODULE_5__identity_js__["a" /* default */]);
- return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
- }
- /***/ }),
- /* 374 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = size;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
- // Return the number of elements in a collection.
- function size(obj) {
- if (obj == null) return 0;
- return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
- }
- /***/ }),
- /* 375 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
- // Internal `_.pick` helper function to determine whether `key` is an enumerable
- // property name of `obj`.
- function keyInObj(value, key, obj) {
- return key in obj;
- }
- /***/ }),
- /* 376 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(144);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(68);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(67);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(89);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(221);
- // Return a copy of the object without the disallowed properties.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
- var iteratee = keys[0], context;
- if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
- iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
- if (keys.length > 1) context = keys[1];
- } else {
- keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
- iteratee = function(value, key) {
- return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
- };
- }
- return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
- }));
- /***/ }),
- /* 377 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = first;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(222);
- // Get the first element of an array. Passing **n** will return the first N
- // values in the array. The **guard** check allows it to work with `_.map`.
- function first(array, n, guard) {
- if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
- if (n == null || guard) return array[0];
- return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
- }
- /***/ }),
- /* 378 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = last;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(223);
- // Get the last element of an array. Passing **n** will return the last N
- // values in the array.
- function last(array, n, guard) {
- if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
- if (n == null || guard) return array[array.length - 1];
- return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
- }
- /***/ }),
- /* 379 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = compact;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
- // Trim out all falsy values from an array.
- function compact(array) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
- }
- /***/ }),
- /* 380 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(67);
- // Flatten out an array, either recursively (by default), or up to `depth`.
- // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
- function flatten(array, depth) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
- }
- /***/ }),
- /* 381 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(224);
- // Return a version of the array that does not contain the specified value(s).
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
- }));
- /***/ }),
- /* 382 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(225);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(67);
- // Produce an array that contains the union: each distinct element from all of
- // the passed-in arrays.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
- }));
- /***/ }),
- /* 383 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(89);
- // Produce an array that contains every item shared between all the
- // passed-in arrays.
- function intersection(array) {
- var result = [];
- var argsLength = arguments.length;
- for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
- var item = array[i];
- if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
- var j;
- for (j = 1; j < argsLength; j++) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
- }
- if (j === argsLength) result.push(item);
- }
- return result;
- }
- /***/ }),
- /* 384 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(226);
- // Zip together multiple lists into a single array -- elements that share
- // an index go together.
- /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
- /***/ }),
- /* 385 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = object;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
- // Converts lists into objects. Pass either a single array of `[key, value]`
- // pairs, or two parallel arrays of the same length -- one of keys, and one of
- // the corresponding values. Passing by pairs is the reverse of `_.pairs`.
- function object(list, values) {
- var result = {};
- for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
- if (values) {
- result[list[i]] = values[i];
- } else {
- result[list[i][0]] = list[i][1];
- }
- }
- return result;
- }
- /***/ }),
- /* 386 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = range;
- // Generate an integer Array containing an arithmetic progression. A port of
- // the native Python `range()` function. See
- // [the Python documentation](https://docs.python.org/library/functions.html#range).
- function range(start, stop, step) {
- if (stop == null) {
- stop = start || 0;
- start = 0;
- }
- if (!step) {
- step = stop < start ? -1 : 1;
- }
- var length = Math.max(Math.ceil((stop - start) / step), 0);
- var range = Array(length);
- for (var idx = 0; idx < length; idx++, start += step) {
- range[idx] = start;
- }
- return range;
- }
- /***/ }),
- /* 387 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
- // Chunk a single array into multiple arrays, each containing `count` or fewer
- // items.
- function chunk(array, count) {
- if (count == null || count < 1) return [];
- var result = [];
- var i = 0, length = array.length;
- while (i < length) {
- result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
- }
- return result;
- }
- /***/ }),
- /* 388 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(193);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(227);
- // Add your own custom functions to the Underscore object.
- function mixin(obj) {
- Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
- var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
- __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
- var args = [this._wrapped];
- __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
- return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
- };
- });
- return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
- }
- /***/ }),
- /* 389 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(227);
- // Add all mutator `Array` functions to the wrapper.
- Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
- var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
- __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
- var obj = this._wrapped;
- if (obj != null) {
- method.apply(obj, arguments);
- if ((name === 'shift' || name === 'splice') && obj.length === 0) {
- delete obj[0];
- }
- }
- return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
- };
- });
- // Add all accessor `Array` functions to the wrapper.
- Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
- var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
- __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
- var obj = this._wrapped;
- if (obj != null) obj = method.apply(obj, arguments);
- return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
- };
- });
- /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
- /***/ }),
- /* 390 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(391);
- module.exports = parent;
- /***/ }),
- /* 391 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(392);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.concat;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
- };
- /***/ }),
- /* 392 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(228);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').concat;
- /***/ }),
- /* 393 */
- /***/ (function(module, exports) {
- var $TypeError = TypeError;
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
- module.exports = function (it) {
- if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
- return it;
- };
- /***/ }),
- /* 394 */
- /***/ (function(module, exports, __webpack_require__) {
- var isArray = __webpack_require__(90);
- var isConstructor = __webpack_require__(109);
- var isObject = __webpack_require__(11);
- var wellKnownSymbol = __webpack_require__(9);
- var SPECIES = wellKnownSymbol('species');
- var $Array = Array;
- // a part of `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray) {
- var C;
- if (isArray(originalArray)) {
- C = originalArray.constructor;
- // cross-realm fallback
- if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
- else if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- } return C === undefined ? $Array : C;
- };
- /***/ }),
- /* 395 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(396);
- module.exports = parent;
- /***/ }),
- /* 396 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(397);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.map;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
- };
- /***/ }),
- /* 397 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(398);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').map;
- /***/ }),
- /* 398 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var $map = __webpack_require__(70).map;
- var arrayMethodHasSpeciesSupport = __webpack_require__(114);
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- map: function map(callbackfn /* , thisArg */) {
- return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- /***/ }),
- /* 399 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(400);
- module.exports = parent;
- /***/ }),
- /* 400 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(401);
- var path = __webpack_require__(5);
- module.exports = path.Object.keys;
- /***/ }),
- /* 401 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var toObject = __webpack_require__(34);
- var nativeKeys = __webpack_require__(105);
- var fails = __webpack_require__(2);
- var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
- keys: function keys(it) {
- return nativeKeys(toObject(it));
- }
- });
- /***/ }),
- /* 402 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(403);
- module.exports = parent;
- /***/ }),
- /* 403 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(230);
- var path = __webpack_require__(5);
- var apply = __webpack_require__(75);
- // eslint-disable-next-line es-x/no-json -- safe
- if (!path.JSON) path.JSON = { stringify: JSON.stringify };
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- module.exports = function stringify(it, replacer, space) {
- return apply(path.JSON.stringify, null, arguments);
- };
- /***/ }),
- /* 404 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(405);
- module.exports = parent;
- /***/ }),
- /* 405 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(406);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.indexOf;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
- };
- /***/ }),
- /* 406 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(407);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').indexOf;
- /***/ }),
- /* 407 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
- var $ = __webpack_require__(0);
- var uncurryThis = __webpack_require__(4);
- var $IndexOf = __webpack_require__(164).indexOf;
- var arrayMethodIsStrict = __webpack_require__(231);
- var un$IndexOf = uncurryThis([].indexOf);
- var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
- var STRICT_METHOD = arrayMethodIsStrict('indexOf');
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
- indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
- var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
- return NEGATIVE_ZERO
- // convert -0 to +0
- ? un$IndexOf(this, searchElement, fromIndex) || 0
- : $IndexOf(this, searchElement, fromIndex);
- }
- });
- /***/ }),
- /* 408 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(39);
- var classof = __webpack_require__(51);
- var hasOwn = __webpack_require__(13);
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(409);
- var ArrayPrototype = Array.prototype;
- var DOMIterables = {
- DOMTokenList: true,
- NodeList: true
- };
- module.exports = function (it) {
- var own = it.keys;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
- || hasOwn(DOMIterables, classof(it)) ? method : own;
- };
- /***/ }),
- /* 409 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(410);
- module.exports = parent;
- /***/ }),
- /* 410 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(53);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').keys;
- /***/ }),
- /* 411 */
- /***/ (function(module, exports) {
- // Unique ID creation requires a high quality random # generator. In the
- // browser this is a little complicated due to unknown quality of Math.random()
- // and inconsistent support for the `crypto` API. We do the best we can via
- // feature-detection
- // getRandomValues needs to be invoked in a context where "this" is a Crypto
- // implementation. Also, find the complete implementation of crypto on IE11.
- var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
- (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
- if (getRandomValues) {
- // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
- var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
- module.exports = function whatwgRNG() {
- getRandomValues(rnds8);
- return rnds8;
- };
- } else {
- // Math.random()-based (RNG)
- //
- // If all else fails, use Math.random(). It's fast, but is of unspecified
- // quality.
- var rnds = new Array(16);
- module.exports = function mathRNG() {
- for (var i = 0, r; i < 16; i++) {
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
- rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
- }
- return rnds;
- };
- }
- /***/ }),
- /* 412 */
- /***/ (function(module, exports) {
- /**
- * Convert array of 16 byte values to UUID string format of the form:
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
- */
- var byteToHex = [];
- for (var i = 0; i < 256; ++i) {
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
- }
- function bytesToUuid(buf, offset) {
- var i = offset || 0;
- var bth = byteToHex;
- // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
- return ([bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]]]).join('');
- }
- module.exports = bytesToUuid;
- /***/ }),
- /* 413 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * This is the common logic for both the Node.js and web browser
- * implementations of `debug()`.
- */
- function setup(env) {
- createDebug.debug = createDebug;
- createDebug.default = createDebug;
- createDebug.coerce = coerce;
- createDebug.disable = disable;
- createDebug.enable = enable;
- createDebug.enabled = enabled;
- createDebug.humanize = __webpack_require__(414);
- Object.keys(env).forEach(function (key) {
- createDebug[key] = env[key];
- });
- /**
- * Active `debug` instances.
- */
- createDebug.instances = [];
- /**
- * The currently active debug mode names, and names to skip.
- */
- createDebug.names = [];
- createDebug.skips = [];
- /**
- * Map of special "%n" handling functions, for the debug "format" argument.
- *
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
- */
- createDebug.formatters = {};
- /**
- * Selects a color for a debug namespace
- * @param {String} namespace The namespace string for the for the debug instance to be colored
- * @return {Number|String} An ANSI color code for the given namespace
- * @api private
- */
- function selectColor(namespace) {
- var hash = 0;
- for (var i = 0; i < namespace.length; i++) {
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
- hash |= 0; // Convert to 32bit integer
- }
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
- }
- createDebug.selectColor = selectColor;
- /**
- * Create a debugger with the given `namespace`.
- *
- * @param {String} namespace
- * @return {Function}
- * @api public
- */
- function createDebug(namespace) {
- var prevTime;
- function debug() {
- // Disabled?
- if (!debug.enabled) {
- return;
- }
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var self = debug; // Set `diff` timestamp
- var curr = Number(new Date());
- var ms = curr - (prevTime || curr);
- self.diff = ms;
- self.prev = prevTime;
- self.curr = curr;
- prevTime = curr;
- args[0] = createDebug.coerce(args[0]);
- if (typeof args[0] !== 'string') {
- // Anything else let's inspect with %O
- args.unshift('%O');
- } // Apply any `formatters` transformations
- var index = 0;
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
- // If we encounter an escaped % then don't increase the array index
- if (match === '%%') {
- return match;
- }
- index++;
- var formatter = createDebug.formatters[format];
- if (typeof formatter === 'function') {
- var val = args[index];
- match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
- args.splice(index, 1);
- index--;
- }
- return match;
- }); // Apply env-specific formatting (colors, etc.)
- createDebug.formatArgs.call(self, args);
- var logFn = self.log || createDebug.log;
- logFn.apply(self, args);
- }
- debug.namespace = namespace;
- debug.enabled = createDebug.enabled(namespace);
- debug.useColors = createDebug.useColors();
- debug.color = selectColor(namespace);
- debug.destroy = destroy;
- debug.extend = extend; // Debug.formatArgs = formatArgs;
- // debug.rawLog = rawLog;
- // env-specific initialization logic for debug instances
- if (typeof createDebug.init === 'function') {
- createDebug.init(debug);
- }
- createDebug.instances.push(debug);
- return debug;
- }
- function destroy() {
- var index = createDebug.instances.indexOf(this);
- if (index !== -1) {
- createDebug.instances.splice(index, 1);
- return true;
- }
- return false;
- }
- function extend(namespace, delimiter) {
- return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
- }
- /**
- * Enables a debug mode by namespaces. This can include modes
- * separated by a colon and wildcards.
- *
- * @param {String} namespaces
- * @api public
- */
- function enable(namespaces) {
- createDebug.save(namespaces);
- createDebug.names = [];
- createDebug.skips = [];
- var i;
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
- var len = split.length;
- for (i = 0; i < len; i++) {
- if (!split[i]) {
- // ignore empty strings
- continue;
- }
- namespaces = split[i].replace(/\*/g, '.*?');
- if (namespaces[0] === '-') {
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
- } else {
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
- }
- }
- for (i = 0; i < createDebug.instances.length; i++) {
- var instance = createDebug.instances[i];
- instance.enabled = createDebug.enabled(instance.namespace);
- }
- }
- /**
- * Disable debug output.
- *
- * @api public
- */
- function disable() {
- createDebug.enable('');
- }
- /**
- * Returns true if the given mode name is enabled, false otherwise.
- *
- * @param {String} name
- * @return {Boolean}
- * @api public
- */
- function enabled(name) {
- if (name[name.length - 1] === '*') {
- return true;
- }
- var i;
- var len;
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
- if (createDebug.skips[i].test(name)) {
- return false;
- }
- }
- for (i = 0, len = createDebug.names.length; i < len; i++) {
- if (createDebug.names[i].test(name)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Coerce `val`.
- *
- * @param {Mixed} val
- * @return {Mixed}
- * @api private
- */
- function coerce(val) {
- if (val instanceof Error) {
- return val.stack || val.message;
- }
- return val;
- }
- createDebug.enable(createDebug.load());
- return createDebug;
- }
- module.exports = setup;
- /***/ }),
- /* 414 */
- /***/ (function(module, exports) {
- /**
- * Helpers.
- */
- var s = 1000;
- var m = s * 60;
- var h = m * 60;
- var d = h * 24;
- var w = d * 7;
- var y = d * 365.25;
- /**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} [options]
- * @throws {Error} throw an error if val is not a non-empty string or a number
- * @return {String|Number}
- * @api public
- */
- module.exports = function(val, options) {
- options = options || {};
- var type = typeof val;
- if (type === 'string' && val.length > 0) {
- return parse(val);
- } else if (type === 'number' && isFinite(val)) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error(
- 'val is not a non-empty string or a valid number. val=' +
- JSON.stringify(val)
- );
- };
- /**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
- function parse(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
- str
- );
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'yrs':
- case 'yr':
- case 'y':
- return n * y;
- case 'weeks':
- case 'week':
- case 'w':
- return n * w;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'hrs':
- case 'hr':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'mins':
- case 'min':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 'secs':
- case 'sec':
- case 's':
- return n * s;
- case 'milliseconds':
- case 'millisecond':
- case 'msecs':
- case 'msec':
- case 'ms':
- return n;
- default:
- return undefined;
- }
- }
- /**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtShort(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (msAbs >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (msAbs >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (msAbs >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
- }
- /**
- * Long format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtLong(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return plural(ms, msAbs, d, 'day');
- }
- if (msAbs >= h) {
- return plural(ms, msAbs, h, 'hour');
- }
- if (msAbs >= m) {
- return plural(ms, msAbs, m, 'minute');
- }
- if (msAbs >= s) {
- return plural(ms, msAbs, s, 'second');
- }
- return ms + ' ms';
- }
- /**
- * Pluralization helper.
- */
- function plural(ms, msAbs, n, name) {
- var isPlural = msAbs >= n * 1.5;
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
- }
- /***/ }),
- /* 415 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(416);
- var path = __webpack_require__(5);
- module.exports = path.Object.getPrototypeOf;
- /***/ }),
- /* 416 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var fails = __webpack_require__(2);
- var toObject = __webpack_require__(34);
- var nativeGetPrototypeOf = __webpack_require__(100);
- var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
- var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
- // `Object.getPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.getprototypeof
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
- getPrototypeOf: function getPrototypeOf(it) {
- return nativeGetPrototypeOf(toObject(it));
- }
- });
- /***/ }),
- /* 417 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(418);
- var path = __webpack_require__(5);
- module.exports = path.Object.setPrototypeOf;
- /***/ }),
- /* 418 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var setPrototypeOf = __webpack_require__(102);
- // `Object.setPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.setprototypeof
- $({ target: 'Object', stat: true }, {
- setPrototypeOf: setPrototypeOf
- });
- /***/ }),
- /* 419 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _slice = _interopRequireDefault(__webpack_require__(61));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _defineProperty = _interopRequireDefault(__webpack_require__(92));
- var AV = __webpack_require__(69);
- var AppRouter = __webpack_require__(425);
- var _require = __webpack_require__(30),
- isNullOrUndefined = _require.isNullOrUndefined;
- var _require2 = __webpack_require__(3),
- extend = _require2.extend,
- isObject = _require2.isObject,
- isEmpty = _require2.isEmpty;
- var isCNApp = function isCNApp(appId) {
- return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
- };
- var fillServerURLs = function fillServerURLs(url) {
- return {
- push: url,
- stats: url,
- engine: url,
- api: url,
- rtm: url
- };
- };
- function getDefaultServerURLs(appId) {
- var _context, _context2, _context3, _context4, _context5;
- if (isCNApp(appId)) {
- return {};
- }
- var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
- var domain = 'lncldglobal.com';
- return {
- push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
- stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
- engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
- api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
- rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
- };
- }
- var _disableAppRouter = false;
- var _initialized = false;
- /**
- * URLs for services
- * @typedef {Object} ServerURLs
- * @property {String} [api] serverURL for API service
- * @property {String} [engine] serverURL for engine service
- * @property {String} [stats] serverURL for stats service
- * @property {String} [push] serverURL for push service
- * @property {String} [rtm] serverURL for LiveQuery service
- */
- /**
- * Call this method first to set up your authentication tokens for AV.
- * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
- * @function AV.init
- * @param {Object} options
- * @param {String} options.appId application id
- * @param {String} options.appKey application key
- * @param {String} [options.masterKey] application master key
- * @param {Boolean} [options.production]
- * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
- * @param {Boolean} [options.disableCurrentUser]
- */
- AV.init = function init(options) {
- if (!isObject(options)) {
- return AV.init({
- appId: options,
- appKey: arguments.length <= 1 ? undefined : arguments[1],
- masterKey: arguments.length <= 2 ? undefined : arguments[2]
- });
- }
- var appId = options.appId,
- appKey = options.appKey,
- masterKey = options.masterKey,
- hookKey = options.hookKey,
- serverURL = options.serverURL,
- _options$serverURLs = options.serverURLs,
- serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
- disableCurrentUser = options.disableCurrentUser,
- production = options.production,
- realtime = options.realtime;
- if (_initialized) console.warn('Initializing LeanCloud Storage SDK which has already been initialized. Reinitializing the SDK might cause problems like unexpected cross-app data writing and invalid relations.');
- if (!appId) throw new TypeError('appId must be a string');
- if (!appKey) throw new TypeError('appKey must be a string');
- if ("Weapp" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
- if (isCNApp(appId)) {
- if (!serverURLs && isEmpty(AV._config.serverURLs)) {
- throw new TypeError("serverURL option is required for apps from CN region");
- }
- }
- if (appId !== AV._config.applicationId) {
- // overwrite all keys when reinitializing as a new app
- AV._config.masterKey = masterKey;
- AV._config.hookKey = hookKey;
- } else {
- if (masterKey) AV._config.masterKey = masterKey;
- if (hookKey) AV._config.hookKey = hookKey;
- }
- AV._config.applicationId = appId;
- AV._config.applicationKey = appKey;
- if (!isNullOrUndefined(production)) {
- AV.setProduction(production);
- }
- if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
- var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
- if (!disableAppRouter) {
- AV._appRouter = new AppRouter(AV);
- }
- AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
- if (realtime) {
- AV._config.realtime = realtime;
- } else if (AV._sharedConfig.liveQueryRealtime) {
- var _AV$_config$serverURL = AV._config.serverURLs,
- api = _AV$_config$serverURL.api,
- rtm = _AV$_config$serverURL.rtm;
- AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
- appId: appId,
- appKey: appKey,
- server: {
- api: api,
- RTMRouter: rtm
- }
- });
- }
- _initialized = true;
- }; // If we're running in node.js, allow using the master key.
- if (false) {
- AV.Cloud = AV.Cloud || {};
- /**
- * Switches the LeanCloud SDK to using the Master key. The Master key grants
- * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
- * other restrictions that are applied to the client SDKs.
- * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
- * </p>
- */
- AV.Cloud.useMasterKey = function () {
- AV._config.useMasterKey = true;
- };
- }
- /**
- * Call this method to set production environment variable.
- * @function AV.setProduction
- * @param {Boolean} production True is production environment,and
- * it's true by default.
- */
- AV.setProduction = function (production) {
- if (!isNullOrUndefined(production)) {
- AV._config.production = production ? 1 : 0;
- } else {
- // change to default value
- AV._config.production = null;
- }
- };
- AV._setServerURLs = function (urls) {
- var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- if (typeof urls !== 'string') {
- extend(AV._config.serverURLs, urls);
- } else {
- AV._config.serverURLs = fillServerURLs(urls);
- }
- if (disableAppRouter) {
- if (AV._appRouter) {
- AV._appRouter.disable();
- } else {
- _disableAppRouter = true;
- }
- }
- };
- /**
- * Set server URLs for services.
- * @function AV.setServerURL
- * @since 4.3.0
- * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
- * You can also set them when initializing SDK with `options.serverURL`
- */
- AV.setServerURL = function (urls) {
- return AV._setServerURLs(urls);
- };
- AV.setServerURLs = AV.setServerURL;
- AV.keepErrorRawMessage = function (value) {
- AV._sharedConfig.keepErrorRawMessage = value;
- };
- /**
- * Set a deadline for requests to complete.
- * Note that file upload requests are not affected.
- * @function AV.setRequestTimeout
- * @since 3.6.0
- * @param {number} ms
- */
- AV.setRequestTimeout = function (ms) {
- AV._config.requestTimeout = ms;
- }; // backword compatible
- AV.initialize = AV.init;
- var defineConfig = function defineConfig(property) {
- return (0, _defineProperty.default)(AV, property, {
- get: function get() {
- return AV._config[property];
- },
- set: function set(value) {
- AV._config[property] = value;
- }
- });
- };
- ['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
- /***/ }),
- /* 420 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(421);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.slice;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
- };
- /***/ }),
- /* 421 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(422);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').slice;
- /***/ }),
- /* 422 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var isArray = __webpack_require__(90);
- var isConstructor = __webpack_require__(109);
- var isObject = __webpack_require__(11);
- var toAbsoluteIndex = __webpack_require__(125);
- var lengthOfArrayLike = __webpack_require__(41);
- var toIndexedObject = __webpack_require__(32);
- var createProperty = __webpack_require__(91);
- var wellKnownSymbol = __webpack_require__(9);
- var arrayMethodHasSpeciesSupport = __webpack_require__(114);
- var un$Slice = __webpack_require__(110);
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
- var SPECIES = wellKnownSymbol('species');
- var $Array = Array;
- var max = Math.max;
- // `Array.prototype.slice` method
- // https://tc39.es/ecma262/#sec-array.prototype.slice
- // fallback for not array-like ES3 strings and DOM objects
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- slice: function slice(start, end) {
- var O = toIndexedObject(this);
- var length = lengthOfArrayLike(O);
- var k = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
- var Constructor, result, n;
- if (isArray(O)) {
- Constructor = O.constructor;
- // cross-realm fallback
- if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
- Constructor = undefined;
- } else if (isObject(Constructor)) {
- Constructor = Constructor[SPECIES];
- if (Constructor === null) Constructor = undefined;
- }
- if (Constructor === $Array || Constructor === undefined) {
- return un$Slice(O, k, fin);
- }
- }
- result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
- for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
- result.length = n;
- return result;
- }
- });
- /***/ }),
- /* 423 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(424);
- var path = __webpack_require__(5);
- var Object = path.Object;
- var defineProperty = module.exports = function defineProperty(it, key, desc) {
- return Object.defineProperty(it, key, desc);
- };
- if (Object.defineProperty.sham) defineProperty.sham = true;
- /***/ }),
- /* 424 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var DESCRIPTORS = __webpack_require__(14);
- var defineProperty = __webpack_require__(23).f;
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- $({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
- defineProperty: defineProperty
- });
- /***/ }),
- /* 425 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var ajax = __webpack_require__(116);
- var Cache = __webpack_require__(237);
- function AppRouter(AV) {
- var _this = this;
- this.AV = AV;
- this.lockedUntil = 0;
- Cache.getAsync('serverURLs').then(function (data) {
- if (_this.disabled) return;
- if (!data) return _this.lock(0);
- var serverURLs = data.serverURLs,
- lockedUntil = data.lockedUntil;
- _this.AV._setServerURLs(serverURLs, false);
- _this.lockedUntil = lockedUntil;
- }).catch(function () {
- return _this.lock(0);
- });
- }
- AppRouter.prototype.disable = function disable() {
- this.disabled = true;
- };
- AppRouter.prototype.lock = function lock(ttl) {
- this.lockedUntil = Date.now() + ttl;
- };
- AppRouter.prototype.refresh = function refresh() {
- var _this2 = this;
- if (this.disabled) return;
- if (Date.now() < this.lockedUntil) return;
- this.lock(10);
- var url = 'https://app-router.com/2/route';
- return ajax({
- method: 'get',
- url: url,
- query: {
- appId: this.AV.applicationId
- }
- }).then(function (servers) {
- if (_this2.disabled) return;
- var ttl = servers.ttl;
- if (!ttl) throw new Error('missing ttl');
- ttl = ttl * 1000;
- var protocal = 'https://';
- var serverURLs = {
- push: protocal + servers.push_server,
- stats: protocal + servers.stats_server,
- engine: protocal + servers.engine_server,
- api: protocal + servers.api_server
- };
- _this2.AV._setServerURLs(serverURLs, false);
- _this2.lock(ttl);
- return Cache.setAsync('serverURLs', {
- serverURLs: serverURLs,
- lockedUntil: _this2.lockedUntil
- }, ttl);
- }).catch(function (error) {
- // bypass all errors
- console.warn("refresh server URLs failed: ".concat(error.message));
- _this2.lock(600);
- });
- };
- module.exports = AppRouter;
- /***/ }),
- /* 426 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(427);
- /***/ }),
- /* 427 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(428);
- __webpack_require__(451);
- __webpack_require__(452);
- __webpack_require__(453);
- __webpack_require__(454);
- __webpack_require__(455);
- // TODO: Remove from `core-js@4`
- __webpack_require__(456);
- __webpack_require__(457);
- __webpack_require__(458);
- module.exports = parent;
- /***/ }),
- /* 428 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(243);
- module.exports = parent;
- /***/ }),
- /* 429 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(228);
- __webpack_require__(53);
- __webpack_require__(244);
- __webpack_require__(435);
- __webpack_require__(436);
- __webpack_require__(437);
- __webpack_require__(438);
- __webpack_require__(248);
- __webpack_require__(439);
- __webpack_require__(440);
- __webpack_require__(441);
- __webpack_require__(442);
- __webpack_require__(443);
- __webpack_require__(444);
- __webpack_require__(445);
- __webpack_require__(446);
- __webpack_require__(447);
- __webpack_require__(448);
- __webpack_require__(449);
- __webpack_require__(450);
- var path = __webpack_require__(5);
- module.exports = path.Symbol;
- /***/ }),
- /* 430 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var global = __webpack_require__(7);
- var call = __webpack_require__(15);
- var uncurryThis = __webpack_require__(4);
- var IS_PURE = __webpack_require__(33);
- var DESCRIPTORS = __webpack_require__(14);
- var NATIVE_SYMBOL = __webpack_require__(64);
- var fails = __webpack_require__(2);
- var hasOwn = __webpack_require__(13);
- var isPrototypeOf = __webpack_require__(19);
- var anObject = __webpack_require__(20);
- var toIndexedObject = __webpack_require__(32);
- var toPropertyKey = __webpack_require__(96);
- var $toString = __webpack_require__(81);
- var createPropertyDescriptor = __webpack_require__(47);
- var nativeObjectCreate = __webpack_require__(49);
- var objectKeys = __webpack_require__(105);
- var getOwnPropertyNamesModule = __webpack_require__(103);
- var getOwnPropertyNamesExternal = __webpack_require__(245);
- var getOwnPropertySymbolsModule = __webpack_require__(104);
- var getOwnPropertyDescriptorModule = __webpack_require__(62);
- var definePropertyModule = __webpack_require__(23);
- var definePropertiesModule = __webpack_require__(128);
- var propertyIsEnumerableModule = __webpack_require__(120);
- var defineBuiltIn = __webpack_require__(44);
- var shared = __webpack_require__(79);
- var sharedKey = __webpack_require__(101);
- var hiddenKeys = __webpack_require__(80);
- var uid = __webpack_require__(99);
- var wellKnownSymbol = __webpack_require__(9);
- var wrappedWellKnownSymbolModule = __webpack_require__(148);
- var defineWellKnownSymbol = __webpack_require__(10);
- var defineSymbolToPrimitive = __webpack_require__(246);
- var setToStringTag = __webpack_require__(52);
- var InternalStateModule = __webpack_require__(43);
- var $forEach = __webpack_require__(70).forEach;
- var HIDDEN = sharedKey('hidden');
- var SYMBOL = 'Symbol';
- var PROTOTYPE = 'prototype';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(SYMBOL);
- var ObjectPrototype = Object[PROTOTYPE];
- var $Symbol = global.Symbol;
- var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
- var TypeError = global.TypeError;
- var QObject = global.QObject;
- var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var nativeDefineProperty = definePropertyModule.f;
- var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
- var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
- var push = uncurryThis([].push);
- var AllSymbols = shared('symbols');
- var ObjectPrototypeSymbols = shared('op-symbols');
- var WellKnownSymbolsStore = shared('wks');
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
- var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDescriptor = DESCRIPTORS && fails(function () {
- return nativeObjectCreate(nativeDefineProperty({}, 'a', {
- get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
- })).a != 7;
- }) ? function (O, P, Attributes) {
- var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
- if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
- nativeDefineProperty(O, P, Attributes);
- if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
- nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
- }
- } : nativeDefineProperty;
- var wrap = function (tag, description) {
- var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
- setInternalState(symbol, {
- type: SYMBOL,
- tag: tag,
- description: description
- });
- if (!DESCRIPTORS) symbol.description = description;
- return symbol;
- };
- var $defineProperty = function defineProperty(O, P, Attributes) {
- if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
- anObject(O);
- var key = toPropertyKey(P);
- anObject(Attributes);
- if (hasOwn(AllSymbols, key)) {
- if (!Attributes.enumerable) {
- if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
- O[HIDDEN][key] = true;
- } else {
- if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
- Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
- } return setSymbolDescriptor(O, key, Attributes);
- } return nativeDefineProperty(O, key, Attributes);
- };
- var $defineProperties = function defineProperties(O, Properties) {
- anObject(O);
- var properties = toIndexedObject(Properties);
- var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
- $forEach(keys, function (key) {
- if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
- });
- return O;
- };
- var $create = function create(O, Properties) {
- return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(V) {
- var P = toPropertyKey(V);
- var enumerable = call(nativePropertyIsEnumerable, this, P);
- if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
- return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
- ? enumerable : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
- var it = toIndexedObject(O);
- var key = toPropertyKey(P);
- if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
- var descriptor = nativeGetOwnPropertyDescriptor(it, key);
- if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
- descriptor.enumerable = true;
- }
- return descriptor;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(O) {
- var names = nativeGetOwnPropertyNames(toIndexedObject(O));
- var result = [];
- $forEach(names, function (key) {
- if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
- });
- return result;
- };
- var $getOwnPropertySymbols = function (O) {
- var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
- var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
- var result = [];
- $forEach(names, function (key) {
- if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
- push(result, AllSymbols[key]);
- }
- });
- return result;
- };
- // `Symbol` constructor
- // https://tc39.es/ecma262/#sec-symbol-constructor
- if (!NATIVE_SYMBOL) {
- $Symbol = function Symbol() {
- if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
- var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
- var tag = uid(description);
- var setter = function (value) {
- if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
- if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
- };
- if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
- return wrap(tag, description);
- };
- SymbolPrototype = $Symbol[PROTOTYPE];
- defineBuiltIn(SymbolPrototype, 'toString', function toString() {
- return getInternalState(this).tag;
- });
- defineBuiltIn($Symbol, 'withoutSetter', function (description) {
- return wrap(uid(description), description);
- });
- propertyIsEnumerableModule.f = $propertyIsEnumerable;
- definePropertyModule.f = $defineProperty;
- definePropertiesModule.f = $defineProperties;
- getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
- getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
- getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
- wrappedWellKnownSymbolModule.f = function (name) {
- return wrap(wellKnownSymbol(name), name);
- };
- if (DESCRIPTORS) {
- // https://github.com/tc39/proposal-Symbol-description
- nativeDefineProperty(SymbolPrototype, 'description', {
- configurable: true,
- get: function description() {
- return getInternalState(this).description;
- }
- });
- if (!IS_PURE) {
- defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
- }
- }
- }
- $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
- Symbol: $Symbol
- });
- $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
- defineWellKnownSymbol(name);
- });
- $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
- useSetter: function () { USE_SETTER = true; },
- useSimple: function () { USE_SETTER = false; }
- });
- $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- create: $create,
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- defineProperty: $defineProperty,
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- defineProperties: $defineProperties,
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor
- });
- $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- getOwnPropertyNames: $getOwnPropertyNames
- });
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- defineSymbolToPrimitive();
- // `Symbol.prototype[@@toStringTag]` property
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
- setToStringTag($Symbol, SYMBOL);
- hiddenKeys[HIDDEN] = true;
- /***/ }),
- /* 431 */
- /***/ (function(module, exports, __webpack_require__) {
- var toAbsoluteIndex = __webpack_require__(125);
- var lengthOfArrayLike = __webpack_require__(41);
- var createProperty = __webpack_require__(91);
- var $Array = Array;
- var max = Math.max;
- module.exports = function (O, start, end) {
- var length = lengthOfArrayLike(O);
- var k = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- var result = $Array(max(fin - k, 0));
- for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
- result.length = n;
- return result;
- };
- /***/ }),
- /* 432 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var getBuiltIn = __webpack_require__(18);
- var hasOwn = __webpack_require__(13);
- var toString = __webpack_require__(81);
- var shared = __webpack_require__(79);
- var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
- var StringToSymbolRegistry = shared('string-to-symbol-registry');
- var SymbolToStringRegistry = shared('symbol-to-string-registry');
- // `Symbol.for` method
- // https://tc39.es/ecma262/#sec-symbol.for
- $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
- 'for': function (key) {
- var string = toString(key);
- if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
- var symbol = getBuiltIn('Symbol')(string);
- StringToSymbolRegistry[string] = symbol;
- SymbolToStringRegistry[symbol] = string;
- return symbol;
- }
- });
- /***/ }),
- /* 433 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var hasOwn = __webpack_require__(13);
- var isSymbol = __webpack_require__(97);
- var tryToString = __webpack_require__(78);
- var shared = __webpack_require__(79);
- var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
- var SymbolToStringRegistry = shared('symbol-to-string-registry');
- // `Symbol.keyFor` method
- // https://tc39.es/ecma262/#sec-symbol.keyfor
- $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
- if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
- }
- });
- /***/ }),
- /* 434 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var NATIVE_SYMBOL = __webpack_require__(64);
- var fails = __webpack_require__(2);
- var getOwnPropertySymbolsModule = __webpack_require__(104);
- var toObject = __webpack_require__(34);
- // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
- // https://bugs.chromium.org/p/v8/issues/detail?id=3443
- var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
- // `Object.getOwnPropertySymbols` method
- // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
- $({ target: 'Object', stat: true, forced: FORCED }, {
- getOwnPropertySymbols: function getOwnPropertySymbols(it) {
- var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
- }
- });
- /***/ }),
- /* 435 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.asyncIterator` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.asynciterator
- defineWellKnownSymbol('asyncIterator');
- /***/ }),
- /* 436 */
- /***/ (function(module, exports) {
- // empty
- /***/ }),
- /* 437 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.hasInstance` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.hasinstance
- defineWellKnownSymbol('hasInstance');
- /***/ }),
- /* 438 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.isConcatSpreadable` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
- defineWellKnownSymbol('isConcatSpreadable');
- /***/ }),
- /* 439 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.match` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.match
- defineWellKnownSymbol('match');
- /***/ }),
- /* 440 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.matchAll` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.matchall
- defineWellKnownSymbol('matchAll');
- /***/ }),
- /* 441 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.replace` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.replace
- defineWellKnownSymbol('replace');
- /***/ }),
- /* 442 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.search` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.search
- defineWellKnownSymbol('search');
- /***/ }),
- /* 443 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.species` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.species
- defineWellKnownSymbol('species');
- /***/ }),
- /* 444 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.split` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.split
- defineWellKnownSymbol('split');
- /***/ }),
- /* 445 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- var defineSymbolToPrimitive = __webpack_require__(246);
- // `Symbol.toPrimitive` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.toprimitive
- defineWellKnownSymbol('toPrimitive');
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- defineSymbolToPrimitive();
- /***/ }),
- /* 446 */
- /***/ (function(module, exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(18);
- var defineWellKnownSymbol = __webpack_require__(10);
- var setToStringTag = __webpack_require__(52);
- // `Symbol.toStringTag` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.tostringtag
- defineWellKnownSymbol('toStringTag');
- // `Symbol.prototype[@@toStringTag]` property
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
- setToStringTag(getBuiltIn('Symbol'), 'Symbol');
- /***/ }),
- /* 447 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.unscopables` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.unscopables
- defineWellKnownSymbol('unscopables');
- /***/ }),
- /* 448 */
- /***/ (function(module, exports, __webpack_require__) {
- var global = __webpack_require__(7);
- var setToStringTag = __webpack_require__(52);
- // JSON[@@toStringTag] property
- // https://tc39.es/ecma262/#sec-json-@@tostringtag
- setToStringTag(global.JSON, 'JSON', true);
- /***/ }),
- /* 449 */
- /***/ (function(module, exports) {
- // empty
- /***/ }),
- /* 450 */
- /***/ (function(module, exports) {
- // empty
- /***/ }),
- /* 451 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.asyncDispose` well-known symbol
- // https://github.com/tc39/proposal-using-statement
- defineWellKnownSymbol('asyncDispose');
- /***/ }),
- /* 452 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.dispose` well-known symbol
- // https://github.com/tc39/proposal-using-statement
- defineWellKnownSymbol('dispose');
- /***/ }),
- /* 453 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.matcher` well-known symbol
- // https://github.com/tc39/proposal-pattern-matching
- defineWellKnownSymbol('matcher');
- /***/ }),
- /* 454 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.metadataKey` well-known symbol
- // https://github.com/tc39/proposal-decorator-metadata
- defineWellKnownSymbol('metadataKey');
- /***/ }),
- /* 455 */
- /***/ (function(module, exports, __webpack_require__) {
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.observable` well-known symbol
- // https://github.com/tc39/proposal-observable
- defineWellKnownSymbol('observable');
- /***/ }),
- /* 456 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove from `core-js@4`
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.metadata` well-known symbol
- // https://github.com/tc39/proposal-decorators
- defineWellKnownSymbol('metadata');
- /***/ }),
- /* 457 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: remove from `core-js@4`
- var defineWellKnownSymbol = __webpack_require__(10);
- // `Symbol.patternMatch` well-known symbol
- // https://github.com/tc39/proposal-pattern-matching
- defineWellKnownSymbol('patternMatch');
- /***/ }),
- /* 458 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: remove from `core-js@4`
- var defineWellKnownSymbol = __webpack_require__(10);
- defineWellKnownSymbol('replaceAll');
- /***/ }),
- /* 459 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(460);
- /***/ }),
- /* 460 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(461);
- /***/ }),
- /* 461 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(462);
- module.exports = parent;
- /***/ }),
- /* 462 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(249);
- module.exports = parent;
- /***/ }),
- /* 463 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(53);
- __webpack_require__(55);
- __webpack_require__(248);
- var WrappedWellKnownSymbolModule = __webpack_require__(148);
- module.exports = WrappedWellKnownSymbolModule.f('iterator');
- /***/ }),
- /* 464 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(465);
- module.exports = parent;
- /***/ }),
- /* 465 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(466);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.filter;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
- };
- /***/ }),
- /* 466 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(467);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').filter;
- /***/ }),
- /* 467 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var $filter = __webpack_require__(70).filter;
- var arrayMethodHasSpeciesSupport = __webpack_require__(114);
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- filter: function filter(callbackfn /* , thisArg */) {
- return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- /***/ }),
- /* 468 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _slice = _interopRequireDefault(__webpack_require__(61));
- var _keys = _interopRequireDefault(__webpack_require__(59));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _ = __webpack_require__(3);
- module.exports = function (AV) {
- var eventSplitter = /\s+/;
- var slice = (0, _slice.default)(Array.prototype);
- /**
- * @class
- *
- * <p>AV.Events is a fork of Backbone's Events module, provided for your
- * convenience.</p>
- *
- * <p>A module that can be mixed in to any object in order to provide
- * it with custom events. You may bind callback functions to an event
- * with `on`, or remove these functions with `off`.
- * Triggering an event fires all callbacks in the order that `on` was
- * called.
- *
- * @private
- * @example
- * var object = {};
- * _.extend(object, AV.Events);
- * object.on('expand', function(){ alert('expanded'); });
- * object.trigger('expand');</pre></p>
- *
- */
- AV.Events = {
- /**
- * Bind one or more space separated events, `events`, to a `callback`
- * function. Passing `"all"` will bind the callback to all events fired.
- */
- on: function on(events, callback, context) {
- var calls, event, node, tail, list;
- if (!callback) {
- return this;
- }
- events = events.split(eventSplitter);
- calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
- // modification. The tail is an empty object that will always be used
- // as the next node.
- event = events.shift();
- while (event) {
- list = calls[event];
- node = list ? list.tail : {};
- node.next = tail = {};
- node.context = context;
- node.callback = callback;
- calls[event] = {
- tail: tail,
- next: list ? list.next : node
- };
- event = events.shift();
- }
- return this;
- },
- /**
- * Remove one or many callbacks. If `context` is null, removes all callbacks
- * with that function. If `callback` is null, removes all callbacks for the
- * event. If `events` is null, removes all bound callbacks for all events.
- */
- off: function off(events, callback, context) {
- var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
- if (!(calls = this._callbacks)) {
- return;
- }
- if (!(events || callback || context)) {
- delete this._callbacks;
- return this;
- } // Loop through the listed events and contexts, splicing them out of the
- // linked list of callbacks if appropriate.
- events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
- event = events.shift();
- while (event) {
- node = calls[event];
- delete calls[event];
- if (!node || !(callback || context)) {
- continue;
- } // Create a new list, omitting the indicated callbacks.
- tail = node.tail;
- node = node.next;
- while (node !== tail) {
- cb = node.callback;
- ctx = node.context;
- if (callback && cb !== callback || context && ctx !== context) {
- this.on(event, cb, ctx);
- }
- node = node.next;
- }
- event = events.shift();
- }
- return this;
- },
- /**
- * Trigger one or many events, firing all bound callbacks. Callbacks are
- * passed the same arguments as `trigger` is, apart from the event name
- * (unless you're listening on `"all"`, which will cause your callback to
- * receive the true name of the event as the first argument).
- */
- trigger: function trigger(events) {
- var event, node, calls, tail, args, all, rest;
- if (!(calls = this._callbacks)) {
- return this;
- }
- all = calls.all;
- events = events.split(eventSplitter);
- rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
- // first to trigger the event, then to trigger any `"all"` callbacks.
- event = events.shift();
- while (event) {
- node = calls[event];
- if (node) {
- tail = node.tail;
- while ((node = node.next) !== tail) {
- node.callback.apply(node.context || this, rest);
- }
- }
- node = all;
- if (node) {
- var _context;
- tail = node.tail;
- args = (0, _concat.default)(_context = [event]).call(_context, rest);
- while ((node = node.next) !== tail) {
- node.callback.apply(node.context || this, args);
- }
- }
- event = events.shift();
- }
- return this;
- }
- };
- /**
- * @function
- */
- AV.Events.bind = AV.Events.on;
- /**
- * @function
- */
- AV.Events.unbind = AV.Events.off;
- };
- /***/ }),
- /* 469 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3);
- /*global navigator: false */
- module.exports = function (AV) {
- /**
- * Creates a new GeoPoint with any of the following forms:<br>
- * @example
- * new GeoPoint(otherGeoPoint)
- * new GeoPoint(30, 30)
- * new GeoPoint([30, 30])
- * new GeoPoint({latitude: 30, longitude: 30})
- * new GeoPoint() // defaults to (0, 0)
- * @class
- *
- * <p>Represents a latitude / longitude point that may be associated
- * with a key in a AVObject or used as a reference point for geo queries.
- * This allows proximity-based queries on the key.</p>
- *
- * <p>Only one key in a class may contain a GeoPoint.</p>
- *
- * <p>Example:<pre>
- * var point = new AV.GeoPoint(30.0, -20.0);
- * var object = new AV.Object("PlaceObject");
- * object.set("location", point);
- * object.save();</pre></p>
- */
- AV.GeoPoint = function (arg1, arg2) {
- if (_.isArray(arg1)) {
- AV.GeoPoint._validate(arg1[0], arg1[1]);
- this.latitude = arg1[0];
- this.longitude = arg1[1];
- } else if (_.isObject(arg1)) {
- AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
- this.latitude = arg1.latitude;
- this.longitude = arg1.longitude;
- } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
- AV.GeoPoint._validate(arg1, arg2);
- this.latitude = arg1;
- this.longitude = arg2;
- } else {
- this.latitude = 0;
- this.longitude = 0;
- } // Add properties so that anyone using Webkit or Mozilla will get an error
- // if they try to set values that are out of bounds.
- var self = this;
- if (this.__defineGetter__ && this.__defineSetter__) {
- // Use _latitude and _longitude to actually store the values, and add
- // getters and setters for latitude and longitude.
- this._latitude = this.latitude;
- this._longitude = this.longitude;
- this.__defineGetter__('latitude', function () {
- return self._latitude;
- });
- this.__defineGetter__('longitude', function () {
- return self._longitude;
- });
- this.__defineSetter__('latitude', function (val) {
- AV.GeoPoint._validate(val, self.longitude);
- self._latitude = val;
- });
- this.__defineSetter__('longitude', function (val) {
- AV.GeoPoint._validate(self.latitude, val);
- self._longitude = val;
- });
- }
- };
- /**
- * @lends AV.GeoPoint.prototype
- * @property {float} latitude North-south portion of the coordinate, in range
- * [-90, 90]. Throws an exception if set out of range in a modern browser.
- * @property {float} longitude East-west portion of the coordinate, in range
- * [-180, 180]. Throws if set out of range in a modern browser.
- */
- /**
- * Throws an exception if the given lat-long is out of bounds.
- * @private
- */
- AV.GeoPoint._validate = function (latitude, longitude) {
- if (latitude < -90.0) {
- throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
- }
- if (latitude > 90.0) {
- throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
- }
- if (longitude < -180.0) {
- throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
- }
- if (longitude > 180.0) {
- throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
- }
- };
- /**
- * Creates a GeoPoint with the user's current location, if available.
- * @return {Promise.<AV.GeoPoint>}
- */
- AV.GeoPoint.current = function () {
- return new _promise.default(function (resolve, reject) {
- navigator.geolocation.getCurrentPosition(function (location) {
- resolve(new AV.GeoPoint({
- latitude: location.coords.latitude,
- longitude: location.coords.longitude
- }));
- }, reject);
- });
- };
- _.extend(AV.GeoPoint.prototype,
- /** @lends AV.GeoPoint.prototype */
- {
- /**
- * Returns a JSON representation of the GeoPoint, suitable for AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- AV.GeoPoint._validate(this.latitude, this.longitude);
- return {
- __type: 'GeoPoint',
- latitude: this.latitude,
- longitude: this.longitude
- };
- },
- /**
- * Returns the distance from this GeoPoint to another in radians.
- * @param {AV.GeoPoint} point the other AV.GeoPoint.
- * @return {Number}
- */
- radiansTo: function radiansTo(point) {
- var d2r = Math.PI / 180.0;
- var lat1rad = this.latitude * d2r;
- var long1rad = this.longitude * d2r;
- var lat2rad = point.latitude * d2r;
- var long2rad = point.longitude * d2r;
- var deltaLat = lat1rad - lat2rad;
- var deltaLong = long1rad - long2rad;
- var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
- var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
- var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
- a = Math.min(1.0, a);
- return 2 * Math.asin(Math.sqrt(a));
- },
- /**
- * Returns the distance from this GeoPoint to another in kilometers.
- * @param {AV.GeoPoint} point the other AV.GeoPoint.
- * @return {Number}
- */
- kilometersTo: function kilometersTo(point) {
- return this.radiansTo(point) * 6371.0;
- },
- /**
- * Returns the distance from this GeoPoint to another in miles.
- * @param {AV.GeoPoint} point the other AV.GeoPoint.
- * @return {Number}
- */
- milesTo: function milesTo(point) {
- return this.radiansTo(point) * 3958.8;
- }
- });
- };
- /***/ }),
- /* 470 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _ = __webpack_require__(3);
- module.exports = function (AV) {
- var PUBLIC_KEY = '*';
- /**
- * Creates a new ACL.
- * If no argument is given, the ACL has no permissions for anyone.
- * If the argument is a AV.User, the ACL will have read and write
- * permission for only that user.
- * If the argument is any other JSON object, that object will be interpretted
- * as a serialized ACL created with toJSON().
- * @see AV.Object#setACL
- * @class
- *
- * <p>An ACL, or Access Control List can be added to any
- * <code>AV.Object</code> to restrict access to only a subset of users
- * of your application.</p>
- */
- AV.ACL = function (arg1) {
- var self = this;
- self.permissionsById = {};
- if (_.isObject(arg1)) {
- if (arg1 instanceof AV.User) {
- self.setReadAccess(arg1, true);
- self.setWriteAccess(arg1, true);
- } else {
- if (_.isFunction(arg1)) {
- throw new Error('AV.ACL() called with a function. Did you forget ()?');
- }
- AV._objectEach(arg1, function (accessList, userId) {
- if (!_.isString(userId)) {
- throw new Error('Tried to create an ACL with an invalid userId.');
- }
- self.permissionsById[userId] = {};
- AV._objectEach(accessList, function (allowed, permission) {
- if (permission !== 'read' && permission !== 'write') {
- throw new Error('Tried to create an ACL with an invalid permission type.');
- }
- if (!_.isBoolean(allowed)) {
- throw new Error('Tried to create an ACL with an invalid permission value.');
- }
- self.permissionsById[userId][permission] = allowed;
- });
- });
- }
- }
- };
- /**
- * Returns a JSON-encoded version of the ACL.
- * @return {Object}
- */
- AV.ACL.prototype.toJSON = function () {
- return _.clone(this.permissionsById);
- };
- AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
- if (userId instanceof AV.User) {
- userId = userId.id;
- } else if (userId instanceof AV.Role) {
- userId = 'role:' + userId.getName();
- }
- if (!_.isString(userId)) {
- throw new Error('userId must be a string.');
- }
- if (!_.isBoolean(allowed)) {
- throw new Error('allowed must be either true or false.');
- }
- var permissions = this.permissionsById[userId];
- if (!permissions) {
- if (!allowed) {
- // The user already doesn't have this permission, so no action needed.
- return;
- } else {
- permissions = {};
- this.permissionsById[userId] = permissions;
- }
- }
- if (allowed) {
- this.permissionsById[userId][accessType] = true;
- } else {
- delete permissions[accessType];
- if (_.isEmpty(permissions)) {
- delete this.permissionsById[userId];
- }
- }
- };
- AV.ACL.prototype._getAccess = function (accessType, userId) {
- if (userId instanceof AV.User) {
- userId = userId.id;
- } else if (userId instanceof AV.Role) {
- userId = 'role:' + userId.getName();
- }
- var permissions = this.permissionsById[userId];
- if (!permissions) {
- return false;
- }
- return permissions[accessType] ? true : false;
- };
- /**
- * Set whether the given user is allowed to read this object.
- * @param userId An instance of AV.User or its objectId.
- * @param {Boolean} allowed Whether that user should have read access.
- */
- AV.ACL.prototype.setReadAccess = function (userId, allowed) {
- this._setAccess('read', userId, allowed);
- };
- /**
- * Get whether the given user id is *explicitly* allowed to read this object.
- * Even if this returns false, the user may still be able to access it if
- * getPublicReadAccess returns true or a role that the user belongs to has
- * write access.
- * @param userId An instance of AV.User or its objectId, or a AV.Role.
- * @return {Boolean}
- */
- AV.ACL.prototype.getReadAccess = function (userId) {
- return this._getAccess('read', userId);
- };
- /**
- * Set whether the given user id is allowed to write this object.
- * @param userId An instance of AV.User or its objectId, or a AV.Role..
- * @param {Boolean} allowed Whether that user should have write access.
- */
- AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
- this._setAccess('write', userId, allowed);
- };
- /**
- * Get whether the given user id is *explicitly* allowed to write this object.
- * Even if this returns false, the user may still be able to write it if
- * getPublicWriteAccess returns true or a role that the user belongs to has
- * write access.
- * @param userId An instance of AV.User or its objectId, or a AV.Role.
- * @return {Boolean}
- */
- AV.ACL.prototype.getWriteAccess = function (userId) {
- return this._getAccess('write', userId);
- };
- /**
- * Set whether the public is allowed to read this object.
- * @param {Boolean} allowed
- */
- AV.ACL.prototype.setPublicReadAccess = function (allowed) {
- this.setReadAccess(PUBLIC_KEY, allowed);
- };
- /**
- * Get whether the public is allowed to read this object.
- * @return {Boolean}
- */
- AV.ACL.prototype.getPublicReadAccess = function () {
- return this.getReadAccess(PUBLIC_KEY);
- };
- /**
- * Set whether the public is allowed to write this object.
- * @param {Boolean} allowed
- */
- AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
- this.setWriteAccess(PUBLIC_KEY, allowed);
- };
- /**
- * Get whether the public is allowed to write this object.
- * @return {Boolean}
- */
- AV.ACL.prototype.getPublicWriteAccess = function () {
- return this.getWriteAccess(PUBLIC_KEY);
- };
- /**
- * Get whether users belonging to the given role are allowed
- * to read this object. Even if this returns false, the role may
- * still be able to write it if a parent role has read access.
- *
- * @param role The name of the role, or a AV.Role object.
- * @return {Boolean} true if the role has read access. false otherwise.
- * @throws {String} If role is neither a AV.Role nor a String.
- */
- AV.ACL.prototype.getRoleReadAccess = function (role) {
- if (role instanceof AV.Role) {
- // Normalize to the String name
- role = role.getName();
- }
- if (_.isString(role)) {
- return this.getReadAccess('role:' + role);
- }
- throw new Error('role must be a AV.Role or a String');
- };
- /**
- * Get whether users belonging to the given role are allowed
- * to write this object. Even if this returns false, the role may
- * still be able to write it if a parent role has write access.
- *
- * @param role The name of the role, or a AV.Role object.
- * @return {Boolean} true if the role has write access. false otherwise.
- * @throws {String} If role is neither a AV.Role nor a String.
- */
- AV.ACL.prototype.getRoleWriteAccess = function (role) {
- if (role instanceof AV.Role) {
- // Normalize to the String name
- role = role.getName();
- }
- if (_.isString(role)) {
- return this.getWriteAccess('role:' + role);
- }
- throw new Error('role must be a AV.Role or a String');
- };
- /**
- * Set whether users belonging to the given role are allowed
- * to read this object.
- *
- * @param role The name of the role, or a AV.Role object.
- * @param {Boolean} allowed Whether the given role can read this object.
- * @throws {String} If role is neither a AV.Role nor a String.
- */
- AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
- if (role instanceof AV.Role) {
- // Normalize to the String name
- role = role.getName();
- }
- if (_.isString(role)) {
- this.setReadAccess('role:' + role, allowed);
- return;
- }
- throw new Error('role must be a AV.Role or a String');
- };
- /**
- * Set whether users belonging to the given role are allowed
- * to write this object.
- *
- * @param role The name of the role, or a AV.Role object.
- * @param {Boolean} allowed Whether the given role can write this object.
- * @throws {String} If role is neither a AV.Role nor a String.
- */
- AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
- if (role instanceof AV.Role) {
- // Normalize to the String name
- role = role.getName();
- }
- if (_.isString(role)) {
- this.setWriteAccess('role:' + role, allowed);
- return;
- }
- throw new Error('role must be a AV.Role or a String');
- };
- };
- /***/ }),
- /* 471 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _find = _interopRequireDefault(__webpack_require__(93));
- var _indexOf = _interopRequireDefault(__webpack_require__(71));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _ = __webpack_require__(3);
- module.exports = function (AV) {
- /**
- * @private
- * @class
- * A AV.Op is an atomic operation that can be applied to a field in a
- * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
- * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
- * is a AV.Op.Unset. These operations are stored in a AV.Object and
- * sent to the server as part of <code>object.save()</code> operations.
- * Instances of AV.Op should be immutable.
- *
- * You should not create subclasses of AV.Op or instantiate AV.Op
- * directly.
- */
- AV.Op = function () {
- this._initialize.apply(this, arguments);
- };
- _.extend(AV.Op.prototype,
- /** @lends AV.Op.prototype */
- {
- _initialize: function _initialize() {}
- });
- _.extend(AV.Op, {
- /**
- * To create a new Op, call AV.Op._extend();
- * @private
- */
- _extend: AV._extend,
- // A map of __op string to decoder function.
- _opDecoderMap: {},
- /**
- * Registers a function to convert a json object with an __op field into an
- * instance of a subclass of AV.Op.
- * @private
- */
- _registerDecoder: function _registerDecoder(opName, decoder) {
- AV.Op._opDecoderMap[opName] = decoder;
- },
- /**
- * Converts a json object into an instance of a subclass of AV.Op.
- * @private
- */
- _decode: function _decode(json) {
- var decoder = AV.Op._opDecoderMap[json.__op];
- if (decoder) {
- return decoder(json);
- } else {
- return undefined;
- }
- }
- });
- /*
- * Add a handler for Batch ops.
- */
- AV.Op._registerDecoder('Batch', function (json) {
- var op = null;
- AV._arrayEach(json.ops, function (nextOp) {
- nextOp = AV.Op._decode(nextOp);
- op = nextOp._mergeWithPrevious(op);
- });
- return op;
- });
- /**
- * @private
- * @class
- * A Set operation indicates that either the field was changed using
- * AV.Object.set, or it is a mutable container that was detected as being
- * changed.
- */
- AV.Op.Set = AV.Op._extend(
- /** @lends AV.Op.Set.prototype */
- {
- _initialize: function _initialize(value) {
- this._value = value;
- },
- /**
- * Returns the new value of this field after the set.
- */
- value: function value() {
- return this._value;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return AV._encode(this.value());
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- return this;
- },
- _estimate: function _estimate(oldValue) {
- return this.value();
- }
- });
- /**
- * A sentinel value that is returned by AV.Op.Unset._estimate to
- * indicate the field should be deleted. Basically, if you find _UNSET as a
- * value in your object, you should remove that key.
- */
- AV.Op._UNSET = {};
- /**
- * @private
- * @class
- * An Unset operation indicates that this field has been deleted from the
- * object.
- */
- AV.Op.Unset = AV.Op._extend(
- /** @lends AV.Op.Unset.prototype */
- {
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'Delete'
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- return this;
- },
- _estimate: function _estimate(oldValue) {
- return AV.Op._UNSET;
- }
- });
- AV.Op._registerDecoder('Delete', function (json) {
- return new AV.Op.Unset();
- });
- /**
- * @private
- * @class
- * An Increment is an atomic operation where the numeric value for the field
- * will be increased by a given amount.
- */
- AV.Op.Increment = AV.Op._extend(
- /** @lends AV.Op.Increment.prototype */
- {
- _initialize: function _initialize(amount) {
- this._amount = amount;
- },
- /**
- * Returns the amount to increment by.
- * @return {Number} the amount to increment by.
- */
- amount: function amount() {
- return this._amount;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'Increment',
- amount: this._amount
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return new AV.Op.Set(this.amount());
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(previous.value() + this.amount());
- } else if (previous instanceof AV.Op.Increment) {
- return new AV.Op.Increment(this.amount() + previous.amount());
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- if (!oldValue) {
- return this.amount();
- }
- return oldValue + this.amount();
- }
- });
- AV.Op._registerDecoder('Increment', function (json) {
- return new AV.Op.Increment(json.amount);
- });
- /**
- * @private
- * @class
- * BitAnd is an atomic operation where the given value will be bit and to the
- * value than is stored in this field.
- */
- AV.Op.BitAnd = AV.Op._extend(
- /** @lends AV.Op.BitAnd.prototype */
- {
- _initialize: function _initialize(value) {
- this._value = value;
- },
- value: function value() {
- return this._value;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'BitAnd',
- value: this.value()
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return new AV.Op.Set(0);
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(previous.value() & this.value());
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- return oldValue & this.value();
- }
- });
- AV.Op._registerDecoder('BitAnd', function (json) {
- return new AV.Op.BitAnd(json.value);
- });
- /**
- * @private
- * @class
- * BitOr is an atomic operation where the given value will be bit and to the
- * value than is stored in this field.
- */
- AV.Op.BitOr = AV.Op._extend(
- /** @lends AV.Op.BitOr.prototype */
- {
- _initialize: function _initialize(value) {
- this._value = value;
- },
- value: function value() {
- return this._value;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'BitOr',
- value: this.value()
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return new AV.Op.Set(this.value());
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(previous.value() | this.value());
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- return oldValue | this.value();
- }
- });
- AV.Op._registerDecoder('BitOr', function (json) {
- return new AV.Op.BitOr(json.value);
- });
- /**
- * @private
- * @class
- * BitXor is an atomic operation where the given value will be bit and to the
- * value than is stored in this field.
- */
- AV.Op.BitXor = AV.Op._extend(
- /** @lends AV.Op.BitXor.prototype */
- {
- _initialize: function _initialize(value) {
- this._value = value;
- },
- value: function value() {
- return this._value;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'BitXor',
- value: this.value()
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return new AV.Op.Set(this.value());
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(previous.value() ^ this.value());
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- return oldValue ^ this.value();
- }
- });
- AV.Op._registerDecoder('BitXor', function (json) {
- return new AV.Op.BitXor(json.value);
- });
- /**
- * @private
- * @class
- * Add is an atomic operation where the given objects will be appended to the
- * array that is stored in this field.
- */
- AV.Op.Add = AV.Op._extend(
- /** @lends AV.Op.Add.prototype */
- {
- _initialize: function _initialize(objects) {
- this._objects = objects;
- },
- /**
- * Returns the objects to be added to the array.
- * @return {Array} The objects to be added to the array.
- */
- objects: function objects() {
- return this._objects;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'Add',
- objects: AV._encode(this.objects())
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return new AV.Op.Set(this.objects());
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(this._estimate(previous.value()));
- } else if (previous instanceof AV.Op.Add) {
- var _context;
- return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- if (!oldValue) {
- return _.clone(this.objects());
- } else {
- return (0, _concat.default)(oldValue).call(oldValue, this.objects());
- }
- }
- });
- AV.Op._registerDecoder('Add', function (json) {
- return new AV.Op.Add(AV._decode(json.objects));
- });
- /**
- * @private
- * @class
- * AddUnique is an atomic operation where the given items will be appended to
- * the array that is stored in this field only if they were not already
- * present in the array.
- */
- AV.Op.AddUnique = AV.Op._extend(
- /** @lends AV.Op.AddUnique.prototype */
- {
- _initialize: function _initialize(objects) {
- this._objects = _.uniq(objects);
- },
- /**
- * Returns the objects to be added to the array.
- * @return {Array} The objects to be added to the array.
- */
- objects: function objects() {
- return this._objects;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'AddUnique',
- objects: AV._encode(this.objects())
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return new AV.Op.Set(this.objects());
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(this._estimate(previous.value()));
- } else if (previous instanceof AV.Op.AddUnique) {
- return new AV.Op.AddUnique(this._estimate(previous.objects()));
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- if (!oldValue) {
- return _.clone(this.objects());
- } else {
- // We can't just take the _.uniq(_.union(...)) of oldValue and
- // this.objects, because the uniqueness may not apply to oldValue
- // (especially if the oldValue was set via .set())
- var newValue = _.clone(oldValue);
- AV._arrayEach(this.objects(), function (obj) {
- if (obj instanceof AV.Object && obj.id) {
- var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
- return anObj instanceof AV.Object && anObj.id === obj.id;
- });
- if (!matchingObj) {
- newValue.push(obj);
- } else {
- var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
- newValue[index] = obj;
- }
- } else if (!_.contains(newValue, obj)) {
- newValue.push(obj);
- }
- });
- return newValue;
- }
- }
- });
- AV.Op._registerDecoder('AddUnique', function (json) {
- return new AV.Op.AddUnique(AV._decode(json.objects));
- });
- /**
- * @private
- * @class
- * Remove is an atomic operation where the given objects will be removed from
- * the array that is stored in this field.
- */
- AV.Op.Remove = AV.Op._extend(
- /** @lends AV.Op.Remove.prototype */
- {
- _initialize: function _initialize(objects) {
- this._objects = _.uniq(objects);
- },
- /**
- * Returns the objects to be removed from the array.
- * @return {Array} The objects to be removed from the array.
- */
- objects: function objects() {
- return this._objects;
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __op: 'Remove',
- objects: AV._encode(this.objects())
- };
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- return previous;
- } else if (previous instanceof AV.Op.Set) {
- return new AV.Op.Set(this._estimate(previous.value()));
- } else if (previous instanceof AV.Op.Remove) {
- return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue) {
- if (!oldValue) {
- return [];
- } else {
- var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
- AV._arrayEach(this.objects(), function (obj) {
- if (obj instanceof AV.Object && obj.id) {
- newValue = _.reject(newValue, function (other) {
- return other instanceof AV.Object && other.id === obj.id;
- });
- }
- });
- return newValue;
- }
- }
- });
- AV.Op._registerDecoder('Remove', function (json) {
- return new AV.Op.Remove(AV._decode(json.objects));
- });
- /**
- * @private
- * @class
- * A Relation operation indicates that the field is an instance of
- * AV.Relation, and objects are being added to, or removed from, that
- * relation.
- */
- AV.Op.Relation = AV.Op._extend(
- /** @lends AV.Op.Relation.prototype */
- {
- _initialize: function _initialize(adds, removes) {
- this._targetClassName = null;
- var self = this;
- var pointerToId = function pointerToId(object) {
- if (object instanceof AV.Object) {
- if (!object.id) {
- throw new Error("You can't add an unsaved AV.Object to a relation.");
- }
- if (!self._targetClassName) {
- self._targetClassName = object.className;
- }
- if (self._targetClassName !== object.className) {
- throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
- }
- return object.id;
- }
- return object;
- };
- this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
- this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
- },
- /**
- * Returns an array of unfetched AV.Object that are being added to the
- * relation.
- * @return {Array}
- */
- added: function added() {
- var self = this;
- return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
- var object = AV.Object._create(self._targetClassName);
- object.id = objectId;
- return object;
- });
- },
- /**
- * Returns an array of unfetched AV.Object that are being removed from
- * the relation.
- * @return {Array}
- */
- removed: function removed() {
- var self = this;
- return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
- var object = AV.Object._create(self._targetClassName);
- object.id = objectId;
- return object;
- });
- },
- /**
- * Returns a JSON version of the operation suitable for sending to AV.
- * @return {Object}
- */
- toJSON: function toJSON() {
- var adds = null;
- var removes = null;
- var self = this;
- var idToPointer = function idToPointer(id) {
- return {
- __type: 'Pointer',
- className: self._targetClassName,
- objectId: id
- };
- };
- var pointers = null;
- if (this.relationsToAdd.length > 0) {
- pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
- adds = {
- __op: 'AddRelation',
- objects: pointers
- };
- }
- if (this.relationsToRemove.length > 0) {
- pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
- removes = {
- __op: 'RemoveRelation',
- objects: pointers
- };
- }
- if (adds && removes) {
- return {
- __op: 'Batch',
- ops: [adds, removes]
- };
- }
- return adds || removes || {};
- },
- _mergeWithPrevious: function _mergeWithPrevious(previous) {
- if (!previous) {
- return this;
- } else if (previous instanceof AV.Op.Unset) {
- throw new Error("You can't modify a relation after deleting it.");
- } else if (previous instanceof AV.Op.Relation) {
- if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
- throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
- }
- var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
- var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
- var newRelation = new AV.Op.Relation(newAdd, newRemove);
- newRelation._targetClassName = this._targetClassName;
- return newRelation;
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- },
- _estimate: function _estimate(oldValue, object, key) {
- if (!oldValue) {
- var relation = new AV.Relation(object, key);
- relation.targetClassName = this._targetClassName;
- } else if (oldValue instanceof AV.Relation) {
- if (this._targetClassName) {
- if (oldValue.targetClassName) {
- if (oldValue.targetClassName !== this._targetClassName) {
- throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
- }
- } else {
- oldValue.targetClassName = this._targetClassName;
- }
- }
- return oldValue;
- } else {
- throw new Error('Op is invalid after previous op.');
- }
- }
- });
- AV.Op._registerDecoder('AddRelation', function (json) {
- return new AV.Op.Relation(AV._decode(json.objects), []);
- });
- AV.Op._registerDecoder('RemoveRelation', function (json) {
- return new AV.Op.Relation([], AV._decode(json.objects));
- });
- };
- /***/ }),
- /* 472 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(473);
- module.exports = parent;
- /***/ }),
- /* 473 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(474);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.find;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
- };
- /***/ }),
- /* 474 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(475);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').find;
- /***/ }),
- /* 475 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var $find = __webpack_require__(70).find;
- var addToUnscopables = __webpack_require__(169);
- var FIND = 'find';
- var SKIPS_HOLES = true;
- // Shouldn't skip holes
- if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
- find: function find(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables(FIND);
- /***/ }),
- /* 476 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _ = __webpack_require__(3);
- module.exports = function (AV) {
- /**
- * Creates a new Relation for the given parent object and key. This
- * constructor should rarely be used directly, but rather created by
- * {@link AV.Object#relation}.
- * @param {AV.Object} parent The parent of this relation.
- * @param {String} key The key for this relation on the parent.
- * @see AV.Object#relation
- * @class
- *
- * <p>
- * A class that is used to access all of the children of a many-to-many
- * relationship. Each instance of AV.Relation is associated with a
- * particular parent object and key.
- * </p>
- */
- AV.Relation = function (parent, key) {
- if (!_.isString(key)) {
- throw new TypeError('key must be a string');
- }
- this.parent = parent;
- this.key = key;
- this.targetClassName = null;
- };
- /**
- * Creates a query that can be used to query the parent objects in this relation.
- * @param {String} parentClass The parent class or name.
- * @param {String} relationKey The relation field key in parent.
- * @param {AV.Object} child The child object.
- * @return {AV.Query}
- */
- AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
- var query = new AV.Query(parentClass);
- query.equalTo(relationKey, child._toPointer());
- return query;
- };
- _.extend(AV.Relation.prototype,
- /** @lends AV.Relation.prototype */
- {
- /**
- * Makes sure that this relation has the right parent and key.
- * @private
- */
- _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
- this.parent = this.parent || parent;
- this.key = this.key || key;
- if (this.parent !== parent) {
- throw new Error('Internal Error. Relation retrieved from two different Objects.');
- }
- if (this.key !== key) {
- throw new Error('Internal Error. Relation retrieved from two different keys.');
- }
- },
- /**
- * Adds a AV.Object or an array of AV.Objects to the relation.
- * @param {AV.Object|AV.Object[]} objects The item or items to add.
- */
- add: function add(objects) {
- if (!_.isArray(objects)) {
- objects = [objects];
- }
- var change = new AV.Op.Relation(objects, []);
- this.parent.set(this.key, change);
- this.targetClassName = change._targetClassName;
- },
- /**
- * Removes a AV.Object or an array of AV.Objects from this relation.
- * @param {AV.Object|AV.Object[]} objects The item or items to remove.
- */
- remove: function remove(objects) {
- if (!_.isArray(objects)) {
- objects = [objects];
- }
- var change = new AV.Op.Relation([], objects);
- this.parent.set(this.key, change);
- this.targetClassName = change._targetClassName;
- },
- /**
- * Returns a JSON version of the object suitable for saving to disk.
- * @return {Object}
- */
- toJSON: function toJSON() {
- return {
- __type: 'Relation',
- className: this.targetClassName
- };
- },
- /**
- * Returns a AV.Query that is limited to objects in this
- * relation.
- * @return {AV.Query}
- */
- query: function query() {
- var targetClass;
- var query;
- if (!this.targetClassName) {
- targetClass = AV.Object._getSubclass(this.parent.className);
- query = new AV.Query(targetClass);
- query._defaultParams.redirectClassNameForKey = this.key;
- } else {
- targetClass = AV.Object._getSubclass(this.targetClassName);
- query = new AV.Query(targetClass);
- }
- query._addCondition('$relatedTo', 'object', this.parent._toPointer());
- query._addCondition('$relatedTo', 'key', this.key);
- return query;
- }
- });
- };
- /***/ }),
- /* 477 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3);
- var cos = __webpack_require__(478);
- var qiniu = __webpack_require__(479);
- var s3 = __webpack_require__(525);
- var AVError = __webpack_require__(46);
- var _require = __webpack_require__(27),
- request = _require.request,
- AVRequest = _require._request;
- var _require2 = __webpack_require__(30),
- tap = _require2.tap,
- transformFetchOptions = _require2.transformFetchOptions;
- var debug = __webpack_require__(60)('leancloud:file');
- var parseBase64 = __webpack_require__(529);
- module.exports = function (AV) {
- // port from browserify path module
- // since react-native packager won't shim node modules.
- var extname = function extname(path) {
- if (!_.isString(path)) return '';
- return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
- };
- var b64Digit = function b64Digit(number) {
- if (number < 26) {
- return String.fromCharCode(65 + number);
- }
- if (number < 52) {
- return String.fromCharCode(97 + (number - 26));
- }
- if (number < 62) {
- return String.fromCharCode(48 + (number - 52));
- }
- if (number === 62) {
- return '+';
- }
- if (number === 63) {
- return '/';
- }
- throw new Error('Tried to encode large digit ' + number + ' in base64.');
- };
- var encodeBase64 = function encodeBase64(array) {
- var chunks = [];
- chunks.length = Math.ceil(array.length / 3);
- _.times(chunks.length, function (i) {
- var b1 = array[i * 3];
- var b2 = array[i * 3 + 1] || 0;
- var b3 = array[i * 3 + 2] || 0;
- var has2 = i * 3 + 1 < array.length;
- var has3 = i * 3 + 2 < array.length;
- 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('');
- });
- return chunks.join('');
- };
- /**
- * An AV.File is a local representation of a file that is saved to the AV
- * cloud.
- * @param name {String} The file's name. This will change to a unique value
- * once the file has finished saving.
- * @param data {Array} The data for the file, as either:
- * 1. an Array of byte value Numbers, or
- * 2. an Object like { base64: "..." } with a base64-encoded String.
- * 3. a Blob(File) selected with a file upload control in a browser.
- * 4. an Object like { blob: {uri: "..."} } that mimics Blob
- * in some non-browser environments such as React Native.
- * 5. a Buffer in Node.js runtime.
- * 6. a Stream in Node.js runtime.
- *
- * For example:<pre>
- * var fileUploadControl = $("#profilePhotoFileUpload")[0];
- * if (fileUploadControl.files.length > 0) {
- * var file = fileUploadControl.files[0];
- * var name = "photo.jpg";
- * var file = new AV.File(name, file);
- * file.save().then(function() {
- * // The file has been saved to AV.
- * }, function(error) {
- * // The file either could not be read, or could not be saved to AV.
- * });
- * }</pre>
- *
- * @class
- * @param [mimeType] {String} Content-Type header to use for the file. If
- * this is omitted, the content type will be inferred from the name's
- * extension.
- */
- AV.File = function (name, data, mimeType) {
- this.attributes = {
- name: name,
- url: '',
- metaData: {},
- // 用来存储转换后要上传的 base64 String
- base64: ''
- };
- if (_.isString(data)) {
- throw new TypeError('Creating an AV.File from a String is not yet supported.');
- }
- if (_.isArray(data)) {
- this.attributes.metaData.size = data.length;
- data = {
- base64: encodeBase64(data)
- };
- }
- this._extName = '';
- this._data = data;
- this._uploadHeaders = {};
- if (data && data.blob && typeof data.blob.uri === 'string') {
- this._extName = extname(data.blob.uri);
- }
- if (typeof Blob !== 'undefined' && data instanceof Blob) {
- if (data.size) {
- this.attributes.metaData.size = data.size;
- }
- if (data.name) {
- this._extName = extname(data.name);
- }
- }
- var owner;
- if (data && data.owner) {
- owner = data.owner;
- } else if (!AV._config.disableCurrentUser) {
- try {
- owner = AV.User.current();
- } catch (error) {
- if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
- throw error;
- }
- }
- }
- this.attributes.metaData.owner = owner ? owner.id : 'unknown';
- this.set('mime_type', mimeType);
- };
- /**
- * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
- * @param {String} name the file name
- * @param {String} url the file url.
- * @param {Object} [metaData] the file metadata object.
- * @param {String} [type] Content-Type header to use for the file. If
- * this is omitted, the content type will be inferred from the name's
- * extension.
- * @return {AV.File} the file object
- */
- AV.File.withURL = function (name, url, metaData, type) {
- if (!name || !url) {
- throw new Error('Please provide file name and url');
- }
- var file = new AV.File(name, null, type); //copy metaData properties to file.
- if (metaData) {
- for (var prop in metaData) {
- if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
- }
- }
- file.attributes.url = url; //Mark the file is from external source.
- file.attributes.metaData.__source = 'external';
- file.attributes.metaData.size = 0;
- return file;
- };
- /**
- * Creates a file object with exists objectId.
- * @param {String} objectId The objectId string
- * @return {AV.File} the file object
- */
- AV.File.createWithoutData = function (objectId) {
- if (!objectId) {
- throw new TypeError('The objectId must be provided');
- }
- var file = new AV.File();
- file.id = objectId;
- return file;
- };
- /**
- * Request file censor.
- * @since 4.13.0
- * @param {String} objectId
- * @return {Promise.<string>}
- */
- AV.File.censor = function (objectId) {
- if (!AV._config.masterKey) {
- throw new Error('Cannot censor a file without masterKey');
- }
- return request({
- method: 'POST',
- path: "/files/".concat(objectId, "/censor"),
- authOptions: {
- useMasterKey: true
- }
- }).then(function (res) {
- return res.censorResult;
- });
- };
- _.extend(AV.File.prototype,
- /** @lends AV.File.prototype */
- {
- className: '_File',
- _toFullJSON: function _toFullJSON(seenObjects) {
- var _this = this;
- var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- var json = _.clone(this.attributes);
- AV._objectEach(json, function (val, key) {
- json[key] = AV._encode(val, seenObjects, undefined, full);
- });
- AV._objectEach(this._operations, function (val, key) {
- json[key] = val;
- });
- if (_.has(this, 'id')) {
- json.objectId = this.id;
- }
- ['createdAt', 'updatedAt'].forEach(function (key) {
- if (_.has(_this, key)) {
- var val = _this[key];
- json[key] = _.isDate(val) ? val.toJSON() : val;
- }
- });
- if (full) {
- json.__type = 'File';
- }
- return json;
- },
- /**
- * Returns a JSON version of the file with meta data.
- * Inverse to {@link AV.parseJSON}
- * @since 3.0.0
- * @return {Object}
- */
- toFullJSON: function toFullJSON() {
- var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- return this._toFullJSON(seenObjects);
- },
- /**
- * Returns a JSON version of the object.
- * @return {Object}
- */
- toJSON: function toJSON(key, holder) {
- var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
- return this._toFullJSON(seenObjects, false);
- },
- /**
- * Gets a Pointer referencing this file.
- * @private
- */
- _toPointer: function _toPointer() {
- return {
- __type: 'Pointer',
- className: this.className,
- objectId: this.id
- };
- },
- /**
- * Returns the ACL for this file.
- * @returns {AV.ACL} An instance of AV.ACL.
- */
- getACL: function getACL() {
- return this._acl;
- },
- /**
- * Sets the ACL to be used for this file.
- * @param {AV.ACL} acl An instance of AV.ACL.
- */
- setACL: function setACL(acl) {
- if (!(acl instanceof AV.ACL)) {
- return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
- }
- this._acl = acl;
- return this;
- },
- /**
- * Gets the name of the file. Before save is called, this is the filename
- * given by the user. After save is called, that name gets prefixed with a
- * unique identifier.
- */
- name: function name() {
- return this.get('name');
- },
- /**
- * Gets the url of the file. It is only available after you save the file or
- * after you get the file from a AV.Object.
- * @return {String}
- */
- url: function url() {
- return this.get('url');
- },
- /**
- * Gets the attributs of the file object.
- * @param {String} The attribute name which want to get.
- * @returns {Any}
- */
- get: function get(attrName) {
- switch (attrName) {
- case 'objectId':
- return this.id;
- case 'url':
- case 'name':
- case 'mime_type':
- case 'metaData':
- case 'createdAt':
- case 'updatedAt':
- return this.attributes[attrName];
- default:
- return this.attributes.metaData[attrName];
- }
- },
- /**
- * Set the metaData of the file object.
- * @param {Object} Object is an key value Object for setting metaData.
- * @param {String} attr is an optional metadata key.
- * @param {Object} value is an optional metadata value.
- * @returns {String|Number|Array|Object}
- */
- set: function set() {
- var _this2 = this;
- var set = function set(attrName, value) {
- switch (attrName) {
- case 'name':
- case 'url':
- case 'mime_type':
- case 'base64':
- case 'metaData':
- _this2.attributes[attrName] = value;
- break;
- default:
- // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
- _this2.attributes.metaData[attrName] = value;
- break;
- }
- };
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- switch (args.length) {
- case 1:
- // 传入一个 Object
- for (var k in args[0]) {
- set(k, args[0][k]);
- }
- break;
- case 2:
- set(args[0], args[1]);
- break;
- }
- return this;
- },
- /**
- * Set a header for the upload request.
- * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
- *
- * @param {String} key header key
- * @param {String} value header value
- * @return {AV.File} this
- */
- setUploadHeader: function setUploadHeader(key, value) {
- this._uploadHeaders[key] = value;
- return this;
- },
- /**
- * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
- * metadata value if a key is given.Set metadata value if key and value are both given.</p>
- * <p><pre>
- * var metadata = file.metaData(); //Get metadata JSON object.
- * var size = file.metaData('size'); // Get the size metadata value.
- * file.metaData('format', 'jpeg'); //set metadata attribute and value.
- *</pre></p>
- * @return {Object} The file's metadata JSON object.
- * @param {String} attr an optional metadata key.
- * @param {Object} value an optional metadata value.
- **/
- metaData: function metaData(attr, value) {
- if (attr && value) {
- this.attributes.metaData[attr] = value;
- return this;
- } else if (attr && !value) {
- return this.attributes.metaData[attr];
- } else {
- return this.attributes.metaData;
- }
- },
- /**
- * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
- * @return {String} 缩略图URL
- * @param {Number} width 宽度,单位:像素
- * @param {Number} heigth 高度,单位:像素
- * @param {Number} quality 质量,1-100的数字,默认100
- * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
- * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
- */
- thumbnailURL: function thumbnailURL(width, height) {
- var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
- var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
- var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
- var url = this.attributes.url;
- if (!url) {
- throw new Error('Invalid url.');
- }
- if (!width || !height || width <= 0 || height <= 0) {
- throw new Error('Invalid width or height value.');
- }
- if (quality <= 0 || quality > 100) {
- throw new Error('Invalid quality value.');
- }
- var mode = scaleToFit ? 2 : 1;
- return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
- },
- /**
- * Returns the file's size.
- * @return {Number} The file's size in bytes.
- **/
- size: function size() {
- return this.metaData().size;
- },
- /**
- * Returns the file's owner.
- * @return {String} The file's owner id.
- */
- ownerId: function ownerId() {
- return this.metaData().owner;
- },
- /**
- * Destroy the file.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the destroy
- * completes.
- */
- destroy: function destroy(options) {
- if (!this.id) {
- return _promise.default.reject(new Error('The file id does not eixst.'));
- }
- var request = AVRequest('files', null, this.id, 'DELETE', null, options);
- return request;
- },
- /**
- * Request Qiniu upload token
- * @param {string} type
- * @return {Promise} Resolved with the response
- * @private
- */
- _fileToken: function _fileToken(type, authOptions) {
- var name = this.attributes.name;
- var extName = extname(name);
- if (!extName && this._extName) {
- name += this._extName;
- extName = this._extName;
- }
- var data = {
- name: name,
- keep_file_name: authOptions.keepFileName,
- key: authOptions.key,
- ACL: this._acl,
- mime_type: type,
- metaData: this.attributes.metaData
- };
- return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
- },
- /**
- * @callback UploadProgressCallback
- * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
- */
- /**
- * Saves the file to the AV cloud.
- * @param {AuthOptions} [options] AuthOptions plus:
- * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
- * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
- * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
- * @return {Promise} Promise that is resolved when the save finishes.
- */
- save: function save() {
- var _this3 = this;
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- if (this.id) {
- throw new Error('File is already saved.');
- }
- if (!this._previousSave) {
- if (this._data) {
- var mimeType = this.get('mime_type');
- this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
- if (uploadInfo.mime_type) {
- mimeType = uploadInfo.mime_type;
- _this3.set('mime_type', mimeType);
- }
- _this3._token = uploadInfo.token;
- return _promise.default.resolve().then(function () {
- var data = _this3._data;
- if (data && data.base64) {
- return parseBase64(data.base64, mimeType);
- }
- if (data && data.blob) {
- if (!data.blob.type && mimeType) {
- data.blob.type = mimeType;
- }
- if (!data.blob.name) {
- data.blob.name = _this3.get('name');
- }
- return data.blob;
- }
- if (typeof Blob !== 'undefined' && data instanceof Blob) {
- return data;
- }
- throw new TypeError('malformed file data');
- }).then(function (data) {
- var _options = _.extend({}, options); // filter out download progress events
- if (options.onprogress) {
- _options.onprogress = function (event) {
- if (event.direction === 'download') return;
- return options.onprogress(event);
- };
- }
- switch (uploadInfo.provider) {
- case 's3':
- return s3(uploadInfo, data, _this3, _options);
- case 'qcloud':
- return cos(uploadInfo, data, _this3, _options);
- case 'qiniu':
- default:
- return qiniu(uploadInfo, data, _this3, _options);
- }
- }).then(tap(function () {
- return _this3._callback(true);
- }), function (error) {
- _this3._callback(false);
- throw error;
- });
- });
- } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
- // external link file.
- var data = {
- name: this.attributes.name,
- ACL: this._acl,
- metaData: this.attributes.metaData,
- mime_type: this.mimeType,
- url: this.attributes.url
- };
- this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
- _this3.id = response.objectId;
- return _this3;
- });
- }
- }
- return this._previousSave;
- },
- _callback: function _callback(success) {
- AVRequest('fileCallback', null, null, 'post', {
- token: this._token,
- result: success
- }).catch(debug);
- delete this._token;
- delete this._data;
- },
- /**
- * fetch the file from server. If the server's representation of the
- * model differs from its current attributes, they will be overriden,
- * @param {Object} fetchOptions Optional options to set 'keys',
- * 'include' and 'includeACL' option.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the fetch
- * completes.
- */
- fetch: function fetch(fetchOptions, options) {
- if (!this.id) {
- throw new Error('Cannot fetch unsaved file');
- }
- var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
- return request.then(this._finishFetch.bind(this));
- },
- _finishFetch: function _finishFetch(response) {
- var value = AV.Object.prototype.parse(response);
- value.attributes = {
- name: value.name,
- url: value.url,
- mime_type: value.mime_type,
- bucket: value.bucket
- };
- value.attributes.metaData = value.metaData || {};
- value.id = value.objectId; // clean
- delete value.objectId;
- delete value.metaData;
- delete value.url;
- delete value.name;
- delete value.mime_type;
- delete value.bucket;
- _.extend(this, value);
- return this;
- },
- /**
- * Request file censor
- * @since 4.13.0
- * @return {Promise.<string>}
- */
- censor: function censor() {
- if (!this.id) {
- throw new Error('Cannot censor an unsaved file');
- }
- return AV.File.censor(this.id);
- }
- });
- };
- /***/ }),
- /* 478 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _require = __webpack_require__(72),
- getAdapter = _require.getAdapter;
- var debug = __webpack_require__(60)('cos');
- module.exports = function (uploadInfo, data, file) {
- var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
- var fileFormData = {
- field: 'fileContent',
- data: data,
- name: file.attributes.name
- };
- var options = {
- headers: file._uploadHeaders,
- data: {
- op: 'upload'
- },
- onprogress: saveOptions.onprogress
- };
- debug('url: %s, file: %o, options: %o', url, fileFormData, options);
- var upload = getAdapter('upload');
- return upload(url, fileFormData, options).then(function (response) {
- debug(response.status, response.data);
- if (response.ok === false) {
- var error = new Error(response.status);
- error.response = response;
- throw error;
- }
- file.attributes.url = uploadInfo.url;
- file._bucket = uploadInfo.bucket;
- file.id = uploadInfo.objectId;
- return file;
- }, function (error) {
- var response = error.response;
- if (response) {
- debug(response.status, response.data);
- error.statusCode = response.status;
- error.response = response.data;
- }
- throw error;
- });
- };
- /***/ }),
- /* 479 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _sliceInstanceProperty2 = __webpack_require__(61);
- var _Array$from = __webpack_require__(252);
- var _Symbol = __webpack_require__(149);
- var _getIteratorMethod = __webpack_require__(254);
- var _Reflect$construct = __webpack_require__(489);
- var _interopRequireDefault = __webpack_require__(1);
- var _inherits2 = _interopRequireDefault(__webpack_require__(493));
- var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(515));
- var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(517));
- var _classCallCheck2 = _interopRequireDefault(__webpack_require__(522));
- var _createClass2 = _interopRequireDefault(__webpack_require__(523));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _slice = _interopRequireDefault(__webpack_require__(61));
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { var _context8; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context8 = Object.prototype.toString.call(o)).call(_context8, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- var _require = __webpack_require__(72),
- getAdapter = _require.getAdapter;
- var debug = __webpack_require__(60)('leancloud:qiniu');
- var ajax = __webpack_require__(116);
- var btoa = __webpack_require__(524);
- var SHARD_THRESHOLD = 1024 * 1024 * 64;
- var CHUNK_SIZE = 1024 * 1024 * 16;
- function upload(uploadInfo, data, file) {
- var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- // Get the uptoken to upload files to qiniu.
- var uptoken = uploadInfo.token;
- var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
- var fileFormData = {
- field: 'file',
- data: data,
- name: file.attributes.name
- };
- var options = {
- headers: file._uploadHeaders,
- data: {
- name: file.attributes.name,
- key: uploadInfo.key,
- token: uptoken
- },
- onprogress: saveOptions.onprogress
- };
- debug('url: %s, file: %o, options: %o', url, fileFormData, options);
- var upload = getAdapter('upload');
- return upload(url, fileFormData, options).then(function (response) {
- debug(response.status, response.data);
- if (response.ok === false) {
- var message = response.status;
- if (response.data) {
- if (response.data.error) {
- message = response.data.error;
- } else {
- message = (0, _stringify.default)(response.data);
- }
- }
- var error = new Error(message);
- error.response = response;
- throw error;
- }
- file.attributes.url = uploadInfo.url;
- file._bucket = uploadInfo.bucket;
- file.id = uploadInfo.objectId;
- return file;
- }, function (error) {
- var response = error.response;
- if (response) {
- debug(response.status, response.data);
- error.statusCode = response.status;
- error.response = response.data;
- }
- throw error;
- });
- }
- function urlSafeBase64(string) {
- var base64 = btoa(unescape(encodeURIComponent(string)));
- var result = '';
- var _iterator = _createForOfIteratorHelper(base64),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var ch = _step.value;
- switch (ch) {
- case '+':
- result += '-';
- break;
- case '/':
- result += '_';
- break;
- default:
- result += ch;
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- return result;
- }
- var ShardUploader = /*#__PURE__*/function () {
- function ShardUploader(uploadInfo, data, file, saveOptions) {
- var _context,
- _context2,
- _this = this;
- (0, _classCallCheck2.default)(this, ShardUploader);
- this.uploadInfo = uploadInfo;
- this.data = data;
- this.file = file;
- this.size = undefined;
- this.offset = 0;
- this.uploadedChunks = 0;
- var key = urlSafeBase64(uploadInfo.key);
- var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
- this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
- this.upToken = 'UpToken ' + uploadInfo.token;
- this.uploaded = 0;
- if (saveOptions && saveOptions.onprogress) {
- this.onProgress = function (_ref) {
- var loaded = _ref.loaded;
- loaded += _this.uploadedChunks * CHUNK_SIZE;
- if (loaded <= _this.uploaded) {
- return;
- }
- if (_this.size) {
- saveOptions.onprogress({
- loaded: loaded,
- total: _this.size,
- percent: loaded / _this.size * 100
- });
- } else {
- saveOptions.onprogress({
- loaded: loaded
- });
- }
- _this.uploaded = loaded;
- };
- }
- }
- /**
- * @returns {Promise<string>}
- */
- (0, _createClass2.default)(ShardUploader, [{
- key: "getUploadId",
- value: function getUploadId() {
- return ajax({
- method: 'POST',
- url: this.baseURL,
- headers: {
- Authorization: this.upToken
- }
- }).then(function (res) {
- return res.uploadId;
- });
- }
- }, {
- key: "getChunk",
- value: function getChunk() {
- throw new Error('Not implemented');
- }
- /**
- * @param {string} uploadId
- * @param {number} partNumber
- * @param {any} data
- * @returns {Promise<{ partNumber: number, etag: string }>}
- */
- }, {
- key: "uploadPart",
- value: function uploadPart(uploadId, partNumber, data) {
- var _context3, _context4;
- return ajax({
- method: 'PUT',
- url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
- headers: {
- Authorization: this.upToken
- },
- data: data,
- onprogress: this.onProgress
- }).then(function (_ref2) {
- var etag = _ref2.etag;
- return {
- partNumber: partNumber,
- etag: etag
- };
- });
- }
- }, {
- key: "stopUpload",
- value: function stopUpload(uploadId) {
- var _context5;
- return ajax({
- method: 'DELETE',
- url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
- headers: {
- Authorization: this.upToken
- }
- });
- }
- }, {
- key: "upload",
- value: function upload() {
- var _this2 = this;
- var parts = [];
- return this.getUploadId().then(function (uploadId) {
- var uploadPart = function uploadPart() {
- return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
- if (!chunk) {
- return;
- }
- var partNumber = parts.length + 1;
- return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
- parts.push(part);
- _this2.uploadedChunks++;
- return uploadPart();
- });
- }).catch(function (error) {
- return _this2.stopUpload(uploadId).then(function () {
- return _promise.default.reject(error);
- });
- });
- };
- return uploadPart().then(function () {
- var _context6;
- return ajax({
- method: 'POST',
- url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
- headers: {
- Authorization: _this2.upToken
- },
- data: {
- parts: parts,
- fname: _this2.file.attributes.name,
- mimeType: _this2.file.attributes.mime_type
- }
- });
- });
- }).then(function () {
- _this2.file.attributes.url = _this2.uploadInfo.url;
- _this2.file._bucket = _this2.uploadInfo.bucket;
- _this2.file.id = _this2.uploadInfo.objectId;
- return _this2.file;
- });
- }
- }]);
- return ShardUploader;
- }();
- var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
- (0, _inherits2.default)(BlobUploader, _ShardUploader);
- var _super = _createSuper(BlobUploader);
- function BlobUploader(uploadInfo, data, file, saveOptions) {
- var _this3;
- (0, _classCallCheck2.default)(this, BlobUploader);
- _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
- _this3.size = data.size;
- return _this3;
- }
- /**
- * @returns {Blob | null}
- */
- (0, _createClass2.default)(BlobUploader, [{
- key: "getChunk",
- value: function getChunk() {
- var _context7;
- if (this.offset >= this.size) {
- return null;
- }
- var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
- this.offset += chunk.size;
- return chunk;
- }
- }]);
- return BlobUploader;
- }(ShardUploader);
- function isBlob(data) {
- return typeof Blob !== 'undefined' && data instanceof Blob;
- }
- module.exports = function (uploadInfo, data, file) {
- var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
- return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
- }
- return upload(uploadInfo, data, file, saveOptions);
- };
- /***/ }),
- /* 480 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(55);
- __webpack_require__(481);
- var path = __webpack_require__(5);
- module.exports = path.Array.from;
- /***/ }),
- /* 481 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var from = __webpack_require__(482);
- var checkCorrectnessOfIteration = __webpack_require__(178);
- var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
- // eslint-disable-next-line es-x/no-array-from -- required for testing
- Array.from(iterable);
- });
- // `Array.from` method
- // https://tc39.es/ecma262/#sec-array.from
- $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
- from: from
- });
- /***/ }),
- /* 482 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var bind = __webpack_require__(48);
- var call = __webpack_require__(15);
- var toObject = __webpack_require__(34);
- var callWithSafeIterationClosing = __webpack_require__(483);
- var isArrayIteratorMethod = __webpack_require__(166);
- var isConstructor = __webpack_require__(109);
- var lengthOfArrayLike = __webpack_require__(41);
- var createProperty = __webpack_require__(91);
- var getIterator = __webpack_require__(167);
- var getIteratorMethod = __webpack_require__(106);
- var $Array = Array;
- // `Array.from` method implementation
- // https://tc39.es/ecma262/#sec-array.from
- module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = toObject(arrayLike);
- var IS_CONSTRUCTOR = isConstructor(this);
- var argumentsLength = arguments.length;
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
- var iteratorMethod = getIteratorMethod(O);
- var index = 0;
- var length, result, step, iterator, next, value;
- // if the target is not iterable or it's an array with the default iterator - use a simple case
- if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
- iterator = getIterator(O, iteratorMethod);
- next = iterator.next;
- result = IS_CONSTRUCTOR ? new this() : [];
- for (;!(step = call(next, iterator)).done; index++) {
- value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
- createProperty(result, index, value);
- }
- } else {
- length = lengthOfArrayLike(O);
- result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
- for (;length > index; index++) {
- value = mapping ? mapfn(O[index], index) : O[index];
- createProperty(result, index, value);
- }
- }
- result.length = index;
- return result;
- };
- /***/ }),
- /* 483 */
- /***/ (function(module, exports, __webpack_require__) {
- var anObject = __webpack_require__(20);
- var iteratorClose = __webpack_require__(168);
- // call something on iterator step with safe closing on error
- module.exports = function (iterator, fn, value, ENTRIES) {
- try {
- return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
- } catch (error) {
- iteratorClose(iterator, 'throw', error);
- }
- };
- /***/ }),
- /* 484 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(485);
- /***/ }),
- /* 485 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(486);
- module.exports = parent;
- /***/ }),
- /* 486 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(487);
- module.exports = parent;
- /***/ }),
- /* 487 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(488);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 488 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(55);
- var getIteratorMethod = __webpack_require__(106);
- module.exports = getIteratorMethod;
- /***/ }),
- /* 489 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(490);
- /***/ }),
- /* 490 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(491);
- module.exports = parent;
- /***/ }),
- /* 491 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(492);
- var path = __webpack_require__(5);
- module.exports = path.Reflect.construct;
- /***/ }),
- /* 492 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var getBuiltIn = __webpack_require__(18);
- var apply = __webpack_require__(75);
- var bind = __webpack_require__(255);
- var aConstructor = __webpack_require__(174);
- var anObject = __webpack_require__(20);
- var isObject = __webpack_require__(11);
- var create = __webpack_require__(49);
- var fails = __webpack_require__(2);
- var nativeConstruct = getBuiltIn('Reflect', 'construct');
- var ObjectPrototype = Object.prototype;
- var push = [].push;
- // `Reflect.construct` method
- // https://tc39.es/ecma262/#sec-reflect.construct
- // MS Edge supports only 2 arguments and argumentsList argument is optional
- // FF Nightly sets third argument as `new.target`, but does not create `this` from it
- var NEW_TARGET_BUG = fails(function () {
- function F() { /* empty */ }
- return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
- });
- var ARGS_BUG = !fails(function () {
- nativeConstruct(function () { /* empty */ });
- });
- var FORCED = NEW_TARGET_BUG || ARGS_BUG;
- $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
- construct: function construct(Target, args /* , newTarget */) {
- aConstructor(Target);
- anObject(args);
- var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
- if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
- if (Target == newTarget) {
- // w/o altered newTarget, optimization for 0-4 arguments
- switch (args.length) {
- case 0: return new Target();
- case 1: return new Target(args[0]);
- case 2: return new Target(args[0], args[1]);
- case 3: return new Target(args[0], args[1], args[2]);
- case 4: return new Target(args[0], args[1], args[2], args[3]);
- }
- // w/o altered newTarget, lot of arguments case
- var $args = [null];
- apply(push, $args, args);
- return new (apply(bind, Target, $args))();
- }
- // with altered newTarget, not support built-in constructors
- var proto = newTarget.prototype;
- var instance = create(isObject(proto) ? proto : ObjectPrototype);
- var result = apply(Target, instance, args);
- return isObject(result) ? result : instance;
- }
- });
- /***/ }),
- /* 493 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Object$create = __webpack_require__(494);
- var _Object$defineProperty = __webpack_require__(150);
- var setPrototypeOf = __webpack_require__(504);
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = _Object$create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- writable: true,
- configurable: true
- }
- });
- _Object$defineProperty(subClass, "prototype", {
- writable: false
- });
- if (superClass) setPrototypeOf(subClass, superClass);
- }
- module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 494 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(495);
- /***/ }),
- /* 495 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(496);
- /***/ }),
- /* 496 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(497);
- module.exports = parent;
- /***/ }),
- /* 497 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(498);
- module.exports = parent;
- /***/ }),
- /* 498 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(499);
- module.exports = parent;
- /***/ }),
- /* 499 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(500);
- var path = __webpack_require__(5);
- var Object = path.Object;
- module.exports = function create(P, D) {
- return Object.create(P, D);
- };
- /***/ }),
- /* 500 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove from `core-js@4`
- var $ = __webpack_require__(0);
- var DESCRIPTORS = __webpack_require__(14);
- var create = __webpack_require__(49);
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
- create: create
- });
- /***/ }),
- /* 501 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(502);
- /***/ }),
- /* 502 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(503);
- module.exports = parent;
- /***/ }),
- /* 503 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(241);
- module.exports = parent;
- /***/ }),
- /* 504 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Object$setPrototypeOf = __webpack_require__(256);
- var _bindInstanceProperty = __webpack_require__(257);
- function _setPrototypeOf(o, p) {
- var _context;
- module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _setPrototypeOf(o, p);
- }
- module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 505 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(506);
- /***/ }),
- /* 506 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(507);
- module.exports = parent;
- /***/ }),
- /* 507 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(239);
- module.exports = parent;
- /***/ }),
- /* 508 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(509);
- /***/ }),
- /* 509 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(510);
- module.exports = parent;
- /***/ }),
- /* 510 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(511);
- module.exports = parent;
- /***/ }),
- /* 511 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(512);
- module.exports = parent;
- /***/ }),
- /* 512 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(513);
- var FunctionPrototype = Function.prototype;
- module.exports = function (it) {
- var own = it.bind;
- return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
- };
- /***/ }),
- /* 513 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(514);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Function').bind;
- /***/ }),
- /* 514 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove from `core-js@4`
- var $ = __webpack_require__(0);
- var bind = __webpack_require__(255);
- // `Function.prototype.bind` method
- // https://tc39.es/ecma262/#sec-function.prototype.bind
- $({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
- bind: bind
- });
- /***/ }),
- /* 515 */
- /***/ (function(module, exports, __webpack_require__) {
- var _typeof = __webpack_require__(73)["default"];
- var assertThisInitialized = __webpack_require__(516);
- function _possibleConstructorReturn(self, call) {
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
- return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
- }
- return assertThisInitialized(self);
- }
- module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 516 */
- /***/ (function(module, exports) {
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 517 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Object$setPrototypeOf = __webpack_require__(256);
- var _bindInstanceProperty = __webpack_require__(257);
- var _Object$getPrototypeOf = __webpack_require__(518);
- function _getPrototypeOf(o) {
- var _context;
- module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
- return o.__proto__ || _Object$getPrototypeOf(o);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _getPrototypeOf(o);
- }
- module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 518 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(519);
- /***/ }),
- /* 519 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(520);
- /***/ }),
- /* 520 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(521);
- module.exports = parent;
- /***/ }),
- /* 521 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(233);
- module.exports = parent;
- /***/ }),
- /* 522 */
- /***/ (function(module, exports) {
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 523 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Object$defineProperty = __webpack_require__(150);
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- _Object$defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- _Object$defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
- }
- module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 524 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _slice = _interopRequireDefault(__webpack_require__(61));
- // base64 character set, plus padding character (=)
- var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
- module.exports = function (string) {
- var result = '';
- for (var i = 0; i < string.length;) {
- var a = string.charCodeAt(i++);
- var b = string.charCodeAt(i++);
- var c = string.charCodeAt(i++);
- if (a > 255 || b > 255 || c > 255) {
- throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
- }
- var bitmap = a << 16 | b << 8 | c;
- result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
- } // To determine the final padding
- var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
- return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
- };
- /***/ }),
- /* 525 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _ = __webpack_require__(3);
- var ajax = __webpack_require__(116);
- module.exports = function upload(uploadInfo, data, file) {
- var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- return ajax({
- url: uploadInfo.upload_url,
- method: 'PUT',
- data: data,
- headers: _.extend({
- 'Content-Type': file.get('mime_type'),
- 'Cache-Control': 'public, max-age=31536000'
- }, file._uploadHeaders),
- onprogress: saveOptions.onprogress
- }).then(function () {
- file.attributes.url = uploadInfo.url;
- file._bucket = uploadInfo.bucket;
- file.id = uploadInfo.objectId;
- return file;
- });
- };
- /***/ }),
- /* 526 */
- /***/ (function(module, exports, __webpack_require__) {
- (function(){
- var crypt = __webpack_require__(527),
- utf8 = __webpack_require__(258).utf8,
- isBuffer = __webpack_require__(528),
- bin = __webpack_require__(258).bin,
- // The core
- md5 = function (message, options) {
- // Convert to byte array
- if (message.constructor == String)
- if (options && options.encoding === 'binary')
- message = bin.stringToBytes(message);
- else
- message = utf8.stringToBytes(message);
- else if (isBuffer(message))
- message = Array.prototype.slice.call(message, 0);
- else if (!Array.isArray(message))
- message = message.toString();
- // else, assume byte array already
- var m = crypt.bytesToWords(message),
- l = message.length * 8,
- a = 1732584193,
- b = -271733879,
- c = -1732584194,
- d = 271733878;
- // Swap endian
- for (var i = 0; i < m.length; i++) {
- m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
- ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
- }
- // Padding
- m[l >>> 5] |= 0x80 << (l % 32);
- m[(((l + 64) >>> 9) << 4) + 14] = l;
- // Method shortcuts
- var FF = md5._ff,
- GG = md5._gg,
- HH = md5._hh,
- II = md5._ii;
- for (var i = 0; i < m.length; i += 16) {
- var aa = a,
- bb = b,
- cc = c,
- dd = d;
- a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
- d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
- c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
- b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
- a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
- d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
- c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
- b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
- a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
- d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
- c = FF(c, d, a, b, m[i+10], 17, -42063);
- b = FF(b, c, d, a, m[i+11], 22, -1990404162);
- a = FF(a, b, c, d, m[i+12], 7, 1804603682);
- d = FF(d, a, b, c, m[i+13], 12, -40341101);
- c = FF(c, d, a, b, m[i+14], 17, -1502002290);
- b = FF(b, c, d, a, m[i+15], 22, 1236535329);
- a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
- d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
- c = GG(c, d, a, b, m[i+11], 14, 643717713);
- b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
- a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
- d = GG(d, a, b, c, m[i+10], 9, 38016083);
- c = GG(c, d, a, b, m[i+15], 14, -660478335);
- b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
- a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
- d = GG(d, a, b, c, m[i+14], 9, -1019803690);
- c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
- b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
- a = GG(a, b, c, d, m[i+13], 5, -1444681467);
- d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
- c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
- b = GG(b, c, d, a, m[i+12], 20, -1926607734);
- a = HH(a, b, c, d, m[i+ 5], 4, -378558);
- d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
- c = HH(c, d, a, b, m[i+11], 16, 1839030562);
- b = HH(b, c, d, a, m[i+14], 23, -35309556);
- a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
- d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
- c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
- b = HH(b, c, d, a, m[i+10], 23, -1094730640);
- a = HH(a, b, c, d, m[i+13], 4, 681279174);
- d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
- c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
- b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
- a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
- d = HH(d, a, b, c, m[i+12], 11, -421815835);
- c = HH(c, d, a, b, m[i+15], 16, 530742520);
- b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
- a = II(a, b, c, d, m[i+ 0], 6, -198630844);
- d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
- c = II(c, d, a, b, m[i+14], 15, -1416354905);
- b = II(b, c, d, a, m[i+ 5], 21, -57434055);
- a = II(a, b, c, d, m[i+12], 6, 1700485571);
- d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
- c = II(c, d, a, b, m[i+10], 15, -1051523);
- b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
- a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
- d = II(d, a, b, c, m[i+15], 10, -30611744);
- c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
- b = II(b, c, d, a, m[i+13], 21, 1309151649);
- a = II(a, b, c, d, m[i+ 4], 6, -145523070);
- d = II(d, a, b, c, m[i+11], 10, -1120210379);
- c = II(c, d, a, b, m[i+ 2], 15, 718787259);
- b = II(b, c, d, a, m[i+ 9], 21, -343485551);
- a = (a + aa) >>> 0;
- b = (b + bb) >>> 0;
- c = (c + cc) >>> 0;
- d = (d + dd) >>> 0;
- }
- return crypt.endian([a, b, c, d]);
- };
- // Auxiliary functions
- md5._ff = function (a, b, c, d, x, s, t) {
- var n = a + (b & c | ~b & d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._gg = function (a, b, c, d, x, s, t) {
- var n = a + (b & d | c & ~d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._hh = function (a, b, c, d, x, s, t) {
- var n = a + (b ^ c ^ d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._ii = function (a, b, c, d, x, s, t) {
- var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- // Package private blocksize
- md5._blocksize = 16;
- md5._digestsize = 16;
- module.exports = function (message, options) {
- if (message === undefined || message === null)
- throw new Error('Illegal argument ' + message);
- var digestbytes = crypt.wordsToBytes(md5(message, options));
- return options && options.asBytes ? digestbytes :
- options && options.asString ? bin.bytesToString(digestbytes) :
- crypt.bytesToHex(digestbytes);
- };
- })();
- /***/ }),
- /* 527 */
- /***/ (function(module, exports) {
- (function() {
- var base64map
- = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
- crypt = {
- // Bit-wise rotation left
- rotl: function(n, b) {
- return (n << b) | (n >>> (32 - b));
- },
- // Bit-wise rotation right
- rotr: function(n, b) {
- return (n << (32 - b)) | (n >>> b);
- },
- // Swap big-endian to little-endian and vice versa
- endian: function(n) {
- // If number given, swap endian
- if (n.constructor == Number) {
- return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
- }
- // Else, assume array and swap all items
- for (var i = 0; i < n.length; i++)
- n[i] = crypt.endian(n[i]);
- return n;
- },
- // Generate an array of any length of random bytes
- randomBytes: function(n) {
- for (var bytes = []; n > 0; n--)
- bytes.push(Math.floor(Math.random() * 256));
- return bytes;
- },
- // Convert a byte array to big-endian 32-bit words
- bytesToWords: function(bytes) {
- for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
- words[b >>> 5] |= bytes[i] << (24 - b % 32);
- return words;
- },
- // Convert big-endian 32-bit words to a byte array
- wordsToBytes: function(words) {
- for (var bytes = [], b = 0; b < words.length * 32; b += 8)
- bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
- return bytes;
- },
- // Convert a byte array to a hex string
- bytesToHex: function(bytes) {
- for (var hex = [], i = 0; i < bytes.length; i++) {
- hex.push((bytes[i] >>> 4).toString(16));
- hex.push((bytes[i] & 0xF).toString(16));
- }
- return hex.join('');
- },
- // Convert a hex string to a byte array
- hexToBytes: function(hex) {
- for (var bytes = [], c = 0; c < hex.length; c += 2)
- bytes.push(parseInt(hex.substr(c, 2), 16));
- return bytes;
- },
- // Convert a byte array to a base-64 string
- bytesToBase64: function(bytes) {
- for (var base64 = [], i = 0; i < bytes.length; i += 3) {
- var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
- for (var j = 0; j < 4; j++)
- if (i * 8 + j * 6 <= bytes.length * 8)
- base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
- else
- base64.push('=');
- }
- return base64.join('');
- },
- // Convert a base-64 string to a byte array
- base64ToBytes: function(base64) {
- // Remove non-base-64 characters
- base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
- for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
- imod4 = ++i % 4) {
- if (imod4 == 0) continue;
- bytes.push(((base64map.indexOf(base64.charAt(i - 1))
- & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
- | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
- }
- return bytes;
- }
- };
- module.exports = crypt;
- })();
- /***/ }),
- /* 528 */
- /***/ (function(module, exports) {
- /*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- // The _isBuffer check is for Safari 5-7 support, because it's missing
- // Object.prototype.constructor. Remove this eventually
- module.exports = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
- }
- function isBuffer (obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
- }
- // For Node v0.10 support. Remove this eventually.
- function isSlowBuffer (obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
- }
- /***/ }),
- /* 529 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _indexOf = _interopRequireDefault(__webpack_require__(71));
- var dataURItoBlob = function dataURItoBlob(dataURI, type) {
- var _context;
- var byteString; // 传入的 base64,不是 dataURL
- if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
- byteString = atob(dataURI);
- } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
- type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
- byteString = atob(dataURI.split(',')[1]);
- } else {
- byteString = unescape(dataURI.split(',')[1]);
- }
- var ia = new Uint8Array(byteString.length);
- for (var i = 0; i < byteString.length; i++) {
- ia[i] = byteString.charCodeAt(i);
- }
- return new Blob([ia], {
- type: type
- });
- };
- module.exports = dataURItoBlob;
- /***/ }),
- /* 530 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(531));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _indexOf = _interopRequireDefault(__webpack_require__(71));
- var _find = _interopRequireDefault(__webpack_require__(93));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _keys2 = _interopRequireDefault(__webpack_require__(59));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _defineProperty = _interopRequireDefault(__webpack_require__(92));
- var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
- var _ = __webpack_require__(3);
- var AVError = __webpack_require__(46);
- var _require = __webpack_require__(27),
- _request = _require._request;
- var _require2 = __webpack_require__(30),
- isNullOrUndefined = _require2.isNullOrUndefined,
- ensureArray = _require2.ensureArray,
- transformFetchOptions = _require2.transformFetchOptions,
- setValue = _require2.setValue,
- findValue = _require2.findValue,
- isPlainObject = _require2.isPlainObject,
- continueWhile = _require2.continueWhile;
- var recursiveToPointer = function recursiveToPointer(value) {
- if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
- if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
- if (_.isObject(value) && value._toPointer) return value._toPointer();
- return value;
- };
- var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
- var checkReservedKey = function checkReservedKey(key) {
- if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
- throw new Error("key[".concat(key, "] is reserved"));
- }
- };
- var handleBatchResults = function handleBatchResults(results) {
- var firstError = (0, _find.default)(_).call(_, results, function (result) {
- return result instanceof Error;
- });
- if (!firstError) {
- return results;
- }
- var error = new AVError(firstError.code, firstError.message);
- error.results = results;
- throw error;
- }; // Helper function to get a value from a Backbone object as a property
- // or as a function.
- function getValue(object, prop) {
- if (!(object && object[prop])) {
- return null;
- }
- return _.isFunction(object[prop]) ? object[prop]() : object[prop];
- } // AV.Object is analogous to the Java AVObject.
- // It also implements the same interface as a Backbone model.
- module.exports = function (AV) {
- /**
- * Creates a new model with defined attributes. A client id (cid) is
- * automatically generated and assigned for you.
- *
- * <p>You won't normally call this method directly. It is recommended that
- * you use a subclass of <code>AV.Object</code> instead, created by calling
- * <code>extend</code>.</p>
- *
- * <p>However, if you don't want to use a subclass, or aren't sure which
- * subclass is appropriate, you can use this form:<pre>
- * var object = new AV.Object("ClassName");
- * </pre>
- * That is basically equivalent to:<pre>
- * var MyClass = AV.Object.extend("ClassName");
- * var object = new MyClass();
- * </pre></p>
- *
- * @param {Object} attributes The initial set of data to store in the object.
- * @param {Object} options A set of Backbone-like options for creating the
- * object. The only option currently supported is "collection".
- * @see AV.Object.extend
- *
- * @class
- *
- * <p>The fundamental unit of AV data, which implements the Backbone Model
- * interface.</p>
- */
- AV.Object = function (attributes, options) {
- // Allow new AV.Object("ClassName") as a shortcut to _create.
- if (_.isString(attributes)) {
- return AV.Object._create.apply(this, arguments);
- }
- attributes = attributes || {};
- if (options && options.parse) {
- attributes = this.parse(attributes);
- attributes = this._mergeMagicFields(attributes);
- }
- var defaults = getValue(this, 'defaults');
- if (defaults) {
- attributes = _.extend({}, defaults, attributes);
- }
- if (options && options.collection) {
- this.collection = options.collection;
- }
- this._serverData = {}; // The last known data for this object from cloud.
- this._opSetQueue = [{}]; // List of sets of changes to the data.
- this._flags = {};
- this.attributes = {}; // The best estimate of this's current data.
- this._hashedJSON = {}; // Hash of values of containers at last save.
- this._escapedAttributes = {};
- this.cid = _.uniqueId('c');
- this.changed = {};
- this._silent = {};
- this._pending = {};
- this.set(attributes, {
- silent: true
- });
- this.changed = {};
- this._silent = {};
- this._pending = {};
- this._hasData = true;
- this._previousAttributes = _.clone(this.attributes);
- this.initialize.apply(this, arguments);
- };
- /**
- * @lends AV.Object.prototype
- * @property {String} id The objectId of the AV Object.
- */
- /**
- * Saves the given list of AV.Object.
- * If any error is encountered, stops and calls the error handler.
- *
- * @example
- * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
- * // All the objects were saved.
- * }, function(error) {
- * // An error occurred while saving one of the objects.
- * });
- *
- * @param {Array} list A list of <code>AV.Object</code>.
- */
- AV.Object.saveAll = function (list, options) {
- return AV.Object._deepSaveAsync(list, null, options);
- };
- /**
- * Fetch the given list of AV.Object.
- *
- * @param {AV.Object[]} objects A list of <code>AV.Object</code>
- * @param {AuthOptions} options
- * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
- */
- AV.Object.fetchAll = function (objects, options) {
- return _promise.default.resolve().then(function () {
- return _request('batch', null, null, 'POST', {
- requests: (0, _map.default)(_).call(_, objects, function (object) {
- var _context;
- if (!object.className) throw new Error('object must have className to fetch');
- if (!object.id) throw new Error('object must have id to fetch');
- if (object.dirty()) throw new Error('object is modified but not saved');
- return {
- method: 'GET',
- path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
- };
- })
- }, options);
- }).then(function (response) {
- var results = (0, _map.default)(_).call(_, objects, function (object, i) {
- if (response[i].success) {
- var fetchedAttrs = object.parse(response[i].success);
- object._cleanupUnsetKeys(fetchedAttrs);
- object._finishFetch(fetchedAttrs);
- return object;
- }
- if (response[i].success === null) {
- return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
- }
- return new AVError(response[i].error.code, response[i].error.error);
- });
- return handleBatchResults(results);
- });
- }; // Attach all inheritable methods to the AV.Object prototype.
- _.extend(AV.Object.prototype, AV.Events,
- /** @lends AV.Object.prototype */
- {
- _fetchWhenSave: false,
- /**
- * Initialize is an empty function by default. Override it with your own
- * initialization logic.
- */
- initialize: function initialize() {},
- /**
- * Set whether to enable fetchWhenSave option when updating object.
- * When set true, SDK would fetch the latest object after saving.
- * Default is false.
- *
- * @deprecated use AV.Object#save with options.fetchWhenSave instead
- * @param {boolean} enable true to enable fetchWhenSave option.
- */
- fetchWhenSave: function fetchWhenSave(enable) {
- console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
- if (!_.isBoolean(enable)) {
- throw new Error('Expect boolean value for fetchWhenSave');
- }
- this._fetchWhenSave = enable;
- },
- /**
- * Returns the object's objectId.
- * @return {String} the objectId.
- */
- getObjectId: function getObjectId() {
- return this.id;
- },
- /**
- * Returns the object's createdAt attribute.
- * @return {Date}
- */
- getCreatedAt: function getCreatedAt() {
- return this.createdAt;
- },
- /**
- * Returns the object's updatedAt attribute.
- * @return {Date}
- */
- getUpdatedAt: function getUpdatedAt() {
- return this.updatedAt;
- },
- /**
- * Returns a JSON version of the object.
- * @return {Object}
- */
- toJSON: function toJSON(key, holder) {
- var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- return this._toFullJSON(seenObjects, false);
- },
- /**
- * Returns a JSON version of the object with meta data.
- * Inverse to {@link AV.parseJSON}
- * @since 3.0.0
- * @return {Object}
- */
- toFullJSON: function toFullJSON() {
- var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- return this._toFullJSON(seenObjects);
- },
- _toFullJSON: function _toFullJSON(seenObjects) {
- var _this = this;
- var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- var json = _.clone(this.attributes);
- if (_.isArray(seenObjects)) {
- var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
- }
- AV._objectEach(json, function (val, key) {
- json[key] = AV._encode(val, newSeenObjects, undefined, full);
- });
- AV._objectEach(this._operations, function (val, key) {
- json[key] = val;
- });
- if (_.has(this, 'id')) {
- json.objectId = this.id;
- }
- ['createdAt', 'updatedAt'].forEach(function (key) {
- if (_.has(_this, key)) {
- var val = _this[key];
- json[key] = _.isDate(val) ? val.toJSON() : val;
- }
- });
- if (full) {
- json.__type = 'Object';
- if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
- json.className = this.className;
- }
- return json;
- },
- /**
- * Updates _hashedJSON to reflect the current state of this object.
- * Adds any changed hash values to the set of pending changes.
- * @private
- */
- _refreshCache: function _refreshCache() {
- var self = this;
- if (self._refreshingCache) {
- return;
- }
- self._refreshingCache = true;
- AV._objectEach(this.attributes, function (value, key) {
- if (value instanceof AV.Object) {
- value._refreshCache();
- } else if (_.isObject(value)) {
- if (self._resetCacheForKey(key)) {
- self.set(key, new AV.Op.Set(value), {
- silent: true
- });
- }
- }
- });
- delete self._refreshingCache;
- },
- /**
- * Returns true if this object has been modified since its last
- * save/refresh. If an attribute is specified, it returns true only if that
- * particular attribute has been modified since the last save/refresh.
- * @param {String} attr An attribute name (optional).
- * @return {Boolean}
- */
- dirty: function dirty(attr) {
- this._refreshCache();
- var currentChanges = _.last(this._opSetQueue);
- if (attr) {
- return currentChanges[attr] ? true : false;
- }
- if (!this.id) {
- return true;
- }
- if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
- return true;
- }
- return false;
- },
- /**
- * Returns the keys of the modified attribute since its last save/refresh.
- * @return {String[]}
- */
- dirtyKeys: function dirtyKeys() {
- this._refreshCache();
- var currentChanges = _.last(this._opSetQueue);
- return (0, _keys2.default)(_).call(_, currentChanges);
- },
- /**
- * Gets a Pointer referencing this Object.
- * @private
- */
- _toPointer: function _toPointer() {
- // if (!this.id) {
- // throw new Error("Can't serialize an unsaved AV.Object");
- // }
- return {
- __type: 'Pointer',
- className: this.className,
- objectId: this.id
- };
- },
- /**
- * Gets the value of an attribute.
- * @param {String} attr The string name of an attribute.
- */
- get: function get(attr) {
- switch (attr) {
- case 'objectId':
- return this.id;
- case 'createdAt':
- case 'updatedAt':
- return this[attr];
- default:
- return this.attributes[attr];
- }
- },
- /**
- * Gets a relation on the given class for the attribute.
- * @param {String} attr The attribute to get the relation for.
- * @return {AV.Relation}
- */
- relation: function relation(attr) {
- var value = this.get(attr);
- if (value) {
- if (!(value instanceof AV.Relation)) {
- throw new Error('Called relation() on non-relation field ' + attr);
- }
- value._ensureParentAndKey(this, attr);
- return value;
- } else {
- return new AV.Relation(this, attr);
- }
- },
- /**
- * Gets the HTML-escaped value of an attribute.
- */
- escape: function escape(attr) {
- var html = this._escapedAttributes[attr];
- if (html) {
- return html;
- }
- var val = this.attributes[attr];
- var escaped;
- if (isNullOrUndefined(val)) {
- escaped = '';
- } else {
- escaped = _.escape(val.toString());
- }
- this._escapedAttributes[attr] = escaped;
- return escaped;
- },
- /**
- * Returns <code>true</code> if the attribute contains a value that is not
- * null or undefined.
- * @param {String} attr The string name of the attribute.
- * @return {Boolean}
- */
- has: function has(attr) {
- return !isNullOrUndefined(this.attributes[attr]);
- },
- /**
- * Pulls "special" fields like objectId, createdAt, etc. out of attrs
- * and puts them on "this" directly. Removes them from attrs.
- * @param attrs - A dictionary with the data for this AV.Object.
- * @private
- */
- _mergeMagicFields: function _mergeMagicFields(attrs) {
- // Check for changes of magic fields.
- var model = this;
- var specialFields = ['objectId', 'createdAt', 'updatedAt'];
- AV._arrayEach(specialFields, function (attr) {
- if (attrs[attr]) {
- if (attr === 'objectId') {
- model.id = attrs[attr];
- } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
- model[attr] = AV._parseDate(attrs[attr]);
- } else {
- model[attr] = attrs[attr];
- }
- delete attrs[attr];
- }
- });
- return attrs;
- },
- /**
- * Returns the json to be sent to the server.
- * @private
- */
- _startSave: function _startSave() {
- this._opSetQueue.push({});
- },
- /**
- * Called when a save fails because of an error. Any changes that were part
- * of the save need to be merged with changes made after the save. This
- * might throw an exception is you do conflicting operations. For example,
- * if you do:
- * object.set("foo", "bar");
- * object.set("invalid field name", "baz");
- * object.save();
- * object.increment("foo");
- * then this will throw when the save fails and the client tries to merge
- * "bar" with the +1.
- * @private
- */
- _cancelSave: function _cancelSave() {
- var failedChanges = _.first(this._opSetQueue);
- this._opSetQueue = _.rest(this._opSetQueue);
- var nextChanges = _.first(this._opSetQueue);
- AV._objectEach(failedChanges, function (op, key) {
- var op1 = failedChanges[key];
- var op2 = nextChanges[key];
- if (op1 && op2) {
- nextChanges[key] = op2._mergeWithPrevious(op1);
- } else if (op1) {
- nextChanges[key] = op1;
- }
- });
- this._saving = this._saving - 1;
- },
- /**
- * Called when a save completes successfully. This merges the changes that
- * were saved into the known server data, and overrides it with any data
- * sent directly from the server.
- * @private
- */
- _finishSave: function _finishSave(serverData) {
- var _context2;
- // Grab a copy of any object referenced by this object. These instances
- // may have already been fetched, and we don't want to lose their data.
- // Note that doing it like this means we will unify separate copies of the
- // same object, but that's a risk we have to take.
- var fetchedObjects = {};
- AV._traverse(this.attributes, function (object) {
- if (object instanceof AV.Object && object.id && object._hasData) {
- fetchedObjects[object.id] = object;
- }
- });
- var savedChanges = _.first(this._opSetQueue);
- this._opSetQueue = _.rest(this._opSetQueue);
- this._applyOpSet(savedChanges, this._serverData);
- this._mergeMagicFields(serverData);
- var self = this;
- AV._objectEach(serverData, function (value, key) {
- self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
- // by replacing their values with the previously observed values.
- var fetched = AV._traverse(self._serverData[key], function (object) {
- if (object instanceof AV.Object && fetchedObjects[object.id]) {
- return fetchedObjects[object.id];
- }
- });
- if (fetched) {
- self._serverData[key] = fetched;
- }
- });
- this._rebuildAllEstimatedData();
- var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
- this._refreshCache();
- this._opSetQueue = opSetQueue;
- this._saving = this._saving - 1;
- },
- /**
- * Called when a fetch or login is complete to set the known server data to
- * the given object.
- * @private
- */
- _finishFetch: function _finishFetch(serverData, hasData) {
- // Clear out any changes the user might have made previously.
- this._opSetQueue = [{}]; // Bring in all the new server data.
- this._mergeMagicFields(serverData);
- var self = this;
- AV._objectEach(serverData, function (value, key) {
- self._serverData[key] = AV._decode(value, key);
- }); // Refresh the attributes.
- this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
- this._refreshCache();
- this._opSetQueue = [{}];
- this._hasData = hasData;
- },
- /**
- * Applies the set of AV.Op in opSet to the object target.
- * @private
- */
- _applyOpSet: function _applyOpSet(opSet, target) {
- var self = this;
- AV._objectEach(opSet, function (change, key) {
- var _findValue = findValue(target, key),
- _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
- value = _findValue2[0],
- actualTarget = _findValue2[1],
- actualKey = _findValue2[2];
- setValue(target, key, change._estimate(value, self, key));
- if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
- delete actualTarget[actualKey];
- }
- });
- },
- /**
- * Replaces the cached value for key with the current value.
- * Returns true if the new value is different than the old value.
- * @private
- */
- _resetCacheForKey: function _resetCacheForKey(key) {
- var value = this.attributes[key];
- if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
- var json = (0, _stringify.default)(recursiveToPointer(value));
- if (this._hashedJSON[key] !== json) {
- var wasSet = !!this._hashedJSON[key];
- this._hashedJSON[key] = json;
- return wasSet;
- }
- }
- return false;
- },
- /**
- * Populates attributes[key] by starting with the last known data from the
- * server, and applying all of the local changes that have been made to that
- * key since then.
- * @private
- */
- _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
- var self = this;
- delete this.attributes[key];
- if (this._serverData[key]) {
- this.attributes[key] = this._serverData[key];
- }
- AV._arrayEach(this._opSetQueue, function (opSet) {
- var op = opSet[key];
- if (op) {
- var _findValue3 = findValue(self.attributes, key),
- _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
- value = _findValue4[0],
- actualTarget = _findValue4[1],
- actualKey = _findValue4[2],
- firstKey = _findValue4[3];
- setValue(self.attributes, key, op._estimate(value, self, key));
- if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
- delete actualTarget[actualKey];
- }
- self._resetCacheForKey(firstKey);
- }
- });
- },
- /**
- * Populates attributes by starting with the last known data from the
- * server, and applying all of the local changes that have been made since
- * then.
- * @private
- */
- _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
- var self = this;
- var previousAttributes = _.clone(this.attributes);
- this.attributes = _.clone(this._serverData);
- AV._arrayEach(this._opSetQueue, function (opSet) {
- self._applyOpSet(opSet, self.attributes);
- AV._objectEach(opSet, function (op, key) {
- self._resetCacheForKey(key);
- });
- }); // Trigger change events for anything that changed because of the fetch.
- AV._objectEach(previousAttributes, function (oldValue, key) {
- if (self.attributes[key] !== oldValue) {
- self.trigger('change:' + key, self, self.attributes[key], {});
- }
- });
- AV._objectEach(this.attributes, function (newValue, key) {
- if (!_.has(previousAttributes, key)) {
- self.trigger('change:' + key, self, newValue, {});
- }
- });
- },
- /**
- * Sets a hash of model attributes on the object, firing
- * <code>"change"</code> unless you choose to silence it.
- *
- * <p>You can call it with an object containing keys and values, or with one
- * key and value. For example:</p>
- *
- * @example
- * gameTurn.set({
- * player: player1,
- * diceRoll: 2
- * });
- *
- * game.set("currentPlayer", player2);
- *
- * game.set("finished", true);
- *
- * @param {String} key The key to set.
- * @param {Any} value The value to give it.
- * @param {Object} [options]
- * @param {Boolean} [options.silent]
- * @return {AV.Object} self if succeeded, throws if the value is not valid.
- * @see AV.Object#validate
- */
- set: function set(key, value, options) {
- var attrs;
- if (_.isObject(key) || isNullOrUndefined(key)) {
- attrs = _.mapObject(key, function (v, k) {
- checkReservedKey(k);
- return AV._decode(v, k);
- });
- options = value;
- } else {
- attrs = {};
- checkReservedKey(key);
- attrs[key] = AV._decode(value, key);
- } // Extract attributes and options.
- options = options || {};
- if (!attrs) {
- return this;
- }
- if (attrs instanceof AV.Object) {
- attrs = attrs.attributes;
- } // If the unset option is used, every attribute should be a Unset.
- if (options.unset) {
- AV._objectEach(attrs, function (unused_value, key) {
- attrs[key] = new AV.Op.Unset();
- });
- } // Apply all the attributes to get the estimated values.
- var dataToValidate = _.clone(attrs);
- var self = this;
- AV._objectEach(dataToValidate, function (value, key) {
- if (value instanceof AV.Op) {
- dataToValidate[key] = value._estimate(self.attributes[key], self, key);
- if (dataToValidate[key] === AV.Op._UNSET) {
- delete dataToValidate[key];
- }
- }
- }); // Run validation.
- this._validate(attrs, options);
- options.changes = {};
- var escaped = this._escapedAttributes; // Update attributes.
- AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
- var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
- // since the location where it was parsed does not have access to
- // this object.
- if (val instanceof AV.Relation) {
- val.parent = self;
- }
- if (!(val instanceof AV.Op)) {
- val = new AV.Op.Set(val);
- } // See if this change will actually have any effect.
- var isRealChange = true;
- if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
- isRealChange = false;
- }
- if (isRealChange) {
- delete escaped[attr];
- if (options.silent) {
- self._silent[attr] = true;
- } else {
- options.changes[attr] = true;
- }
- }
- var currentChanges = _.last(self._opSetQueue);
- currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
- self._rebuildEstimatedDataForKey(attr);
- if (isRealChange) {
- self.changed[attr] = self.attributes[attr];
- if (!options.silent) {
- self._pending[attr] = true;
- }
- } else {
- delete self.changed[attr];
- delete self._pending[attr];
- }
- });
- if (!options.silent) {
- this.change(options);
- }
- return this;
- },
- /**
- * Remove an attribute from the model, firing <code>"change"</code> unless
- * you choose to silence it. This is a noop if the attribute doesn't
- * exist.
- * @param key {String} The key.
- */
- unset: function unset(attr, options) {
- options = options || {};
- options.unset = true;
- return this.set(attr, null, options);
- },
- /**
- * Atomically increments the value of the given attribute the next time the
- * object is saved. If no amount is specified, 1 is used by default.
- *
- * @param key {String} The key.
- * @param amount {Number} The amount to increment by.
- */
- increment: function increment(attr, amount) {
- if (_.isUndefined(amount) || _.isNull(amount)) {
- amount = 1;
- }
- return this.set(attr, new AV.Op.Increment(amount));
- },
- /**
- * Atomically add an object to the end of the array associated with a given
- * key.
- * @param key {String} The key.
- * @param item {} The item to add.
- */
- add: function add(attr, item) {
- return this.set(attr, new AV.Op.Add(ensureArray(item)));
- },
- /**
- * Atomically add an object to the array associated with a given key, only
- * if it is not already present in the array. The position of the insert is
- * not guaranteed.
- *
- * @param key {String} The key.
- * @param item {} The object to add.
- */
- addUnique: function addUnique(attr, item) {
- return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
- },
- /**
- * Atomically remove all instances of an object from the array associated
- * with a given key.
- *
- * @param key {String} The key.
- * @param item {} The object to remove.
- */
- remove: function remove(attr, item) {
- return this.set(attr, new AV.Op.Remove(ensureArray(item)));
- },
- /**
- * Atomically apply a "bit and" operation on the value associated with a
- * given key.
- *
- * @param key {String} The key.
- * @param value {Number} The value to apply.
- */
- bitAnd: function bitAnd(attr, value) {
- return this.set(attr, new AV.Op.BitAnd(value));
- },
- /**
- * Atomically apply a "bit or" operation on the value associated with a
- * given key.
- *
- * @param key {String} The key.
- * @param value {Number} The value to apply.
- */
- bitOr: function bitOr(attr, value) {
- return this.set(attr, new AV.Op.BitOr(value));
- },
- /**
- * Atomically apply a "bit xor" operation on the value associated with a
- * given key.
- *
- * @param key {String} The key.
- * @param value {Number} The value to apply.
- */
- bitXor: function bitXor(attr, value) {
- return this.set(attr, new AV.Op.BitXor(value));
- },
- /**
- * Returns an instance of a subclass of AV.Op describing what kind of
- * modification has been performed on this field since the last time it was
- * saved. For example, after calling object.increment("x"), calling
- * object.op("x") would return an instance of AV.Op.Increment.
- *
- * @param key {String} The key.
- * @returns {AV.Op} The operation, or undefined if none.
- */
- op: function op(attr) {
- return _.last(this._opSetQueue)[attr];
- },
- /**
- * Clear all attributes on the model, firing <code>"change"</code> unless
- * you choose to silence it.
- */
- clear: function clear(options) {
- options = options || {};
- options.unset = true;
- var keysToClear = _.extend(this.attributes, this._operations);
- return this.set(keysToClear, options);
- },
- /**
- * Clears any (or specific) changes to the model made since the last save.
- * @param {string|string[]} [keys] specify keys to revert.
- */
- revert: function revert(keys) {
- var lastOp = _.last(this._opSetQueue);
- var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
- _keys.forEach(function (key) {
- delete lastOp[key];
- });
- this._rebuildAllEstimatedData();
- return this;
- },
- /**
- * Returns a JSON-encoded set of operations to be sent with the next save
- * request.
- * @private
- */
- _getSaveJSON: function _getSaveJSON() {
- var json = _.clone(_.first(this._opSetQueue));
- AV._objectEach(json, function (op, key) {
- json[key] = op.toJSON();
- });
- return json;
- },
- /**
- * Returns true if this object can be serialized for saving.
- * @private
- */
- _canBeSerialized: function _canBeSerialized() {
- return AV.Object._canBeSerializedAsValue(this.attributes);
- },
- /**
- * Fetch the model from the server. If the server's representation of the
- * model differs from its current attributes, they will be overriden,
- * triggering a <code>"change"</code> event.
- * @param {Object} fetchOptions Optional options to set 'keys',
- * 'include' and 'includeACL' option.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the fetch
- * completes.
- */
- fetch: function fetch() {
- var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var options = arguments.length > 1 ? arguments[1] : undefined;
- if (!this.id) {
- throw new Error('Cannot fetch unsaved object');
- }
- var self = this;
- var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
- return request.then(function (response) {
- var fetchedAttrs = self.parse(response);
- self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
- self._finishFetch(fetchedAttrs, true);
- return self;
- });
- },
- _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
- var _this2 = this;
- var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
- _.forEach(fetchedKeys, function (key) {
- if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
- });
- },
- /**
- * Set a hash of model attributes, and save the model to the server.
- * updatedAt will be updated when the request returns.
- * You can either call it as:<pre>
- * object.save();</pre>
- * or<pre>
- * object.save(null, options);</pre>
- * or<pre>
- * object.save(attrs, options);</pre>
- * or<pre>
- * object.save(key, value, options);</pre>
- *
- * @example
- * gameTurn.save({
- * player: "Jake Cutter",
- * diceRoll: 2
- * }).then(function(gameTurnAgain) {
- * // The save was successful.
- * }, function(error) {
- * // The save failed. Error is an instance of AVError.
- * });
- *
- * @param {AuthOptions} options AuthOptions plus:
- * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
- * @param {AV.Query} options.query Save object only when it matches the query
- * @return {Promise} A promise that is fulfilled when the save
- * completes.
- * @see AVError
- */
- save: function save(arg1, arg2, arg3) {
- var attrs, current, options;
- if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
- attrs = arg1;
- options = arg2;
- } else {
- attrs = {};
- attrs[arg1] = arg2;
- options = arg3;
- }
- options = _.clone(options) || {};
- if (options.wait) {
- current = _.clone(this.attributes);
- }
- var setOptions = _.clone(options) || {};
- if (setOptions.wait) {
- setOptions.silent = true;
- }
- if (attrs) {
- this.set(attrs, setOptions);
- }
- var model = this;
- var unsavedChildren = [];
- var unsavedFiles = [];
- AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
- if (unsavedChildren.length + unsavedFiles.length > 1) {
- return AV.Object._deepSaveAsync(this, model, options);
- }
- this._startSave();
- this._saving = (this._saving || 0) + 1;
- this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
- this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
- var method = model.id ? 'PUT' : 'POST';
- var json = model._getSaveJSON();
- var query = {};
- if (model._fetchWhenSave || options.fetchWhenSave) {
- query['new'] = 'true';
- } // user login option
- if (options._failOnNotExist) {
- query.failOnNotExist = 'true';
- }
- if (options.query) {
- var queryParams;
- if (typeof options.query._getParams === 'function') {
- queryParams = options.query._getParams();
- if (queryParams) {
- query.where = queryParams.where;
- }
- }
- if (!query.where) {
- var error = new Error('options.query is not an AV.Query');
- throw error;
- }
- }
- _.extend(json, model._flags);
- var route = 'classes';
- var className = model.className;
- if (model.className === '_User' && !model.id) {
- // Special-case user sign-up.
- route = 'users';
- className = null;
- } //hook makeRequest in options.
- var makeRequest = options._makeRequest || _request;
- var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
- requestPromise = requestPromise.then(function (resp) {
- var serverAttrs = model.parse(resp);
- if (options.wait) {
- serverAttrs = _.extend(attrs || {}, serverAttrs);
- }
- model._finishSave(serverAttrs);
- if (options.wait) {
- model.set(current, setOptions);
- }
- return model;
- }, function (error) {
- model._cancelSave();
- throw error;
- });
- return requestPromise;
- });
- return this._allPreviousSaves;
- },
- /**
- * Destroy this model on the server if it was already persisted.
- * Optimistically removes the model from its collection, if it has one.
- * @param {AuthOptions} options AuthOptions plus:
- * @param {Boolean} [options.wait] wait for the server to respond
- * before removal.
- *
- * @return {Promise} A promise that is fulfilled when the destroy
- * completes.
- */
- destroy: function destroy(options) {
- options = options || {};
- var model = this;
- var triggerDestroy = function triggerDestroy() {
- model.trigger('destroy', model, model.collection, options);
- };
- if (!this.id) {
- return triggerDestroy();
- }
- if (!options.wait) {
- triggerDestroy();
- }
- var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
- return request.then(function () {
- if (options.wait) {
- triggerDestroy();
- }
- return model;
- });
- },
- /**
- * Converts a response into the hash of attributes to be set on the model.
- * @ignore
- */
- parse: function parse(resp) {
- var output = _.clone(resp);
- ['createdAt', 'updatedAt'].forEach(function (key) {
- if (output[key]) {
- output[key] = AV._parseDate(output[key]);
- }
- });
- if (output.createdAt && !output.updatedAt) {
- output.updatedAt = output.createdAt;
- }
- return output;
- },
- /**
- * Creates a new model with identical attributes to this one.
- * @return {AV.Object}
- */
- clone: function clone() {
- return new this.constructor(this.attributes);
- },
- /**
- * Returns true if this object has never been saved to AV.
- * @return {Boolean}
- */
- isNew: function isNew() {
- return !this.id;
- },
- /**
- * Call this method to manually fire a `"change"` event for this model and
- * a `"change:attribute"` event for each changed attribute.
- * Calling this will cause all objects observing the model to update.
- */
- change: function change(options) {
- options = options || {};
- var changing = this._changing;
- this._changing = true; // Silent changes become pending changes.
- var self = this;
- AV._objectEach(this._silent, function (attr) {
- self._pending[attr] = true;
- }); // Silent changes are triggered.
- var changes = _.extend({}, options.changes, this._silent);
- this._silent = {};
- AV._objectEach(changes, function (unused_value, attr) {
- self.trigger('change:' + attr, self, self.get(attr), options);
- });
- if (changing) {
- return this;
- } // This is to get around lint not letting us make a function in a loop.
- var deleteChanged = function deleteChanged(value, attr) {
- if (!self._pending[attr] && !self._silent[attr]) {
- delete self.changed[attr];
- }
- }; // Continue firing `"change"` events while there are pending changes.
- while (!_.isEmpty(this._pending)) {
- this._pending = {};
- this.trigger('change', this, options); // Pending and silent changes still remain.
- AV._objectEach(this.changed, deleteChanged);
- self._previousAttributes = _.clone(this.attributes);
- }
- this._changing = false;
- return this;
- },
- /**
- * Gets the previous value of an attribute, recorded at the time the last
- * <code>"change"</code> event was fired.
- * @param {String} attr Name of the attribute to get.
- */
- previous: function previous(attr) {
- if (!arguments.length || !this._previousAttributes) {
- return null;
- }
- return this._previousAttributes[attr];
- },
- /**
- * Gets all of the attributes of the model at the time of the previous
- * <code>"change"</code> event.
- * @return {Object}
- */
- previousAttributes: function previousAttributes() {
- return _.clone(this._previousAttributes);
- },
- /**
- * Checks if the model is currently in a valid state. It's only possible to
- * get into an *invalid* state if you're using silent changes.
- * @return {Boolean}
- */
- isValid: function isValid() {
- try {
- this.validate(this.attributes);
- } catch (error) {
- return false;
- }
- return true;
- },
- /**
- * You should not call this function directly unless you subclass
- * <code>AV.Object</code>, in which case you can override this method
- * to provide additional validation on <code>set</code> and
- * <code>save</code>. Your implementation should throw an Error if
- * the attrs is invalid
- *
- * @param {Object} attrs The current data to validate.
- * @see AV.Object#set
- */
- validate: function validate(attrs) {
- if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
- throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
- }
- },
- /**
- * Run validation against a set of incoming attributes, returning `true`
- * if all is well. If a specific `error` callback has been passed,
- * call that instead of firing the general `"error"` event.
- * @private
- */
- _validate: function _validate(attrs, options) {
- if (options.silent || !this.validate) {
- return;
- }
- attrs = _.extend({}, this.attributes, attrs);
- this.validate(attrs);
- },
- /**
- * Returns the ACL for this object.
- * @returns {AV.ACL} An instance of AV.ACL.
- * @see AV.Object#get
- */
- getACL: function getACL() {
- return this.get('ACL');
- },
- /**
- * Sets the ACL to be used for this object.
- * @param {AV.ACL} acl An instance of AV.ACL.
- * @param {Object} options Optional Backbone-like options object to be
- * passed in to set.
- * @return {AV.Object} self
- * @see AV.Object#set
- */
- setACL: function setACL(acl, options) {
- return this.set('ACL', acl, options);
- },
- disableBeforeHook: function disableBeforeHook() {
- this.ignoreHook('beforeSave');
- this.ignoreHook('beforeUpdate');
- this.ignoreHook('beforeDelete');
- },
- disableAfterHook: function disableAfterHook() {
- this.ignoreHook('afterSave');
- this.ignoreHook('afterUpdate');
- this.ignoreHook('afterDelete');
- },
- ignoreHook: function ignoreHook(hookName) {
- if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
- throw new Error('Unsupported hookName: ' + hookName);
- }
- if (!AV.hookKey) {
- throw new Error('ignoreHook required hookKey');
- }
- if (!this._flags.__ignore_hooks) {
- this._flags.__ignore_hooks = [];
- }
- this._flags.__ignore_hooks.push(hookName);
- }
- });
- /**
- * Creates an instance of a subclass of AV.Object for the give classname
- * and id.
- * @param {String|Function} class the className or a subclass of AV.Object.
- * @param {String} id The object id of this model.
- * @return {AV.Object} A new subclass instance of AV.Object.
- */
- AV.Object.createWithoutData = function (klass, id, hasData) {
- var _klass;
- if (_.isString(klass)) {
- _klass = AV.Object._getSubclass(klass);
- } else if (klass.prototype && klass.prototype instanceof AV.Object) {
- _klass = klass;
- } else {
- throw new Error('class must be a string or a subclass of AV.Object.');
- }
- if (!id) {
- throw new TypeError('The objectId must be provided');
- }
- var object = new _klass();
- object.id = id;
- object._hasData = hasData;
- return object;
- };
- /**
- * Delete objects in batch.
- * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the save
- * completes.
- */
- AV.Object.destroyAll = function (objects) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (!objects || objects.length === 0) {
- return _promise.default.resolve();
- }
- var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
- return (0, _stringify.default)({
- className: object.className,
- flags: object._flags
- });
- });
- var body = {
- requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
- var _context3;
- var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
- return {
- method: 'DELETE',
- path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
- body: objects[0]._flags
- };
- })
- };
- return _request('batch', null, null, 'POST', body, options).then(function (response) {
- var firstError = (0, _find.default)(_).call(_, response, function (result) {
- return !result.success;
- });
- if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
- return undefined;
- });
- };
- /**
- * Returns the appropriate subclass for making new instances of the given
- * className string.
- * @private
- */
- AV.Object._getSubclass = function (className) {
- if (!_.isString(className)) {
- throw new Error('AV.Object._getSubclass requires a string argument.');
- }
- var ObjectClass = AV.Object._classMap[className];
- if (!ObjectClass) {
- ObjectClass = AV.Object.extend(className);
- AV.Object._classMap[className] = ObjectClass;
- }
- return ObjectClass;
- };
- /**
- * Creates an instance of a subclass of AV.Object for the given classname.
- * @private
- */
- AV.Object._create = function (className, attributes, options) {
- var ObjectClass = AV.Object._getSubclass(className);
- return new ObjectClass(attributes, options);
- }; // Set up a map of className to class so that we can create new instances of
- // AV Objects from JSON automatically.
- AV.Object._classMap = {};
- AV.Object._extend = AV._extend;
- /**
- * Creates a new model with defined attributes,
- * It's the same with
- * <pre>
- * new AV.Object(attributes, options);
- * </pre>
- * @param {Object} attributes The initial set of data to store in the object.
- * @param {Object} options A set of Backbone-like options for creating the
- * object. The only option currently supported is "collection".
- * @return {AV.Object}
- * @since v0.4.4
- * @see AV.Object
- * @see AV.Object.extend
- */
- AV.Object['new'] = function (attributes, options) {
- return new AV.Object(attributes, options);
- };
- /**
- * Creates a new subclass of AV.Object for the given AV class name.
- *
- * <p>Every extension of a AV class will inherit from the most recent
- * previous extension of that class. When a AV.Object is automatically
- * created by parsing JSON, it will use the most recent extension of that
- * class.</p>
- *
- * @example
- * var MyClass = AV.Object.extend("MyClass", {
- * // Instance properties
- * }, {
- * // Class properties
- * });
- *
- * @param {String} className The name of the AV class backing this model.
- * @param {Object} protoProps Instance properties to add to instances of the
- * class returned from this method.
- * @param {Object} classProps Class properties to add the class returned from
- * this method.
- * @return {Class} A new subclass of AV.Object.
- */
- AV.Object.extend = function (className, protoProps, classProps) {
- // Handle the case with only two args.
- if (!_.isString(className)) {
- if (className && _.has(className, 'className')) {
- return AV.Object.extend(className.className, className, protoProps);
- } else {
- throw new Error("AV.Object.extend's first argument should be the className.");
- }
- } // If someone tries to subclass "User", coerce it to the right type.
- if (className === 'User') {
- className = '_User';
- }
- var NewClassObject = null;
- if (_.has(AV.Object._classMap, className)) {
- var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
- // OldClassObject. This is multiple inheritance, which isn't supported.
- // For now, let's just pick one.
- if (protoProps || classProps) {
- NewClassObject = OldClassObject._extend(protoProps, classProps);
- } else {
- return OldClassObject;
- }
- } else {
- protoProps = protoProps || {};
- protoProps._className = className;
- NewClassObject = this._extend(protoProps, classProps);
- } // Extending a subclass should reuse the classname automatically.
- NewClassObject.extend = function (arg0) {
- var _context4;
- if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
- return AV.Object.extend.apply(NewClassObject, arguments);
- }
- var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
- return AV.Object.extend.apply(NewClassObject, newArguments);
- }; // Add the query property descriptor.
- (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
- NewClassObject['new'] = function (attributes, options) {
- return new NewClassObject(attributes, options);
- };
- AV.Object._classMap[className] = NewClassObject;
- return NewClassObject;
- }; // ES6 class syntax support
- (0, _defineProperty.default)(AV.Object.prototype, 'className', {
- get: function get() {
- var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
- if (className === 'User') {
- return '_User';
- }
- return className;
- }
- });
- /**
- * Register a class.
- * If a subclass of <code>AV.Object</code> is defined with your own implement
- * rather then <code>AV.Object.extend</code>, the subclass must be registered.
- * @param {Function} klass A subclass of <code>AV.Object</code>
- * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
- * @example
- * class Person extend AV.Object {}
- * AV.Object.register(Person);
- */
- AV.Object.register = function (klass, name) {
- if (!(klass.prototype instanceof AV.Object)) {
- throw new Error('registered class is not a subclass of AV.Object');
- }
- var className = name || klass.name;
- if (!className.length) {
- throw new Error('registered class must be named');
- }
- if (name) {
- klass._LCClassName = name;
- }
- AV.Object._classMap[className] = klass;
- };
- /**
- * Get a new Query of the current class
- * @name query
- * @memberof AV.Object
- * @type AV.Query
- * @readonly
- * @since v3.1.0
- * @example
- * const Post = AV.Object.extend('Post');
- * Post.query.equalTo('author', 'leancloud').find().then();
- */
- (0, _defineProperty.default)(AV.Object, 'query', {
- get: function get() {
- return new AV.Query(this.prototype.className);
- }
- });
- AV.Object._findUnsavedChildren = function (objects, children, files) {
- AV._traverse(objects, function (object) {
- if (object instanceof AV.Object) {
- if (object.dirty()) {
- children.push(object);
- }
- return;
- }
- if (object instanceof AV.File) {
- if (!object.id) {
- files.push(object);
- }
- return;
- }
- });
- };
- AV.Object._canBeSerializedAsValue = function (object) {
- var canBeSerializedAsValue = true;
- if (object instanceof AV.Object || object instanceof AV.File) {
- canBeSerializedAsValue = !!object.id;
- } else if (_.isArray(object)) {
- AV._arrayEach(object, function (child) {
- if (!AV.Object._canBeSerializedAsValue(child)) {
- canBeSerializedAsValue = false;
- }
- });
- } else if (_.isObject(object)) {
- AV._objectEach(object, function (child) {
- if (!AV.Object._canBeSerializedAsValue(child)) {
- canBeSerializedAsValue = false;
- }
- });
- }
- return canBeSerializedAsValue;
- };
- AV.Object._deepSaveAsync = function (object, model, options) {
- var unsavedChildren = [];
- var unsavedFiles = [];
- AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
- unsavedFiles = _.uniq(unsavedFiles);
- var promise = _promise.default.resolve();
- _.each(unsavedFiles, function (file) {
- promise = promise.then(function () {
- return file.save();
- });
- });
- var objects = _.uniq(unsavedChildren);
- var remaining = _.uniq(objects);
- return promise.then(function () {
- return continueWhile(function () {
- return remaining.length > 0;
- }, function () {
- // Gather up all the objects that can be saved in this batch.
- var batch = [];
- var newRemaining = [];
- AV._arrayEach(remaining, function (object) {
- if (object._canBeSerialized()) {
- batch.push(object);
- } else {
- newRemaining.push(object);
- }
- });
- remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
- if (batch.length === 0) {
- return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
- } // Reserve a spot in every object's save queue.
- var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
- return object._allPreviousSaves || _promise.default.resolve();
- })); // Save a single batch, whether previous saves succeeded or failed.
- var bathSavePromise = readyToStart.then(function () {
- return _request('batch', null, null, 'POST', {
- requests: (0, _map.default)(_).call(_, batch, function (object) {
- var method = object.id ? 'PUT' : 'POST';
- var json = object._getSaveJSON();
- _.extend(json, object._flags);
- var route = 'classes';
- var className = object.className;
- var path = "/".concat(route, "/").concat(className);
- if (object.className === '_User' && !object.id) {
- // Special-case user sign-up.
- path = '/users';
- }
- var path = "/1.1".concat(path);
- if (object.id) {
- path = path + '/' + object.id;
- }
- object._startSave();
- return {
- method: method,
- path: path,
- body: json,
- params: options && options.fetchWhenSave ? {
- fetchWhenSave: true
- } : undefined
- };
- })
- }, options).then(function (response) {
- var results = (0, _map.default)(_).call(_, batch, function (object, i) {
- if (response[i].success) {
- object._finishSave(object.parse(response[i].success));
- return object;
- }
- object._cancelSave();
- return new AVError(response[i].error.code, response[i].error.error);
- });
- return handleBatchResults(results);
- });
- });
- AV._arrayEach(batch, function (object) {
- object._allPreviousSaves = bathSavePromise;
- });
- return bathSavePromise;
- });
- }).then(function () {
- return object;
- });
- };
- };
- /***/ }),
- /* 531 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithHoles = __webpack_require__(532);
- var iterableToArrayLimit = __webpack_require__(540);
- var unsupportedIterableToArray = __webpack_require__(541);
- var nonIterableRest = __webpack_require__(551);
- function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
- }
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 532 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Array$isArray = __webpack_require__(533);
- function _arrayWithHoles(arr) {
- if (_Array$isArray(arr)) return arr;
- }
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 533 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(534);
- /***/ }),
- /* 534 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(535);
- /***/ }),
- /* 535 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(536);
- module.exports = parent;
- /***/ }),
- /* 536 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(537);
- module.exports = parent;
- /***/ }),
- /* 537 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(538);
- module.exports = parent;
- /***/ }),
- /* 538 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(539);
- var path = __webpack_require__(5);
- module.exports = path.Array.isArray;
- /***/ }),
- /* 539 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var isArray = __webpack_require__(90);
- // `Array.isArray` method
- // https://tc39.es/ecma262/#sec-array.isarray
- $({ target: 'Array', stat: true }, {
- isArray: isArray
- });
- /***/ }),
- /* 540 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Symbol = __webpack_require__(242);
- var _getIteratorMethod = __webpack_require__(254);
- function _iterableToArrayLimit(arr, i) {
- var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
- if (_i == null) return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
- module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 541 */
- /***/ (function(module, exports, __webpack_require__) {
- var _sliceInstanceProperty = __webpack_require__(542);
- var _Array$from = __webpack_require__(546);
- var arrayLikeToArray = __webpack_require__(550);
- function _unsupportedIterableToArray(o, minLen) {
- var _context;
- if (!o) return;
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return _Array$from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
- }
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 542 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(543);
- /***/ }),
- /* 543 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(544);
- /***/ }),
- /* 544 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(545);
- module.exports = parent;
- /***/ }),
- /* 545 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(240);
- module.exports = parent;
- /***/ }),
- /* 546 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(547);
- /***/ }),
- /* 547 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(548);
- /***/ }),
- /* 548 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(549);
- module.exports = parent;
- /***/ }),
- /* 549 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(253);
- module.exports = parent;
- /***/ }),
- /* 550 */
- /***/ (function(module, exports) {
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 551 */
- /***/ (function(module, exports) {
- function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 552 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(553);
- module.exports = parent;
- /***/ }),
- /* 553 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(554);
- var path = __webpack_require__(5);
- var Object = path.Object;
- var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
- return Object.getOwnPropertyDescriptor(it, key);
- };
- if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
- /***/ }),
- /* 554 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var fails = __webpack_require__(2);
- var toIndexedObject = __webpack_require__(32);
- var nativeGetOwnPropertyDescriptor = __webpack_require__(62).f;
- var DESCRIPTORS = __webpack_require__(14);
- var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
- var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
- getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
- return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
- }
- });
- /***/ }),
- /* 555 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _ = __webpack_require__(3);
- var AVError = __webpack_require__(46);
- module.exports = function (AV) {
- AV.Role = AV.Object.extend('_Role',
- /** @lends AV.Role.prototype */
- {
- // Instance Methods
- /**
- * Represents a Role on the AV server. Roles represent groupings of
- * Users for the purposes of granting permissions (e.g. specifying an ACL
- * for an Object). Roles are specified by their sets of child users and
- * child roles, all of which are granted any permissions that the parent
- * role has.
- *
- * <p>Roles must have a name (which cannot be changed after creation of the
- * role), and must specify an ACL.</p>
- * An AV.Role is a local representation of a role persisted to the AV
- * cloud.
- * @class AV.Role
- * @param {String} name The name of the Role to create.
- * @param {AV.ACL} acl The ACL for this role.
- */
- constructor: function constructor(name, acl) {
- if (_.isString(name)) {
- AV.Object.prototype.constructor.call(this, null, null);
- this.setName(name);
- } else {
- AV.Object.prototype.constructor.call(this, name, acl);
- }
- if (acl) {
- if (!(acl instanceof AV.ACL)) {
- throw new TypeError('acl must be an instance of AV.ACL');
- } else {
- this.setACL(acl);
- }
- }
- },
- /**
- * Gets the name of the role. You can alternatively call role.get("name")
- *
- * @return {String} the name of the role.
- */
- getName: function getName() {
- return this.get('name');
- },
- /**
- * Sets the name for a role. This value must be set before the role has
- * been saved to the server, and cannot be set once the role has been
- * saved.
- *
- * <p>
- * A role's name can only contain alphanumeric characters, _, -, and
- * spaces.
- * </p>
- *
- * <p>This is equivalent to calling role.set("name", name)</p>
- *
- * @param {String} name The name of the role.
- */
- setName: function setName(name, options) {
- return this.set('name', name, options);
- },
- /**
- * Gets the AV.Relation for the AV.Users that are direct
- * children of this role. These users are granted any privileges that this
- * role has been granted (e.g. read or write access through ACLs). You can
- * add or remove users from the role through this relation.
- *
- * <p>This is equivalent to calling role.relation("users")</p>
- *
- * @return {AV.Relation} the relation for the users belonging to this
- * role.
- */
- getUsers: function getUsers() {
- return this.relation('users');
- },
- /**
- * Gets the AV.Relation for the AV.Roles that are direct
- * children of this role. These roles' users are granted any privileges that
- * this role has been granted (e.g. read or write access through ACLs). You
- * can add or remove child roles from this role through this relation.
- *
- * <p>This is equivalent to calling role.relation("roles")</p>
- *
- * @return {AV.Relation} the relation for the roles belonging to this
- * role.
- */
- getRoles: function getRoles() {
- return this.relation('roles');
- },
- /**
- * @ignore
- */
- validate: function validate(attrs, options) {
- if ('name' in attrs && attrs.name !== this.getName()) {
- var newName = attrs.name;
- if (this.id && this.id !== attrs.objectId) {
- // Check to see if the objectId being set matches this.id.
- // This happens during a fetch -- the id is set before calling fetch.
- // Let the name be set in this case.
- return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
- }
- if (!_.isString(newName)) {
- return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
- }
- if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
- return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
- }
- }
- if (AV.Object.prototype.validate) {
- return AV.Object.prototype.validate.call(this, attrs, options);
- }
- return false;
- }
- });
- };
- /***/ }),
- /* 556 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(557));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _find = _interopRequireDefault(__webpack_require__(93));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _ = __webpack_require__(3);
- var uuid = __webpack_require__(232);
- var AVError = __webpack_require__(46);
- var _require = __webpack_require__(27),
- AVRequest = _require._request,
- request = _require.request;
- var _require2 = __webpack_require__(72),
- getAdapter = _require2.getAdapter;
- var PLATFORM_ANONYMOUS = 'anonymous';
- var PLATFORM_QQAPP = 'lc_qqapp';
- var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
- var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
- return function (authData, unionId) {
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
- _ref$unionIdPlatform = _ref.unionIdPlatform,
- unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
- _ref$asMainAccount = _ref.asMainAccount,
- asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
- if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
- if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
- return _.extend({}, authData, {
- platform: unionIdPlatform,
- unionid: unionId,
- main_account: Boolean(asMainAccount)
- });
- };
- };
- module.exports = function (AV) {
- /**
- * @class
- *
- * <p>An AV.User object is a local representation of a user persisted to the
- * LeanCloud server. This class is a subclass of an AV.Object, and retains the
- * same functionality of an AV.Object, but also extends it with various
- * user specific methods, like authentication, signing up, and validation of
- * uniqueness.</p>
- */
- AV.User = AV.Object.extend('_User',
- /** @lends AV.User.prototype */
- {
- // Instance Variables
- _isCurrentUser: false,
- // Instance Methods
- /**
- * Internal method to handle special fields in a _User response.
- * @private
- */
- _mergeMagicFields: function _mergeMagicFields(attrs) {
- if (attrs.sessionToken) {
- this._sessionToken = attrs.sessionToken;
- delete attrs.sessionToken;
- }
- return AV.User.__super__._mergeMagicFields.call(this, attrs);
- },
- /**
- * Removes null values from authData (which exist temporarily for
- * unlinking)
- * @private
- */
- _cleanupAuthData: function _cleanupAuthData() {
- if (!this.isCurrent()) {
- return;
- }
- var authData = this.get('authData');
- if (!authData) {
- return;
- }
- AV._objectEach(this.get('authData'), function (value, key) {
- if (!authData[key]) {
- delete authData[key];
- }
- });
- },
- /**
- * Synchronizes authData for all providers.
- * @private
- */
- _synchronizeAllAuthData: function _synchronizeAllAuthData() {
- var authData = this.get('authData');
- if (!authData) {
- return;
- }
- var self = this;
- AV._objectEach(this.get('authData'), function (value, key) {
- self._synchronizeAuthData(key);
- });
- },
- /**
- * Synchronizes auth data for a provider (e.g. puts the access token in the
- * right place to be used by the Facebook SDK).
- * @private
- */
- _synchronizeAuthData: function _synchronizeAuthData(provider) {
- if (!this.isCurrent()) {
- return;
- }
- var authType;
- if (_.isString(provider)) {
- authType = provider;
- provider = AV.User._authProviders[authType];
- } else {
- authType = provider.getAuthType();
- }
- var authData = this.get('authData');
- if (!authData || !provider) {
- return;
- }
- var success = provider.restoreAuthentication(authData[authType]);
- if (!success) {
- this.dissociateAuthData(provider);
- }
- },
- _handleSaveResult: function _handleSaveResult(makeCurrent) {
- // Clean up and synchronize the authData object, removing any unset values
- if (makeCurrent && !AV._config.disableCurrentUser) {
- this._isCurrentUser = true;
- }
- this._cleanupAuthData();
- this._synchronizeAllAuthData(); // Don't keep the password around.
- delete this._serverData.password;
- this._rebuildEstimatedDataForKey('password');
- this._refreshCache();
- if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
- // Some old version of leanengine-node-sdk will overwrite
- // AV.User._saveCurrentUser which returns no Promise.
- // So we need a Promise wrapper.
- return _promise.default.resolve(AV.User._saveCurrentUser(this));
- } else {
- return _promise.default.resolve();
- }
- },
- /**
- * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
- * call linkWith on the user (even if it doesn't exist yet on the server).
- * @private
- */
- _linkWith: function _linkWith(provider, data) {
- var _this = this;
- var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
- _ref2$failOnNotExist = _ref2.failOnNotExist,
- failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist;
- var authType;
- if (_.isString(provider)) {
- authType = provider;
- provider = AV.User._authProviders[provider];
- } else {
- authType = provider.getAuthType();
- }
- if (data) {
- return this.save({
- authData: (0, _defineProperty2.default)({}, authType, data)
- }, {
- fetchWhenSave: !!this.get('authData'),
- _failOnNotExist: failOnNotExist
- }).then(function (model) {
- return model._handleSaveResult(true).then(function () {
- return model;
- });
- });
- } else {
- return provider.authenticate().then(function (result) {
- return _this._linkWith(provider, result);
- });
- }
- },
- /**
- * Associate the user with a third party authData.
- * @since 3.3.0
- * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
- * @param {string} platform Available platform for sign up.
- * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
- * @example user.associateWithAuthData({
- * openid: 'abc123',
- * access_token: '123abc',
- * expires_in: 1382686496
- * }, 'weixin').then(function(user) {
- * //Access user here
- * }).catch(function(error) {
- * //console.error("error: ", error);
- * });
- */
- associateWithAuthData: function associateWithAuthData(authData, platform) {
- return this._linkWith(platform, authData);
- },
- /**
- * Associate the user with a third party authData and unionId.
- * @since 3.5.0
- * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
- * @param {string} platform Available platform for sign up.
- * @param {string} unionId
- * @param {Object} [unionLoginOptions]
- * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
- * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
- * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
- * @example user.associateWithAuthDataAndUnionId({
- * openid: 'abc123',
- * access_token: '123abc',
- * expires_in: 1382686496
- * }, 'weixin', 'union123', {
- * unionIdPlatform: 'weixin',
- * asMainAccount: true,
- * }).then(function(user) {
- * //Access user here
- * }).catch(function(error) {
- * //console.error("error: ", error);
- * });
- */
- associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
- return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
- },
- /**
- * Associate the user with the identity of the current mini-app.
- * @since 4.6.0
- * @param {Object} [authInfo]
- * @param {Object} [option]
- * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
- * @return {Promise<AV.User>}
- */
- associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
- var _this2 = this;
- if (authInfo === undefined) {
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo().then(function (authInfo) {
- return _this2._linkWith(authInfo.provider, authInfo.authData, option);
- });
- }
- return this._linkWith(authInfo.provider, authInfo.authData, option);
- },
- /**
- * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
- * 仅在 QQ 小程序中可用。
- *
- * @deprecated Please use {@link AV.User#associateWithMiniApp}
- * @since 4.2.0
- * @param {Object} [options]
- * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
- * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
- * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
- * @return {Promise<AV.User>}
- */
- associateWithQQApp: function associateWithQQApp() {
- var _this3 = this;
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref3$preferUnionId = _ref3.preferUnionId,
- preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
- _ref3$unionIdPlatform = _ref3.unionIdPlatform,
- unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
- _ref3$asMainAccount = _ref3.asMainAccount,
- asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- preferUnionId: preferUnionId,
- asMainAccount: asMainAccount,
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo.provider = PLATFORM_QQAPP;
- return _this3.associateWithMiniApp(authInfo);
- });
- },
- /**
- * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
- * 仅在微信小程序中可用。
- *
- * @deprecated Please use {@link AV.User#associateWithMiniApp}
- * @since 3.13.0
- * @param {Object} [options]
- * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
- * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
- * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
- * @return {Promise<AV.User>}
- */
- associateWithWeapp: function associateWithWeapp() {
- var _this4 = this;
- var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref4$preferUnionId = _ref4.preferUnionId,
- preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
- _ref4$unionIdPlatform = _ref4.unionIdPlatform,
- unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
- _ref4$asMainAccount = _ref4.asMainAccount,
- asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- preferUnionId: preferUnionId,
- asMainAccount: asMainAccount,
- platform: unionIdPlatform
- }).then(function (authInfo) {
- return _this4.associateWithMiniApp(authInfo);
- });
- },
- /**
- * @deprecated renamed to {@link AV.User#associateWithWeapp}
- * @return {Promise<AV.User>}
- */
- linkWithWeapp: function linkWithWeapp(options) {
- console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
- return this.associateWithWeapp(options);
- },
- /**
- * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
- * 仅在 QQ 小程序中可用。
- *
- * @deprecated Please use {@link AV.User#associateWithMiniApp}
- * @since 4.2.0
- * @param {string} unionId
- * @param {Object} [unionOptions]
- * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
- * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
- * @return {Promise<AV.User>}
- */
- associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
- var _this5 = this;
- var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref5$unionIdPlatform = _ref5.unionIdPlatform,
- unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
- _ref5$asMainAccount = _ref5.asMainAccount,
- asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo = AV.User.mergeUnionId(authInfo, unionId, {
- asMainAccount: asMainAccount
- });
- authInfo.provider = PLATFORM_QQAPP;
- return _this5.associateWithMiniApp(authInfo);
- });
- },
- /**
- * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
- * 仅在微信小程序中可用。
- *
- * @deprecated Please use {@link AV.User#associateWithMiniApp}
- * @since 3.13.0
- * @param {string} unionId
- * @param {Object} [unionOptions]
- * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
- * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
- * @return {Promise<AV.User>}
- */
- associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
- var _this6 = this;
- var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref6$unionIdPlatform = _ref6.unionIdPlatform,
- unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
- _ref6$asMainAccount = _ref6.asMainAccount,
- asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo = AV.User.mergeUnionId(authInfo, unionId, {
- asMainAccount: asMainAccount
- });
- return _this6.associateWithMiniApp(authInfo);
- });
- },
- /**
- * Unlinks a user from a service.
- * @param {string} platform
- * @return {Promise<AV.User>}
- * @since 3.3.0
- */
- dissociateAuthData: function dissociateAuthData(provider) {
- this.unset("authData.".concat(provider));
- return this.save().then(function (model) {
- return model._handleSaveResult(true).then(function () {
- return model;
- });
- });
- },
- /**
- * @private
- * @deprecated
- */
- _unlinkFrom: function _unlinkFrom(provider) {
- console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
- return this.dissociateAuthData(provider);
- },
- /**
- * Checks whether a user is linked to a service.
- * @private
- */
- _isLinked: function _isLinked(provider) {
- var authType;
- if (_.isString(provider)) {
- authType = provider;
- } else {
- authType = provider.getAuthType();
- }
- var authData = this.get('authData') || {};
- return !!authData[authType];
- },
- /**
- * Checks whether a user is anonymous.
- * @since 3.9.0
- * @return {boolean}
- */
- isAnonymous: function isAnonymous() {
- return this._isLinked(PLATFORM_ANONYMOUS);
- },
- logOut: function logOut() {
- this._logOutWithAll();
- this._isCurrentUser = false;
- },
- /**
- * Deauthenticates all providers.
- * @private
- */
- _logOutWithAll: function _logOutWithAll() {
- var authData = this.get('authData');
- if (!authData) {
- return;
- }
- var self = this;
- AV._objectEach(this.get('authData'), function (value, key) {
- self._logOutWith(key);
- });
- },
- /**
- * Deauthenticates a single provider (e.g. removing access tokens from the
- * Facebook SDK).
- * @private
- */
- _logOutWith: function _logOutWith(provider) {
- if (!this.isCurrent()) {
- return;
- }
- if (_.isString(provider)) {
- provider = AV.User._authProviders[provider];
- }
- if (provider && provider.deauthenticate) {
- provider.deauthenticate();
- }
- },
- /**
- * Signs up a new user. You should call this instead of save for
- * new AV.Users. This will create a new AV.User on the server, and
- * also persist the session on disk so that you can access the user using
- * <code>current</code>.
- *
- * <p>A username and password must be set before calling signUp.</p>
- *
- * @param {Object} attrs Extra fields to set on the new user, or null.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the signup
- * finishes.
- * @see AV.User.signUp
- */
- signUp: function signUp(attrs, options) {
- var error;
- var username = attrs && attrs.username || this.get('username');
- if (!username || username === '') {
- error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
- throw error;
- }
- var password = attrs && attrs.password || this.get('password');
- if (!password || password === '') {
- error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
- throw error;
- }
- return this.save(attrs, options).then(function (model) {
- if (model.isAnonymous()) {
- model.unset("authData.".concat(PLATFORM_ANONYMOUS));
- model._opSetQueue = [{}];
- }
- return model._handleSaveResult(true).then(function () {
- return model;
- });
- });
- },
- /**
- * Signs up a new user with mobile phone and sms code.
- * You should call this instead of save for
- * new AV.Users. This will create a new AV.User on the server, and
- * also persist the session on disk so that you can access the user using
- * <code>current</code>.
- *
- * <p>A username and password must be set before calling signUp.</p>
- *
- * @param {Object} attrs Extra fields to set on the new user, or null.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the signup
- * finishes.
- * @see AV.User.signUpOrlogInWithMobilePhone
- * @see AV.Cloud.requestSmsCode
- */
- signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var error;
- var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
- if (!mobilePhoneNumber || mobilePhoneNumber === '') {
- error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
- throw error;
- }
- var smsCode = attrs && attrs.smsCode || this.get('smsCode');
- if (!smsCode || smsCode === '') {
- error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
- throw error;
- }
- options._makeRequest = function (route, className, id, method, json) {
- return AVRequest('usersByMobilePhone', null, null, 'POST', json);
- };
- return this.save(attrs, options).then(function (model) {
- delete model.attributes.smsCode;
- delete model._serverData.smsCode;
- return model._handleSaveResult(true).then(function () {
- return model;
- });
- });
- },
- /**
- * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
- * @since 3.7.0
- */
- loginWithAuthData: function loginWithAuthData(authData, platform, options) {
- return this._linkWith(platform, authData, options);
- },
- /**
- * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
- * @since 3.7.0
- */
- loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
- return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
- },
- /**
- * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
- * @deprecated please use {@link AV.User#loginWithMiniApp}
- * @since 3.7.0
- * @param {Object} [options]
- * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
- * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
- * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
- * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
- * @return {Promise<AV.User>}
- */
- loginWithWeapp: function loginWithWeapp() {
- var _this7 = this;
- var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref7$preferUnionId = _ref7.preferUnionId,
- preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
- _ref7$unionIdPlatform = _ref7.unionIdPlatform,
- unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
- _ref7$asMainAccount = _ref7.asMainAccount,
- asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
- _ref7$failOnNotExist = _ref7.failOnNotExist,
- failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- preferUnionId: preferUnionId,
- asMainAccount: asMainAccount,
- platform: unionIdPlatform
- }).then(function (authInfo) {
- return _this7.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
- * @deprecated please use {@link AV.User#loginWithMiniApp}
- * @since 3.13.0
- */
- loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
- var _this8 = this;
- var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref8$unionIdPlatform = _ref8.unionIdPlatform,
- unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
- _ref8$asMainAccount = _ref8.asMainAccount,
- asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
- _ref8$failOnNotExist = _ref8.failOnNotExist,
- failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo = AV.User.mergeUnionId(authInfo, unionId, {
- asMainAccount: asMainAccount
- });
- return _this8.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
- * @deprecated please use {@link AV.User#loginWithMiniApp}
- * @since 4.2.0
- * @param {Object} [options]
- * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
- * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
- * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
- * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
- */
- loginWithQQApp: function loginWithQQApp() {
- var _this9 = this;
- var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref9$preferUnionId = _ref9.preferUnionId,
- preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
- _ref9$unionIdPlatform = _ref9.unionIdPlatform,
- unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
- _ref9$asMainAccount = _ref9.asMainAccount,
- asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
- _ref9$failOnNotExist = _ref9.failOnNotExist,
- failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- preferUnionId: preferUnionId,
- asMainAccount: asMainAccount,
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo.provider = PLATFORM_QQAPP;
- return _this9.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
- * @deprecated please use {@link AV.User#loginWithMiniApp}
- * @since 4.2.0
- */
- loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
- var _this10 = this;
- var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
- unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
- _ref10$asMainAccount = _ref10.asMainAccount,
- asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
- _ref10$failOnNotExist = _ref10.failOnNotExist,
- failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo = AV.User.mergeUnionId(authInfo, unionId, {
- asMainAccount: asMainAccount
- });
- authInfo.provider = PLATFORM_QQAPP;
- return _this10.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
- * @since 4.6.0
- */
- loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
- var _this11 = this;
- if (authInfo === undefined) {
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo().then(function (authInfo) {
- return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
- });
- }
- return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
- },
- /**
- * Logs in a AV.User. On success, this saves the session to localStorage,
- * so you can retrieve the currently logged in user using
- * <code>current</code>.
- *
- * <p>A username and password must be set before calling logIn.</p>
- *
- * @see AV.User.logIn
- * @return {Promise} A promise that is fulfilled with the user when
- * the login is complete.
- */
- logIn: function logIn() {
- var model = this;
- var request = AVRequest('login', null, null, 'POST', this.toJSON());
- return request.then(function (resp) {
- var serverAttrs = model.parse(resp);
- model._finishFetch(serverAttrs);
- return model._handleSaveResult(true).then(function () {
- if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
- return model;
- });
- });
- },
- /**
- * @see AV.Object#save
- */
- save: function save(arg1, arg2, arg3) {
- var attrs, options;
- if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
- attrs = arg1;
- options = arg2;
- } else {
- attrs = {};
- attrs[arg1] = arg2;
- options = arg3;
- }
- options = options || {};
- return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
- return model._handleSaveResult(false).then(function () {
- return model;
- });
- });
- },
- /**
- * Follow a user
- * @since 0.3.0
- * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
- * @param {AV.User | String} options.user The target user or user's objectId to follow.
- * @param {Object} [options.attributes] key-value attributes dictionary to be used as
- * conditions of followerQuery/followeeQuery.
- * @param {AuthOptions} [authOptions]
- */
- follow: function follow(options, authOptions) {
- if (!this.id) {
- throw new Error('Please signin.');
- }
- var user;
- var attributes;
- if (options.user) {
- user = options.user;
- attributes = options.attributes;
- } else {
- user = options;
- }
- var userObjectId = _.isString(user) ? user : user.id;
- if (!userObjectId) {
- throw new Error('Invalid target user.');
- }
- var route = 'users/' + this.id + '/friendship/' + userObjectId;
- var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
- return request;
- },
- /**
- * Unfollow a user.
- * @since 0.3.0
- * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
- * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
- * @param {AuthOptions} [authOptions]
- */
- unfollow: function unfollow(options, authOptions) {
- if (!this.id) {
- throw new Error('Please signin.');
- }
- var user;
- if (options.user) {
- user = options.user;
- } else {
- user = options;
- }
- var userObjectId = _.isString(user) ? user : user.id;
- if (!userObjectId) {
- throw new Error('Invalid target user.');
- }
- var route = 'users/' + this.id + '/friendship/' + userObjectId;
- var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
- return request;
- },
- /**
- * Get the user's followers and followees.
- * @since 4.8.0
- * @param {Object} [options]
- * @param {Number} [options.skip]
- * @param {Number} [options.limit]
- * @param {AuthOptions} [authOptions]
- */
- getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
- if (!this.id) {
- throw new Error('Please signin.');
- }
- return request({
- method: 'GET',
- path: "/users/".concat(this.id, "/followersAndFollowees"),
- query: {
- skip: options && options.skip,
- limit: options && options.limit,
- include: 'follower,followee',
- keys: 'follower,followee'
- },
- authOptions: authOptions
- }).then(function (_ref11) {
- var followers = _ref11.followers,
- followees = _ref11.followees;
- return {
- followers: (0, _map.default)(followers).call(followers, function (_ref12) {
- var follower = _ref12.follower;
- return AV._decode(follower);
- }),
- followees: (0, _map.default)(followees).call(followees, function (_ref13) {
- var followee = _ref13.followee;
- return AV._decode(followee);
- })
- };
- });
- },
- /**
- *Create a follower query to query the user's followers.
- * @since 0.3.0
- * @see AV.User#followerQuery
- */
- followerQuery: function followerQuery() {
- return AV.User.followerQuery(this.id);
- },
- /**
- *Create a followee query to query the user's followees.
- * @since 0.3.0
- * @see AV.User#followeeQuery
- */
- followeeQuery: function followeeQuery() {
- return AV.User.followeeQuery(this.id);
- },
- /**
- * @see AV.Object#fetch
- */
- fetch: function fetch(fetchOptions, options) {
- return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
- return model._handleSaveResult(false).then(function () {
- return model;
- });
- });
- },
- /**
- * Update user's new password safely based on old password.
- * @param {String} oldPassword the old password.
- * @param {String} newPassword the new password.
- * @param {AuthOptions} options
- */
- updatePassword: function updatePassword(oldPassword, newPassword, options) {
- var _this12 = this;
- var route = 'users/' + this.id + '/updatePassword';
- var params = {
- old_password: oldPassword,
- new_password: newPassword
- };
- var request = AVRequest(route, null, null, 'PUT', params, options);
- return request.then(function (resp) {
- _this12._finishFetch(_this12.parse(resp));
- return _this12._handleSaveResult(true).then(function () {
- return resp;
- });
- });
- },
- /**
- * Returns true if <code>current</code> would return this user.
- * @see AV.User#current
- */
- isCurrent: function isCurrent() {
- return this._isCurrentUser;
- },
- /**
- * Returns get("username").
- * @return {String}
- * @see AV.Object#get
- */
- getUsername: function getUsername() {
- return this.get('username');
- },
- /**
- * Returns get("mobilePhoneNumber").
- * @return {String}
- * @see AV.Object#get
- */
- getMobilePhoneNumber: function getMobilePhoneNumber() {
- return this.get('mobilePhoneNumber');
- },
- /**
- * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
- * @param {String} mobilePhoneNumber
- * @return {Boolean}
- * @see AV.Object#set
- */
- setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
- return this.set('mobilePhoneNumber', phone, options);
- },
- /**
- * Calls set("username", username, options) and returns the result.
- * @param {String} username
- * @return {Boolean}
- * @see AV.Object#set
- */
- setUsername: function setUsername(username, options) {
- return this.set('username', username, options);
- },
- /**
- * Calls set("password", password, options) and returns the result.
- * @param {String} password
- * @return {Boolean}
- * @see AV.Object#set
- */
- setPassword: function setPassword(password, options) {
- return this.set('password', password, options);
- },
- /**
- * Returns get("email").
- * @return {String}
- * @see AV.Object#get
- */
- getEmail: function getEmail() {
- return this.get('email');
- },
- /**
- * Calls set("email", email, options) and returns the result.
- * @param {String} email
- * @param {AuthOptions} options
- * @return {Boolean}
- * @see AV.Object#set
- */
- setEmail: function setEmail(email, options) {
- return this.set('email', email, options);
- },
- /**
- * Checks whether this user is the current user and has been authenticated.
- * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
- * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
- * @return (Boolean) whether this user is the current user and is logged in.
- */
- authenticated: function authenticated() {
- console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
- return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
- },
- /**
- * Detects if current sessionToken is valid.
- *
- * @since 2.0.0
- * @return Promise.<Boolean>
- */
- isAuthenticated: function isAuthenticated() {
- var _this13 = this;
- return _promise.default.resolve().then(function () {
- return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
- return true;
- }, function (error) {
- if (error.code === 211) {
- return false;
- }
- throw error;
- });
- });
- },
- /**
- * Get sessionToken of current user.
- * @return {String} sessionToken
- */
- getSessionToken: function getSessionToken() {
- return this._sessionToken;
- },
- /**
- * Refresh sessionToken of current user.
- * @since 2.1.0
- * @param {AuthOptions} [options]
- * @return {Promise.<AV.User>} user with refreshed sessionToken
- */
- refreshSessionToken: function refreshSessionToken(options) {
- var _this14 = this;
- return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
- _this14._finishFetch(response);
- return _this14._handleSaveResult(true).then(function () {
- return _this14;
- });
- });
- },
- /**
- * Get this user's Roles.
- * @param {AuthOptions} [options]
- * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
- * the query is complete.
- */
- getRoles: function getRoles(options) {
- var _context;
- return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
- }
- },
- /** @lends AV.User */
- {
- // Class Variables
- // The currently logged-in user.
- _currentUser: null,
- // Whether currentUser is known to match the serialized version on disk.
- // This is useful for saving a localstorage check if you try to load
- // _currentUser frequently while there is none stored.
- _currentUserMatchesDisk: false,
- // The localStorage key suffix that the current user is stored under.
- _CURRENT_USER_KEY: 'currentUser',
- // The mapping of auth provider names to actual providers
- _authProviders: {},
- // Class Methods
- /**
- * Signs up a new user with a username (or email) and password.
- * This will create a new AV.User on the server, and also persist the
- * session in localStorage so that you can access the user using
- * {@link #current}.
- *
- * @param {String} username The username (or email) to sign up with.
- * @param {String} password The password to sign up with.
- * @param {Object} [attrs] Extra fields to set on the new user.
- * @param {AuthOptions} [options]
- * @return {Promise} A promise that is fulfilled with the user when
- * the signup completes.
- * @see AV.User#signUp
- */
- signUp: function signUp(username, password, attrs, options) {
- attrs = attrs || {};
- attrs.username = username;
- attrs.password = password;
- var user = AV.Object._create('_User');
- return user.signUp(attrs, options);
- },
- /**
- * Logs in a user with a username (or email) and password. On success, this
- * saves the session to disk, so you can retrieve the currently logged in
- * user using <code>current</code>.
- *
- * @param {String} username The username (or email) to log in with.
- * @param {String} password The password to log in with.
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- * @see AV.User#logIn
- */
- logIn: function logIn(username, password) {
- var user = AV.Object._create('_User');
- user._finishFetch({
- username: username,
- password: password
- });
- return user.logIn();
- },
- /**
- * Logs in a user with a session token. On success, this saves the session
- * to disk, so you can retrieve the currently logged in user using
- * <code>current</code>.
- *
- * @param {String} sessionToken The sessionToken to log in with.
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- */
- become: function become(sessionToken) {
- return this._fetchUserBySessionToken(sessionToken).then(function (user) {
- return user._handleSaveResult(true).then(function () {
- return user;
- });
- });
- },
- _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
- if (sessionToken === undefined) {
- return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
- }
- var user = AV.Object._create('_User');
- return request({
- method: 'GET',
- path: '/users/me',
- authOptions: {
- sessionToken: sessionToken
- }
- }).then(function (resp) {
- var serverAttrs = user.parse(resp);
- user._finishFetch(serverAttrs);
- return user;
- });
- },
- /**
- * Logs in a user with a mobile phone number and sms code sent by
- * AV.User.requestLoginSmsCode.On success, this
- * saves the session to disk, so you can retrieve the currently logged in
- * user using <code>current</code>.
- *
- * @param {String} mobilePhone The user's mobilePhoneNumber
- * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- * @see AV.User#logIn
- */
- logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
- var user = AV.Object._create('_User');
- user._finishFetch({
- mobilePhoneNumber: mobilePhone,
- smsCode: smsCode
- });
- return user.logIn();
- },
- /**
- * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
- * On success, this saves the session to disk, so you can retrieve the currently
- * logged in user using <code>current</code>.
- *
- * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
- * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
- * @param {Object} attributes The user's other attributes such as username etc.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- * @see AV.User#signUpOrlogInWithMobilePhone
- * @see AV.Cloud.requestSmsCode
- */
- signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
- attrs = attrs || {};
- attrs.mobilePhoneNumber = mobilePhoneNumber;
- attrs.smsCode = smsCode;
- var user = AV.Object._create('_User');
- return user.signUpOrlogInWithMobilePhone(attrs, options);
- },
- /**
- * Logs in a user with a mobile phone number and password. On success, this
- * saves the session to disk, so you can retrieve the currently logged in
- * user using <code>current</code>.
- *
- * @param {String} mobilePhone The user's mobilePhoneNumber
- * @param {String} password The password to log in with.
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- * @see AV.User#logIn
- */
- logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
- var user = AV.Object._create('_User');
- user._finishFetch({
- mobilePhoneNumber: mobilePhone,
- password: password
- });
- return user.logIn();
- },
- /**
- * Logs in a user with email and password.
- *
- * @since 3.13.0
- * @param {String} email The user's email.
- * @param {String} password The password to log in with.
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- */
- loginWithEmail: function loginWithEmail(email, password) {
- var user = AV.Object._create('_User');
- user._finishFetch({
- email: email,
- password: password
- });
- return user.logIn();
- },
- /**
- * Signs up or logs in a user with a third party auth data(AccessToken).
- * On success, this saves the session to disk, so you can retrieve the currently
- * logged in user using <code>current</code>.
- *
- * @since 3.7.0
- * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
- * @param {string} platform Available platform for sign up.
- * @param {Object} [options]
- * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
- * @return {Promise} A promise that is fulfilled with the user when
- * the login completes.
- * @example AV.User.loginWithAuthData({
- * openid: 'abc123',
- * access_token: '123abc',
- * expires_in: 1382686496
- * }, 'weixin').then(function(user) {
- * //Access user here
- * }).catch(function(error) {
- * //console.error("error: ", error);
- * });
- * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
- */
- loginWithAuthData: function loginWithAuthData(authData, platform, options) {
- return AV.User._logInWith(platform, authData, options);
- },
- /**
- * @deprecated renamed to {@link AV.User.loginWithAuthData}
- */
- signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
- console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
- return this.loginWithAuthData.apply(this, arguments);
- },
- /**
- * Signs up or logs in a user with a third party authData and unionId.
- * @since 3.7.0
- * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
- * @param {string} platform Available platform for sign up.
- * @param {string} unionId
- * @param {Object} [unionLoginOptions]
- * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
- * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
- * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
- * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
- * @example AV.User.loginWithAuthDataAndUnionId({
- * openid: 'abc123',
- * access_token: '123abc',
- * expires_in: 1382686496
- * }, 'weixin', 'union123', {
- * unionIdPlatform: 'weixin',
- * asMainAccount: true,
- * }).then(function(user) {
- * //Access user here
- * }).catch(function(error) {
- * //console.error("error: ", error);
- * });
- */
- loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
- return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
- },
- /**
- * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
- * @since 3.5.0
- */
- signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
- console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
- return this.loginWithAuthDataAndUnionId.apply(this, arguments);
- },
- /**
- * Merge unionId into authInfo.
- * @since 4.6.0
- * @param {Object} authInfo
- * @param {String} unionId
- * @param {Object} [unionIdOption]
- * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
- */
- mergeUnionId: function mergeUnionId(authInfo, unionId) {
- var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
- _ref14$asMainAccount = _ref14.asMainAccount,
- asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
- authInfo = JSON.parse((0, _stringify.default)(authInfo));
- var _authInfo = authInfo,
- authData = _authInfo.authData,
- platform = _authInfo.platform;
- authData.platform = platform;
- authData.main_account = asMainAccount;
- authData.unionid = unionId;
- return authInfo;
- },
- /**
- * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
- * 仅在微信小程序中可用。
- *
- * @deprecated please use {@link AV.User.loginWithMiniApp}
- * @since 2.0.0
- * @param {Object} [options]
- * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
- * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
- * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
- * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
- * @return {Promise.<AV.User>}
- */
- loginWithWeapp: function loginWithWeapp() {
- var _this15 = this;
- var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref15$preferUnionId = _ref15.preferUnionId,
- preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
- _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
- unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
- _ref15$asMainAccount = _ref15.asMainAccount,
- asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
- _ref15$failOnNotExist = _ref15.failOnNotExist,
- failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- preferUnionId: preferUnionId,
- asMainAccount: asMainAccount,
- platform: unionIdPlatform
- }).then(function (authInfo) {
- return _this15.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * 使用当前使用微信小程序的微信用户身份注册或登录,
- * 仅在微信小程序中可用。
- *
- * @deprecated please use {@link AV.User.loginWithMiniApp}
- * @since 3.13.0
- * @param {Object} [unionLoginOptions]
- * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
- * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
- * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
- */
- loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
- var _this16 = this;
- var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
- unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
- _ref16$asMainAccount = _ref16.asMainAccount,
- asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
- _ref16$failOnNotExist = _ref16.failOnNotExist,
- failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo = AV.User.mergeUnionId(authInfo, unionId, {
- asMainAccount: asMainAccount
- });
- return _this16.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
- * 仅在 QQ 小程序中可用。
- *
- * @deprecated please use {@link AV.User.loginWithMiniApp}
- * @since 4.2.0
- * @param {Object} [options]
- * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
- * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
- * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
- * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
- * @return {Promise.<AV.User>}
- */
- loginWithQQApp: function loginWithQQApp() {
- var _this17 = this;
- var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref17$preferUnionId = _ref17.preferUnionId,
- preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
- _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
- unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
- _ref17$asMainAccount = _ref17.asMainAccount,
- asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
- _ref17$failOnNotExist = _ref17.failOnNotExist,
- failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- preferUnionId: preferUnionId,
- asMainAccount: asMainAccount,
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo.provider = PLATFORM_QQAPP;
- return _this17.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
- * 仅在 QQ 小程序中可用。
- *
- * @deprecated please use {@link AV.User.loginWithMiniApp}
- * @since 4.2.0
- * @param {Object} [unionLoginOptions]
- * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
- * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
- * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
- * @return {Promise.<AV.User>}
- */
- loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
- var _this18 = this;
- var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
- unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
- _ref18$asMainAccount = _ref18.asMainAccount,
- asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
- _ref18$failOnNotExist = _ref18.failOnNotExist,
- failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist;
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo({
- platform: unionIdPlatform
- }).then(function (authInfo) {
- authInfo = AV.User.mergeUnionId(authInfo, unionId, {
- asMainAccount: asMainAccount
- });
- authInfo.provider = PLATFORM_QQAPP;
- return _this18.loginWithMiniApp(authInfo, {
- failOnNotExist: failOnNotExist
- });
- });
- },
- /**
- * Register or login using the identity of the current mini-app.
- * @param {Object} authInfo
- * @param {Object} [option]
- * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
- */
- loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
- var _this19 = this;
- if (authInfo === undefined) {
- var getAuthInfo = getAdapter('getAuthInfo');
- return getAuthInfo().then(function (authInfo) {
- return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
- });
- }
- return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
- },
- /**
- * Only use for DI in tests to produce deterministic IDs.
- */
- _genId: function _genId() {
- return uuid();
- },
- /**
- * Creates an anonymous user.
- *
- * @since 3.9.0
- * @return {Promise.<AV.User>}
- */
- loginAnonymously: function loginAnonymously() {
- return this.loginWithAuthData({
- id: AV.User._genId()
- }, 'anonymous');
- },
- associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
- console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
- return userObj._linkWith(platform, authData);
- },
- /**
- * Logs out the currently logged in user session. This will remove the
- * session from disk, log out of linked services, and future calls to
- * <code>current</code> will return <code>null</code>.
- * @return {Promise}
- */
- logOut: function logOut() {
- if (AV._config.disableCurrentUser) {
- console.warn('AV.User.current() was disabled in multi-user environment, call logOut() from user object instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
- return _promise.default.resolve(null);
- }
- if (AV.User._currentUser !== null) {
- AV.User._currentUser._logOutWithAll();
- AV.User._currentUser._isCurrentUser = false;
- }
- AV.User._currentUserMatchesDisk = true;
- AV.User._currentUser = null;
- return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
- return AV._refreshSubscriptionId();
- });
- },
- /**
- *Create a follower query for special user to query the user's followers.
- * @param {String} userObjectId The user object id.
- * @return {AV.FriendShipQuery}
- * @since 0.3.0
- */
- followerQuery: function followerQuery(userObjectId) {
- if (!userObjectId || !_.isString(userObjectId)) {
- throw new Error('Invalid user object id.');
- }
- var query = new AV.FriendShipQuery('_Follower');
- query._friendshipTag = 'follower';
- query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
- return query;
- },
- /**
- *Create a followee query for special user to query the user's followees.
- * @param {String} userObjectId The user object id.
- * @return {AV.FriendShipQuery}
- * @since 0.3.0
- */
- followeeQuery: function followeeQuery(userObjectId) {
- if (!userObjectId || !_.isString(userObjectId)) {
- throw new Error('Invalid user object id.');
- }
- var query = new AV.FriendShipQuery('_Followee');
- query._friendshipTag = 'followee';
- query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
- return query;
- },
- /**
- * Requests a password reset email to be sent to the specified email address
- * associated with the user account. This email allows the user to securely
- * reset their password on the AV site.
- *
- * @param {String} email The email address associated with the user that
- * forgot their password.
- * @return {Promise}
- */
- requestPasswordReset: function requestPasswordReset(email) {
- var json = {
- email: email
- };
- var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
- return request;
- },
- /**
- * Requests a verify email to be sent to the specified email address
- * associated with the user account. This email allows the user to securely
- * verify their email address on the AV site.
- *
- * @param {String} email The email address associated with the user that
- * doesn't verify their email address.
- * @return {Promise}
- */
- requestEmailVerify: function requestEmailVerify(email) {
- var json = {
- email: email
- };
- var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
- return request;
- },
- /**
- * Requests a verify sms code to be sent to the specified mobile phone
- * number associated with the user account. This sms code allows the user to
- * verify their mobile phone number by calling AV.User.verifyMobilePhone
- *
- * @param {String} mobilePhoneNumber The mobile phone number associated with the
- * user that doesn't verify their mobile phone number.
- * @param {SMSAuthOptions} [options]
- * @return {Promise}
- */
- requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var data = {
- mobilePhoneNumber: mobilePhoneNumber
- };
- if (options.validateToken) {
- data.validate_token = options.validateToken;
- }
- var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
- return request;
- },
- /**
- * Requests a reset password sms code to be sent to the specified mobile phone
- * number associated with the user account. This sms code allows the user to
- * reset their account's password by calling AV.User.resetPasswordBySmsCode
- *
- * @param {String} mobilePhoneNumber The mobile phone number associated with the
- * user that doesn't verify their mobile phone number.
- * @param {SMSAuthOptions} [options]
- * @return {Promise}
- */
- requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var data = {
- mobilePhoneNumber: mobilePhoneNumber
- };
- if (options.validateToken) {
- data.validate_token = options.validateToken;
- }
- var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
- return request;
- },
- /**
- * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
- * This sms code allows current user to reset it's mobilePhoneNumber by
- * calling {@link AV.User.changePhoneNumber}
- * @since 4.7.0
- * @param {String} mobilePhoneNumber
- * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
- * @param {SMSAuthOptions} [options]
- * @return {Promise}
- */
- requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
- var data = {
- mobilePhoneNumber: mobilePhoneNumber
- };
- if (ttl) {
- data.ttl = options.ttl;
- }
- if (options && options.validateToken) {
- data.validate_token = options.validateToken;
- }
- return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
- },
- /**
- * Makes a call to reset user's account mobilePhoneNumber by sms code.
- * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
- * @since 4.7.0
- * @param {String} mobilePhoneNumber
- * @param {String} code The sms code.
- * @return {Promise}
- */
- changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
- var data = {
- mobilePhoneNumber: mobilePhoneNumber,
- code: code
- };
- return AVRequest('changePhoneNumber', null, null, 'POST', data);
- },
- /**
- * Makes a call to reset user's account password by sms code and new password.
- * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
- * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
- * @param {String} password The new password.
- * @return {Promise} A promise that will be resolved with the result
- * of the function.
- */
- resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
- var json = {
- password: password
- };
- var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
- return request;
- },
- /**
- * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
- * If verify successfully,the user mobilePhoneVerified attribute will be true.
- * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
- * @return {Promise} A promise that will be resolved with the result
- * of the function.
- */
- verifyMobilePhone: function verifyMobilePhone(code) {
- var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
- return request;
- },
- /**
- * Requests a logIn sms code to be sent to the specified mobile phone
- * number associated with the user account. This sms code allows the user to
- * login by AV.User.logInWithMobilePhoneSmsCode function.
- *
- * @param {String} mobilePhoneNumber The mobile phone number associated with the
- * user that want to login by AV.User.logInWithMobilePhoneSmsCode
- * @param {SMSAuthOptions} [options]
- * @return {Promise}
- */
- requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var data = {
- mobilePhoneNumber: mobilePhoneNumber
- };
- if (options.validateToken) {
- data.validate_token = options.validateToken;
- }
- var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
- return request;
- },
- /**
- * Retrieves the currently logged in AVUser with a valid session,
- * either from memory or localStorage, if necessary.
- * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
- */
- currentAsync: function currentAsync() {
- if (AV._config.disableCurrentUser) {
- console.warn('AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
- return _promise.default.resolve(null);
- }
- if (AV.User._currentUser) {
- return _promise.default.resolve(AV.User._currentUser);
- }
- if (AV.User._currentUserMatchesDisk) {
- return _promise.default.resolve(AV.User._currentUser);
- }
- return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
- if (!userData) {
- return null;
- } // Load the user from local storage.
- AV.User._currentUserMatchesDisk = true;
- AV.User._currentUser = AV.Object._create('_User');
- AV.User._currentUser._isCurrentUser = true;
- var json = JSON.parse(userData);
- AV.User._currentUser.id = json._id;
- delete json._id;
- AV.User._currentUser._sessionToken = json._sessionToken;
- delete json._sessionToken;
- AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
- AV.User._currentUser._synchronizeAllAuthData();
- AV.User._currentUser._refreshCache();
- AV.User._currentUser._opSetQueue = [{}];
- return AV.User._currentUser;
- });
- },
- /**
- * Retrieves the currently logged in AVUser with a valid session,
- * either from memory or localStorage, if necessary.
- * @return {AV.User} The currently logged in AV.User.
- */
- current: function current() {
- if (AV._config.disableCurrentUser) {
- console.warn('AV.User.current() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
- return null;
- }
- if (AV.localStorage.async) {
- var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
- error.code = 'SYNC_API_NOT_AVAILABLE';
- throw error;
- }
- if (AV.User._currentUser) {
- return AV.User._currentUser;
- }
- if (AV.User._currentUserMatchesDisk) {
- return AV.User._currentUser;
- } // Load the user from local storage.
- AV.User._currentUserMatchesDisk = true;
- var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
- if (!userData) {
- return null;
- }
- AV.User._currentUser = AV.Object._create('_User');
- AV.User._currentUser._isCurrentUser = true;
- var json = JSON.parse(userData);
- AV.User._currentUser.id = json._id;
- delete json._id;
- AV.User._currentUser._sessionToken = json._sessionToken;
- delete json._sessionToken;
- AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
- AV.User._currentUser._synchronizeAllAuthData();
- AV.User._currentUser._refreshCache();
- AV.User._currentUser._opSetQueue = [{}];
- return AV.User._currentUser;
- },
- /**
- * Persists a user as currentUser to localStorage, and into the singleton.
- * @private
- */
- _saveCurrentUser: function _saveCurrentUser(user) {
- var promise;
- if (AV.User._currentUser !== user) {
- promise = AV.User.logOut();
- } else {
- promise = _promise.default.resolve();
- }
- return promise.then(function () {
- user._isCurrentUser = true;
- AV.User._currentUser = user;
- var json = user._toFullJSON();
- json._id = user.id;
- json._sessionToken = user._sessionToken;
- return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
- AV.User._currentUserMatchesDisk = true;
- return AV._refreshSubscriptionId();
- });
- });
- },
- _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
- AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
- if (!AV._config.disableCurrentUser && AV.User.current()) {
- AV.User.current()._synchronizeAuthData(provider.getAuthType());
- }
- },
- _logInWith: function _logInWith(provider, authData, options) {
- var user = AV.Object._create('_User');
- return user._linkWith(provider, authData, options);
- }
- });
- };
- /***/ }),
- /* 557 */
- /***/ (function(module, exports, __webpack_require__) {
- var _Object$defineProperty = __webpack_require__(150);
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- _Object$defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 558 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _keys = _interopRequireDefault(__webpack_require__(59));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _find = _interopRequireDefault(__webpack_require__(93));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _ = __webpack_require__(3);
- var debug = __webpack_require__(60)('leancloud:query');
- var AVError = __webpack_require__(46);
- var _require = __webpack_require__(27),
- _request = _require._request,
- request = _require.request;
- var _require2 = __webpack_require__(30),
- ensureArray = _require2.ensureArray,
- transformFetchOptions = _require2.transformFetchOptions,
- continueWhile = _require2.continueWhile;
- var requires = function requires(value, message) {
- if (value === undefined) {
- throw new Error(message);
- }
- }; // AV.Query is a way to create a list of AV.Objects.
- module.exports = function (AV) {
- /**
- * Creates a new AV.Query for the given AV.Object subclass.
- * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
- * @class
- *
- * <p>AV.Query defines a query that is used to fetch AV.Objects. The
- * most common use case is finding all objects that match a query through the
- * <code>find</code> method. For example, this sample code fetches all objects
- * of class <code>MyClass</code>. It calls a different function depending on
- * whether the fetch succeeded or not.
- *
- * <pre>
- * var query = new AV.Query(MyClass);
- * query.find().then(function(results) {
- * // results is an array of AV.Object.
- * }, function(error) {
- * // error is an instance of AVError.
- * });</pre></p>
- *
- * <p>An AV.Query can also be used to retrieve a single object whose id is
- * known, through the get method. For example, this sample code fetches an
- * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
- * different function depending on whether the fetch succeeded or not.
- *
- * <pre>
- * var query = new AV.Query(MyClass);
- * query.get(myId).then(function(object) {
- * // object is an instance of AV.Object.
- * }, function(error) {
- * // error is an instance of AVError.
- * });</pre></p>
- *
- * <p>An AV.Query can also be used to count the number of objects that match
- * the query without retrieving all of those objects. For example, this
- * sample code counts the number of objects of the class <code>MyClass</code>
- * <pre>
- * var query = new AV.Query(MyClass);
- * query.count().then(function(number) {
- * // There are number instances of MyClass.
- * }, function(error) {
- * // error is an instance of AVError.
- * });</pre></p>
- */
- AV.Query = function (objectClass) {
- if (_.isString(objectClass)) {
- objectClass = AV.Object._getSubclass(objectClass);
- }
- this.objectClass = objectClass;
- this.className = objectClass.prototype.className;
- this._where = {};
- this._include = [];
- this._select = [];
- this._limit = -1; // negative limit means, do not send a limit
- this._skip = 0;
- this._defaultParams = {};
- };
- /**
- * Constructs a AV.Query that is the OR of the passed in queries. For
- * example:
- * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
- *
- * will create a compoundQuery that is an or of the query1, query2, and
- * query3.
- * @param {...AV.Query} var_args The list of queries to OR.
- * @return {AV.Query} The query that is the OR of the passed in queries.
- */
- AV.Query.or = function () {
- var queries = _.toArray(arguments);
- var className = null;
- AV._arrayEach(queries, function (q) {
- if (_.isNull(className)) {
- className = q.className;
- }
- if (className !== q.className) {
- throw new Error('All queries must be for the same class');
- }
- });
- var query = new AV.Query(className);
- query._orQuery(queries);
- return query;
- };
- /**
- * Constructs a AV.Query that is the AND of the passed in queries. For
- * example:
- * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
- *
- * will create a compoundQuery that is an 'and' of the query1, query2, and
- * query3.
- * @param {...AV.Query} var_args The list of queries to AND.
- * @return {AV.Query} The query that is the AND of the passed in queries.
- */
- AV.Query.and = function () {
- var queries = _.toArray(arguments);
- var className = null;
- AV._arrayEach(queries, function (q) {
- if (_.isNull(className)) {
- className = q.className;
- }
- if (className !== q.className) {
- throw new Error('All queries must be for the same class');
- }
- });
- var query = new AV.Query(className);
- query._andQuery(queries);
- return query;
- };
- /**
- * Retrieves a list of AVObjects that satisfy the CQL.
- * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
- *
- * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
- * @param {Array} pvalues An array contains placeholder values.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is resolved with the results when
- * the query completes.
- */
- AV.Query.doCloudQuery = function (cql, pvalues, options) {
- var params = {
- cql: cql
- };
- if (_.isArray(pvalues)) {
- params.pvalues = pvalues;
- } else {
- options = pvalues;
- }
- var request = _request('cloudQuery', null, null, 'GET', params, options);
- return request.then(function (response) {
- //query to process results.
- var query = new AV.Query(response.className);
- var results = (0, _map.default)(_).call(_, response.results, function (json) {
- var obj = query._newObject(response);
- if (obj._finishFetch) {
- obj._finishFetch(query._processResult(json), true);
- }
- return obj;
- });
- return {
- results: results,
- count: response.count,
- className: response.className
- };
- });
- };
- /**
- * Return a query with conditions from json.
- * This can be useful to send a query from server side to client side.
- * @since 4.0.0
- * @param {Object} json from {@link AV.Query#toJSON}
- * @return {AV.Query}
- */
- AV.Query.fromJSON = function (_ref) {
- var className = _ref.className,
- where = _ref.where,
- include = _ref.include,
- select = _ref.select,
- includeACL = _ref.includeACL,
- limit = _ref.limit,
- skip = _ref.skip,
- order = _ref.order;
- if (typeof className !== 'string') {
- throw new TypeError('Invalid Query JSON, className must be a String.');
- }
- var query = new AV.Query(className);
- _.extend(query, {
- _where: where,
- _include: include,
- _select: select,
- _includeACL: includeACL,
- _limit: limit,
- _skip: skip,
- _order: order
- });
- return query;
- };
- AV.Query._extend = AV._extend;
- _.extend(AV.Query.prototype,
- /** @lends AV.Query.prototype */
- {
- //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
- _processResult: function _processResult(obj) {
- return obj;
- },
- /**
- * Constructs an AV.Object whose id is already known by fetching data from
- * the server.
- *
- * @param {String} objectId The id of the object to be fetched.
- * @param {AuthOptions} options
- * @return {Promise.<AV.Object>}
- */
- get: function get(objectId, options) {
- if (!_.isString(objectId)) {
- throw new Error('objectId must be a string');
- }
- if (objectId === '') {
- return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
- }
- var obj = this._newObject();
- obj.id = objectId;
- var queryJSON = this._getParams();
- var fetchOptions = {};
- if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
- if (queryJSON.include) fetchOptions.include = queryJSON.include;
- if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
- return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
- if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
- obj._finishFetch(obj.parse(response), true);
- return obj;
- });
- },
- /**
- * Returns a JSON representation of this query.
- * @return {Object}
- */
- toJSON: function toJSON() {
- var className = this.className,
- where = this._where,
- include = this._include,
- select = this._select,
- includeACL = this._includeACL,
- limit = this._limit,
- skip = this._skip,
- order = this._order;
- return {
- className: className,
- where: where,
- include: include,
- select: select,
- includeACL: includeACL,
- limit: limit,
- skip: skip,
- order: order
- };
- },
- _getParams: function _getParams() {
- var params = _.extend({}, this._defaultParams, {
- where: this._where
- });
- if (this._include.length > 0) {
- params.include = this._include.join(',');
- }
- if (this._select.length > 0) {
- params.keys = this._select.join(',');
- }
- if (this._includeACL !== undefined) {
- params.returnACL = this._includeACL;
- }
- if (this._limit >= 0) {
- params.limit = this._limit;
- }
- if (this._skip > 0) {
- params.skip = this._skip;
- }
- if (this._order !== undefined) {
- params.order = this._order;
- }
- return params;
- },
- _newObject: function _newObject(response) {
- var obj;
- if (response && response.className) {
- obj = new AV.Object(response.className);
- } else {
- obj = new this.objectClass();
- }
- return obj;
- },
- _createRequest: function _createRequest() {
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
- var options = arguments.length > 1 ? arguments[1] : undefined;
- var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
- if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
- var body = {
- requests: [{
- method: 'GET',
- path: "/1.1".concat(path),
- params: params
- }]
- };
- return request({
- path: '/batch',
- method: 'POST',
- data: body,
- authOptions: options
- }).then(function (response) {
- var result = response[0];
- if (result.success) {
- return result.success;
- }
- var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
- throw error;
- });
- }
- return request({
- method: 'GET',
- path: path,
- query: params,
- authOptions: options
- });
- },
- _parseResponse: function _parseResponse(response) {
- var _this = this;
- return (0, _map.default)(_).call(_, response.results, function (json) {
- var obj = _this._newObject(response);
- if (obj._finishFetch) {
- obj._finishFetch(_this._processResult(json), true);
- }
- return obj;
- });
- },
- /**
- * Retrieves a list of AVObjects that satisfy this query.
- *
- * @param {AuthOptions} options
- * @return {Promise} A promise that is resolved with the results when
- * the query completes.
- */
- find: function find(options) {
- var request = this._createRequest(undefined, options);
- return request.then(this._parseResponse.bind(this));
- },
- /**
- * Retrieves both AVObjects and total count.
- *
- * @since 4.12.0
- * @param {AuthOptions} options
- * @return {Promise} A tuple contains results and count.
- */
- findAndCount: function findAndCount(options) {
- var _this2 = this;
- var params = this._getParams();
- params.count = 1;
- var request = this._createRequest(params, options);
- return request.then(function (response) {
- return [_this2._parseResponse(response), response.count];
- });
- },
- /**
- * scan a Query. masterKey required.
- *
- * @since 2.1.0
- * @param {object} [options]
- * @param {string} [options.orderedBy] specify the key to sort
- * @param {number} [options.batchSize] specify the batch size for each request
- * @param {AuthOptions} [authOptions]
- * @return {AsyncIterator.<AV.Object>}
- * @example const testIterator = {
- * [Symbol.asyncIterator]() {
- * return new Query('Test').scan(undefined, { useMasterKey: true });
- * },
- * };
- * for await (const test of testIterator) {
- * console.log(test.id);
- * }
- */
- scan: function scan() {
- var _this3 = this;
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- orderedBy = _ref2.orderedBy,
- batchSize = _ref2.batchSize;
- var authOptions = arguments.length > 1 ? arguments[1] : undefined;
- var condition = this._getParams();
- debug('scan %O', condition);
- if (condition.order) {
- console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
- delete condition.order;
- }
- if (condition.skip) {
- console.warn('The skip option of the query is ignored for Query#scan.');
- delete condition.skip;
- }
- if (condition.limit) {
- console.warn('The limit option of the query is ignored for Query#scan.');
- delete condition.limit;
- }
- if (orderedBy) condition.scan_key = orderedBy;
- if (batchSize) condition.limit = batchSize;
- var cursor;
- var remainResults = [];
- return {
- next: function next() {
- if (remainResults.length) {
- return _promise.default.resolve({
- done: false,
- value: remainResults.shift()
- });
- }
- if (cursor === null) {
- return _promise.default.resolve({
- done: true
- });
- }
- return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
- cursor: cursor
- }) : condition, authOptions).then(function (response) {
- cursor = response.cursor;
- if (response.results.length) {
- var results = _this3._parseResponse(response);
- results.forEach(function (result) {
- return remainResults.push(result);
- });
- }
- if (cursor === null && remainResults.length === 0) {
- return {
- done: true
- };
- }
- return {
- done: false,
- value: remainResults.shift()
- };
- });
- }
- };
- },
- /**
- * Delete objects retrieved by this query.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the save
- * completes.
- */
- destroyAll: function destroyAll(options) {
- var self = this;
- return (0, _find.default)(self).call(self, options).then(function (objects) {
- return AV.Object.destroyAll(objects, options);
- });
- },
- /**
- * Counts the number of objects that match this query.
- *
- * @param {AuthOptions} options
- * @return {Promise} A promise that is resolved with the count when
- * the query completes.
- */
- count: function count(options) {
- var params = this._getParams();
- params.limit = 0;
- params.count = 1;
- var request = this._createRequest(params, options);
- return request.then(function (response) {
- return response.count;
- });
- },
- /**
- * Retrieves at most one AV.Object that satisfies this query.
- *
- * @param {AuthOptions} options
- * @return {Promise} A promise that is resolved with the object when
- * the query completes.
- */
- first: function first(options) {
- var self = this;
- var params = this._getParams();
- params.limit = 1;
- var request = this._createRequest(params, options);
- return request.then(function (response) {
- return (0, _map.default)(_).call(_, response.results, function (json) {
- var obj = self._newObject();
- if (obj._finishFetch) {
- obj._finishFetch(self._processResult(json), true);
- }
- return obj;
- })[0];
- });
- },
- /**
- * Sets the number of results to skip before returning any results.
- * This is useful for pagination.
- * Default is to skip zero results.
- * @param {Number} n the number of results to skip.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- skip: function skip(n) {
- requires(n, 'undefined is not a valid skip value');
- this._skip = n;
- return this;
- },
- /**
- * Sets the limit of the number of results to return. The default limit is
- * 100, with a maximum of 1000 results being returned at a time.
- * @param {Number} n the number of results to limit to.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- limit: function limit(n) {
- requires(n, 'undefined is not a valid limit value');
- this._limit = n;
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be equal to the provided value.
- * @param {String} key The key to check.
- * @param value The value that the AV.Object must contain.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- equalTo: function equalTo(key, value) {
- requires(key, 'undefined is not a valid key');
- requires(value, 'undefined is not a valid value');
- this._where[key] = AV._encode(value);
- return this;
- },
- /**
- * Helper for condition queries
- * @private
- */
- _addCondition: function _addCondition(key, condition, value) {
- requires(key, 'undefined is not a valid condition key');
- requires(condition, 'undefined is not a valid condition');
- requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
- if (!this._where[key]) {
- this._where[key] = {};
- }
- this._where[key][condition] = AV._encode(value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular
- * <strong>array</strong> key's length to be equal to the provided value.
- * @param {String} key The array key to check.
- * @param {number} value The length value.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- sizeEqualTo: function sizeEqualTo(key, value) {
- this._addCondition(key, '$size', value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be not equal to the provided value.
- * @param {String} key The key to check.
- * @param value The value that must not be equalled.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- notEqualTo: function notEqualTo(key, value) {
- this._addCondition(key, '$ne', value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be less than the provided value.
- * @param {String} key The key to check.
- * @param value The value that provides an upper bound.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- lessThan: function lessThan(key, value) {
- this._addCondition(key, '$lt', value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be greater than the provided value.
- * @param {String} key The key to check.
- * @param value The value that provides an lower bound.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- greaterThan: function greaterThan(key, value) {
- this._addCondition(key, '$gt', value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be less than or equal to the provided value.
- * @param {String} key The key to check.
- * @param value The value that provides an upper bound.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
- this._addCondition(key, '$lte', value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be greater than or equal to the provided value.
- * @param {String} key The key to check.
- * @param value The value that provides an lower bound.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
- this._addCondition(key, '$gte', value);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * be contained in the provided list of values.
- * @param {String} key The key to check.
- * @param {Array} values The values that will match.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- containedIn: function containedIn(key, values) {
- this._addCondition(key, '$in', values);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * not be contained in the provided list of values.
- * @param {String} key The key to check.
- * @param {Array} values The values that will not match.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- notContainedIn: function notContainedIn(key, values) {
- this._addCondition(key, '$nin', values);
- return this;
- },
- /**
- * Add a constraint to the query that requires a particular key's value to
- * contain each one of the provided list of values.
- * @param {String} key The key to check. This key's value must be an array.
- * @param {Array} values The values that will match.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- containsAll: function containsAll(key, values) {
- this._addCondition(key, '$all', values);
- return this;
- },
- /**
- * Add a constraint for finding objects that contain the given key.
- * @param {String} key The key that should exist.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- exists: function exists(key) {
- this._addCondition(key, '$exists', true);
- return this;
- },
- /**
- * Add a constraint for finding objects that do not contain a given key.
- * @param {String} key The key that should not exist
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- doesNotExist: function doesNotExist(key) {
- this._addCondition(key, '$exists', false);
- return this;
- },
- /**
- * Add a regular expression constraint for finding string values that match
- * the provided regular expression.
- * This may be slow for large datasets.
- * @param {String} key The key that the string to match is stored in.
- * @param {RegExp} regex The regular expression pattern to match.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- matches: function matches(key, regex, modifiers) {
- this._addCondition(key, '$regex', regex);
- if (!modifiers) {
- modifiers = '';
- } // Javascript regex options support mig as inline options but store them
- // as properties of the object. We support mi & should migrate them to
- // modifiers
- if (regex.ignoreCase) {
- modifiers += 'i';
- }
- if (regex.multiline) {
- modifiers += 'm';
- }
- if (modifiers && modifiers.length) {
- this._addCondition(key, '$options', modifiers);
- }
- return this;
- },
- /**
- * Add a constraint that requires that a key's value matches a AV.Query
- * constraint.
- * @param {String} key The key that the contains the object to match the
- * query.
- * @param {AV.Query} query The query that should match.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- matchesQuery: function matchesQuery(key, query) {
- var queryJSON = query._getParams();
- queryJSON.className = query.className;
- this._addCondition(key, '$inQuery', queryJSON);
- return this;
- },
- /**
- * Add a constraint that requires that a key's value not matches a
- * AV.Query constraint.
- * @param {String} key The key that the contains the object to match the
- * query.
- * @param {AV.Query} query The query that should not match.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- doesNotMatchQuery: function doesNotMatchQuery(key, query) {
- var queryJSON = query._getParams();
- queryJSON.className = query.className;
- this._addCondition(key, '$notInQuery', queryJSON);
- return this;
- },
- /**
- * Add a constraint that requires that a key's value matches a value in
- * an object returned by a different AV.Query.
- * @param {String} key The key that contains the value that is being
- * matched.
- * @param {String} queryKey The key in the objects returned by the query to
- * match against.
- * @param {AV.Query} query The query to run.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
- var queryJSON = query._getParams();
- queryJSON.className = query.className;
- this._addCondition(key, '$select', {
- key: queryKey,
- query: queryJSON
- });
- return this;
- },
- /**
- * Add a constraint that requires that a key's value not match a value in
- * an object returned by a different AV.Query.
- * @param {String} key The key that contains the value that is being
- * excluded.
- * @param {String} queryKey The key in the objects returned by the query to
- * match against.
- * @param {AV.Query} query The query to run.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
- var queryJSON = query._getParams();
- queryJSON.className = query.className;
- this._addCondition(key, '$dontSelect', {
- key: queryKey,
- query: queryJSON
- });
- return this;
- },
- /**
- * Add constraint that at least one of the passed in queries matches.
- * @param {Array} queries
- * @return {AV.Query} Returns the query, so you can chain this call.
- * @private
- */
- _orQuery: function _orQuery(queries) {
- var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
- return q._getParams().where;
- });
- this._where.$or = queryJSON;
- return this;
- },
- /**
- * Add constraint that both of the passed in queries matches.
- * @param {Array} queries
- * @return {AV.Query} Returns the query, so you can chain this call.
- * @private
- */
- _andQuery: function _andQuery(queries) {
- var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
- return q._getParams().where;
- });
- this._where.$and = queryJSON;
- return this;
- },
- /**
- * Converts a string into a regex that matches it.
- * Surrounding with \Q .. \E does this, we just need to escape \E's in
- * the text separately.
- * @private
- */
- _quote: function _quote(s) {
- return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
- },
- /**
- * Add a constraint for finding string values that contain a provided
- * string. This may be slow for large datasets.
- * @param {String} key The key that the string to match is stored in.
- * @param {String} substring The substring that the value must contain.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- contains: function contains(key, value) {
- this._addCondition(key, '$regex', this._quote(value));
- return this;
- },
- /**
- * Add a constraint for finding string values that start with a provided
- * string. This query will use the backend index, so it will be fast even
- * for large datasets.
- * @param {String} key The key that the string to match is stored in.
- * @param {String} prefix The substring that the value must start with.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- startsWith: function startsWith(key, value) {
- this._addCondition(key, '$regex', '^' + this._quote(value));
- return this;
- },
- /**
- * Add a constraint for finding string values that end with a provided
- * string. This will be slow for large datasets.
- * @param {String} key The key that the string to match is stored in.
- * @param {String} suffix The substring that the value must end with.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- endsWith: function endsWith(key, value) {
- this._addCondition(key, '$regex', this._quote(value) + '$');
- return this;
- },
- /**
- * Sorts the results in ascending order by the given key.
- *
- * @param {String} key The key to order by.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- ascending: function ascending(key) {
- requires(key, 'undefined is not a valid key');
- this._order = key;
- return this;
- },
- /**
- * Also sorts the results in ascending order by the given key. The previous sort keys have
- * precedence over this key.
- *
- * @param {String} key The key to order by
- * @return {AV.Query} Returns the query so you can chain this call.
- */
- addAscending: function addAscending(key) {
- requires(key, 'undefined is not a valid key');
- if (this._order) this._order += ',' + key;else this._order = key;
- return this;
- },
- /**
- * Sorts the results in descending order by the given key.
- *
- * @param {String} key The key to order by.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- descending: function descending(key) {
- requires(key, 'undefined is not a valid key');
- this._order = '-' + key;
- return this;
- },
- /**
- * Also sorts the results in descending order by the given key. The previous sort keys have
- * precedence over this key.
- *
- * @param {String} key The key to order by
- * @return {AV.Query} Returns the query so you can chain this call.
- */
- addDescending: function addDescending(key) {
- requires(key, 'undefined is not a valid key');
- if (this._order) this._order += ',-' + key;else this._order = '-' + key;
- return this;
- },
- /**
- * Add a proximity based constraint for finding objects with key point
- * values near the point given.
- * @param {String} key The key that the AV.GeoPoint is stored in.
- * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- near: function near(key, point) {
- if (!(point instanceof AV.GeoPoint)) {
- // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
- point = new AV.GeoPoint(point);
- }
- this._addCondition(key, '$nearSphere', point);
- return this;
- },
- /**
- * Add a proximity based constraint for finding objects with key point
- * values near the point given and within the maximum distance given.
- * @param {String} key The key that the AV.GeoPoint is stored in.
- * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
- * @param maxDistance Maximum distance (in radians) of results to return.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- withinRadians: function withinRadians(key, point, distance) {
- this.near(key, point);
- this._addCondition(key, '$maxDistance', distance);
- return this;
- },
- /**
- * Add a proximity based constraint for finding objects with key point
- * values near the point given and within the maximum distance given.
- * Radius of earth used is 3958.8 miles.
- * @param {String} key The key that the AV.GeoPoint is stored in.
- * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
- * @param {Number} maxDistance Maximum distance (in miles) of results to
- * return.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- withinMiles: function withinMiles(key, point, distance) {
- return this.withinRadians(key, point, distance / 3958.8);
- },
- /**
- * Add a proximity based constraint for finding objects with key point
- * values near the point given and within the maximum distance given.
- * Radius of earth used is 6371.0 kilometers.
- * @param {String} key The key that the AV.GeoPoint is stored in.
- * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
- * @param {Number} maxDistance Maximum distance (in kilometers) of results
- * to return.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- withinKilometers: function withinKilometers(key, point, distance) {
- return this.withinRadians(key, point, distance / 6371.0);
- },
- /**
- * Add a constraint to the query that requires a particular key's
- * coordinates be contained within a given rectangular geographic bounding
- * box.
- * @param {String} key The key to be constrained.
- * @param {AV.GeoPoint} southwest
- * The lower-left inclusive corner of the box.
- * @param {AV.GeoPoint} northeast
- * The upper-right inclusive corner of the box.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- withinGeoBox: function withinGeoBox(key, southwest, northeast) {
- if (!(southwest instanceof AV.GeoPoint)) {
- southwest = new AV.GeoPoint(southwest);
- }
- if (!(northeast instanceof AV.GeoPoint)) {
- northeast = new AV.GeoPoint(northeast);
- }
- this._addCondition(key, '$within', {
- $box: [southwest, northeast]
- });
- return this;
- },
- /**
- * Include nested AV.Objects for the provided key. You can use dot
- * notation to specify which fields in the included object are also fetch.
- * @param {String[]} keys The name of the key to include.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- include: function include(keys) {
- var _this4 = this;
- requires(keys, 'undefined is not a valid key');
- _.forEach(arguments, function (keys) {
- var _context;
- _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
- });
- return this;
- },
- /**
- * Include the ACL.
- * @param {Boolean} [value=true] Whether to include the ACL
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- includeACL: function includeACL() {
- var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
- this._includeACL = value;
- return this;
- },
- /**
- * Restrict the fields of the returned AV.Objects to include only the
- * provided keys. If this is called multiple times, then all of the keys
- * specified in each of the calls will be included.
- * @param {String[]} keys The names of the keys to include.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- select: function select(keys) {
- var _this5 = this;
- requires(keys, 'undefined is not a valid key');
- _.forEach(arguments, function (keys) {
- var _context2;
- _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
- });
- return this;
- },
- /**
- * Iterates over each result of a query, calling a callback for each one. If
- * the callback returns a promise, the iteration will not continue until
- * that promise has been fulfilled. If the callback returns a rejected
- * promise, then iteration will stop with that error. The items are
- * processed in an unspecified order. The query may not have any sort order,
- * and may not use limit or skip.
- * @param callback {Function} Callback that will be called with each result
- * of the query.
- * @return {Promise} A promise that will be fulfilled once the
- * iteration has completed.
- */
- each: function each(callback) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (this._order || this._skip || this._limit >= 0) {
- var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
- return _promise.default.reject(error);
- }
- var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
- // This is undocumented, but useful for testing.
- query._limit = options.batchSize || 100;
- query._where = _.clone(this._where);
- query._include = _.clone(this._include);
- query.ascending('objectId');
- var finished = false;
- return continueWhile(function () {
- return !finished;
- }, function () {
- return (0, _find.default)(query).call(query, options).then(function (results) {
- var callbacksDone = _promise.default.resolve();
- _.each(results, function (result) {
- callbacksDone = callbacksDone.then(function () {
- return callback(result);
- });
- });
- return callbacksDone.then(function () {
- if (results.length >= query._limit) {
- query.greaterThan('objectId', results[results.length - 1].id);
- } else {
- finished = true;
- }
- });
- });
- });
- },
- /**
- * Subscribe the changes of this query.
- *
- * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
- *
- * @since 3.0.0
- * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
- */
- subscribe: function subscribe(options) {
- return AV.LiveQuery.init(this, options);
- }
- });
- AV.FriendShipQuery = AV.Query._extend({
- _newObject: function _newObject() {
- var UserClass = AV.Object._getSubclass('_User');
- return new UserClass();
- },
- _processResult: function _processResult(json) {
- if (json && json[this._friendshipTag]) {
- var user = json[this._friendshipTag];
- if (user.__type === 'Pointer' && user.className === '_User') {
- delete user.__type;
- delete user.className;
- }
- return user;
- } else {
- return null;
- }
- }
- });
- };
- /***/ }),
- /* 559 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _keys = _interopRequireDefault(__webpack_require__(59));
- var _ = __webpack_require__(3);
- var EventEmitter = __webpack_require__(235);
- var _require = __webpack_require__(30),
- inherits = _require.inherits;
- var _require2 = __webpack_require__(27),
- request = _require2.request;
- var subscribe = function subscribe(queryJSON, subscriptionId) {
- return request({
- method: 'POST',
- path: '/LiveQuery/subscribe',
- data: {
- query: queryJSON,
- id: subscriptionId
- }
- });
- };
- module.exports = function (AV) {
- var requireRealtime = function requireRealtime() {
- if (!AV._config.realtime) {
- throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
- }
- };
- /**
- * @class
- * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
- * @since 3.0.0
- */
- AV.LiveQuery = inherits(EventEmitter,
- /** @lends AV.LiveQuery.prototype */
- {
- constructor: function constructor(id, client, queryJSON, subscriptionId) {
- var _this = this;
- EventEmitter.apply(this);
- this.id = id;
- this._client = client;
- this._client.register(this);
- this._queryJSON = queryJSON;
- this._subscriptionId = subscriptionId;
- this._onMessage = this._dispatch.bind(this);
- this._onReconnect = function () {
- subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
- return console.error("LiveQuery resubscribe error: ".concat(error.message));
- });
- };
- client.on('message', this._onMessage);
- client.on('reconnect', this._onReconnect);
- },
- _dispatch: function _dispatch(message) {
- var _this2 = this;
- message.forEach(function (_ref) {
- var op = _ref.op,
- object = _ref.object,
- queryId = _ref.query_id,
- updatedKeys = _ref.updatedKeys;
- if (queryId !== _this2.id) return;
- var target = AV.parseJSON(_.extend({
- __type: object.className === '_File' ? 'File' : 'Object'
- }, object));
- if (updatedKeys) {
- /**
- * An existing AV.Object which fulfills the Query you subscribe is updated.
- * @event AV.LiveQuery#update
- * @param {AV.Object|AV.File} target updated object
- * @param {String[]} updatedKeys updated keys
- */
- /**
- * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
- * @event AV.LiveQuery#enter
- * @param {AV.Object|AV.File} target updated object
- * @param {String[]} updatedKeys updated keys
- */
- /**
- * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
- * @event AV.LiveQuery#leave
- * @param {AV.Object|AV.File} target updated object
- * @param {String[]} updatedKeys updated keys
- */
- _this2.emit(op, target, updatedKeys);
- } else {
- /**
- * A new AV.Object which fulfills the Query you subscribe is created.
- * @event AV.LiveQuery#create
- * @param {AV.Object|AV.File} target updated object
- */
- /**
- * An existing AV.Object which fulfills the Query you subscribe is deleted.
- * @event AV.LiveQuery#delete
- * @param {AV.Object|AV.File} target updated object
- */
- _this2.emit(op, target);
- }
- });
- },
- /**
- * unsubscribe the query
- *
- * @return {Promise}
- */
- unsubscribe: function unsubscribe() {
- var client = this._client;
- client.off('message', this._onMessage);
- client.off('reconnect', this._onReconnect);
- client.deregister(this);
- return request({
- method: 'POST',
- path: '/LiveQuery/unsubscribe',
- data: {
- id: client.id,
- query_id: this.id
- }
- });
- }
- },
- /** @lends AV.LiveQuery */
- {
- init: function init(query) {
- var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref2$subscriptionId = _ref2.subscriptionId,
- userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
- requireRealtime();
- if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
- return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
- return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
- var _query$_getParams = query._getParams(),
- where = _query$_getParams.where,
- keys = (0, _keys.default)(_query$_getParams),
- returnACL = _query$_getParams.returnACL;
- var queryJSON = {
- where: where,
- keys: keys,
- returnACL: returnACL,
- className: query.className
- };
- var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
- var queryId = _ref3.query_id;
- return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
- }).finally(function () {
- liveQueryClient.deregister(promise);
- });
- liveQueryClient.register(promise);
- return promise;
- });
- });
- },
- /**
- * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
- * @static
- * @return void
- */
- pause: function pause() {
- requireRealtime();
- return AV._config.realtime.pause();
- },
- /**
- * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
- * @static
- * @return void
- */
- resume: function resume() {
- requireRealtime();
- return AV._config.realtime.resume();
- }
- });
- };
- /***/ }),
- /* 560 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _ = __webpack_require__(3);
- var _require = __webpack_require__(30),
- tap = _require.tap;
- module.exports = function (AV) {
- /**
- * @class
- * @example
- * AV.Captcha.request().then(captcha => {
- * captcha.bind({
- * textInput: 'code', // the id for textInput
- * image: 'captcha',
- * verifyButton: 'verify',
- * }, {
- * success: (validateCode) => {}, // next step
- * error: (error) => {}, // present error.message to user
- * });
- * });
- */
- AV.Captcha = function Captcha(options, authOptions) {
- this._options = options;
- this._authOptions = authOptions;
- /**
- * The image url of the captcha
- * @type string
- */
- this.url = undefined;
- /**
- * The captchaToken of the captcha.
- * @type string
- */
- this.captchaToken = undefined;
- /**
- * The validateToken of the captcha.
- * @type string
- */
- this.validateToken = undefined;
- };
- /**
- * Refresh the captcha
- * @return {Promise.<string>} a new capcha url
- */
- AV.Captcha.prototype.refresh = function refresh() {
- var _this = this;
- return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
- var captchaToken = _ref.captchaToken,
- url = _ref.url;
- _.extend(_this, {
- captchaToken: captchaToken,
- url: url
- });
- return url;
- });
- };
- /**
- * Verify the captcha
- * @param {String} code The code from user input
- * @return {Promise.<string>} validateToken if the code is valid
- */
- AV.Captcha.prototype.verify = function verify(code) {
- var _this2 = this;
- return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
- return _this2.validateToken = validateToken;
- }));
- };
- if (false) {
- /**
- * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
- * @param [elements]
- * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
- * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
- * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
- * @param [callbacks]
- * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
- * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
- */
- AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
- var _this3 = this;
- var textInput = _ref2.textInput,
- image = _ref2.image,
- verifyButton = _ref2.verifyButton;
- var success = _ref3.success,
- error = _ref3.error;
- if (typeof textInput === 'string') {
- textInput = document.getElementById(textInput);
- if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
- }
- if (typeof image === 'string') {
- image = document.getElementById(image);
- if (!image) throw new Error("image with id ".concat(image, " not found"));
- }
- if (typeof verifyButton === 'string') {
- verifyButton = document.getElementById(verifyButton);
- if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
- }
- this.__refresh = function () {
- return _this3.refresh().then(function (url) {
- image.src = url;
- if (textInput) {
- textInput.value = '';
- textInput.focus();
- }
- }).catch(function (err) {
- return console.warn("refresh captcha fail: ".concat(err.message));
- });
- };
- if (image) {
- this.__image = image;
- image.src = this.url;
- image.addEventListener('click', this.__refresh);
- }
- this.__verify = function () {
- var code = textInput.value;
- _this3.verify(code).catch(function (err) {
- _this3.__refresh();
- throw err;
- }).then(success, error).catch(function (err) {
- return console.warn("verify captcha fail: ".concat(err.message));
- });
- };
- if (textInput && verifyButton) {
- this.__verifyButton = verifyButton;
- verifyButton.addEventListener('click', this.__verify);
- }
- };
- /**
- * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
- */
- AV.Captcha.prototype.unbind = function unbind() {
- if (this.__image) this.__image.removeEventListener('click', this.__refresh);
- if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
- };
- }
- /**
- * Request a captcha
- * @param [options]
- * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
- * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
- * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
- * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
- * @return {Promise.<AV.Captcha>}
- */
- AV.Captcha.request = function (options, authOptions) {
- var captcha = new AV.Captcha(options, authOptions);
- return captcha.refresh().then(function () {
- return captcha;
- });
- };
- };
- /***/ }),
- /* 561 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3);
- var _require = __webpack_require__(27),
- _request = _require._request,
- request = _require.request;
- module.exports = function (AV) {
- /**
- * Contains functions for calling and declaring
- * <p><strong><em>
- * Some functions are only available from Cloud Code.
- * </em></strong></p>
- *
- * @namespace
- * @borrows AV.Captcha.request as requestCaptcha
- */
- AV.Cloud = AV.Cloud || {};
- _.extend(AV.Cloud,
- /** @lends AV.Cloud */
- {
- /**
- * Makes a call to a cloud function.
- * @param {String} name The function name.
- * @param {Object} [data] The parameters to send to the cloud function.
- * @param {AuthOptions} [options]
- * @return {Promise} A promise that will be resolved with the result
- * of the function.
- */
- run: function run(name, data, options) {
- return request({
- service: 'engine',
- method: 'POST',
- path: "/functions/".concat(name),
- data: AV._encode(data, null, true),
- authOptions: options
- }).then(function (resp) {
- return AV._decode(resp).result;
- });
- },
- /**
- * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
- * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
- * @param {String} name The function name.
- * @param {Object} [data] The parameters to send to the cloud function.
- * @param {AuthOptions} [options]
- * @return {Promise} A promise that will be resolved with the result of the function.
- */
- rpc: function rpc(name, data, options) {
- if (_.isArray(data)) {
- return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
- }
- return request({
- service: 'engine',
- method: 'POST',
- path: "/call/".concat(name),
- data: AV._encodeObjectOrArray(data),
- authOptions: options
- }).then(function (resp) {
- return AV._decode(resp).result;
- });
- },
- /**
- * Make a call to request server date time.
- * @return {Promise.<Date>} A promise that will be resolved with the result
- * of the function.
- * @since 0.5.9
- */
- getServerDate: function getServerDate() {
- return _request('date', null, null, 'GET').then(function (resp) {
- return AV._decode(resp);
- });
- },
- /**
- * Makes a call to request an sms code for operation verification.
- * @param {String|Object} data The mobile phone number string or a JSON
- * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
- * @param {String} data.mobilePhoneNumber
- * @param {String} [data.template] sms template name
- * @param {String} [data.sign] sms signature name
- * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
- * @param {SMSAuthOptions} [options]
- * @return {Promise} A promise that will be resolved if the request succeed
- */
- requestSmsCode: function requestSmsCode(data) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (_.isString(data)) {
- data = {
- mobilePhoneNumber: data
- };
- }
- if (!data.mobilePhoneNumber) {
- throw new Error('Missing mobilePhoneNumber.');
- }
- if (options.validateToken) {
- data = _.extend({}, data, {
- validate_token: options.validateToken
- });
- }
- return _request('requestSmsCode', null, null, 'POST', data, options);
- },
- /**
- * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
- * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
- * @param {phone} phone The mobile phoner number.
- * @return {Promise} A promise that will be resolved with the result
- * of the function.
- */
- verifySmsCode: function verifySmsCode(code, phone) {
- if (!code) throw new Error('Missing sms code.');
- var params = {};
- if (_.isString(phone)) {
- params['mobilePhoneNumber'] = phone;
- }
- return _request('verifySmsCode', code, null, 'POST', params);
- },
- _requestCaptcha: function _requestCaptcha(options, authOptions) {
- return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
- var url = _ref.captcha_url,
- captchaToken = _ref.captcha_token;
- return {
- captchaToken: captchaToken,
- url: url
- };
- });
- },
- /**
- * Request a captcha.
- */
- requestCaptcha: AV.Captcha.request,
- /**
- * Verify captcha code. This is the low-level API for captcha.
- * Checkout {@link AV.Captcha} for high abstract APIs.
- * @param {String} code the code from user input
- * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
- * @return {Promise.<String>} validateToken if the code is valid
- */
- verifyCaptcha: function verifyCaptcha(code, captchaToken) {
- return _request('verifyCaptcha', null, null, 'POST', {
- captcha_code: code,
- captcha_token: captchaToken
- }).then(function (_ref2) {
- var validateToken = _ref2.validate_token;
- return validateToken;
- });
- }
- });
- };
- /***/ }),
- /* 562 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var request = __webpack_require__(27).request;
- module.exports = function (AV) {
- AV.Installation = AV.Object.extend('_Installation');
- /**
- * @namespace
- */
- AV.Push = AV.Push || {};
- /**
- * Sends a push notification.
- * @param {Object} data The data of the push notification.
- * @param {String[]} [data.channels] An Array of channels to push to.
- * @param {Date} [data.push_time] A Date object for when to send the push.
- * @param {Date} [data.expiration_time] A Date object for when to expire
- * the push.
- * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
- * @param {Number} [data.flow_control] The clients to notify per second
- * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
- * a set of installations to push to.
- * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
- * a set of installations to push to.
- * @param {Object} data.data The data to send as part of the push.
- More details: https://url.leanapp.cn/pushData
- * @param {AuthOptions} [options]
- * @return {Promise}
- */
- AV.Push.send = function (data, options) {
- if (data.where) {
- data.where = data.where._getParams().where;
- }
- if (data.where && data.cql) {
- throw new Error("Both where and cql can't be set");
- }
- if (data.push_time) {
- data.push_time = data.push_time.toJSON();
- }
- if (data.expiration_time) {
- data.expiration_time = data.expiration_time.toJSON();
- }
- if (data.expiration_time && data.expiration_interval) {
- throw new Error("Both expiration_time and expiration_interval can't be set");
- }
- return request({
- service: 'push',
- method: 'POST',
- path: '/push',
- data: data,
- authOptions: options
- });
- };
- };
- /***/ }),
- /* 563 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _typeof2 = _interopRequireDefault(__webpack_require__(73));
- var _ = __webpack_require__(3);
- var AVRequest = __webpack_require__(27)._request;
- var _require = __webpack_require__(30),
- getSessionToken = _require.getSessionToken;
- module.exports = function (AV) {
- var getUser = function getUser() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var sessionToken = getSessionToken(options);
- if (sessionToken) {
- return AV.User._fetchUserBySessionToken(getSessionToken(options));
- }
- return AV.User.currentAsync();
- };
- var getUserPointer = function getUserPointer(options) {
- return getUser(options).then(function (currUser) {
- return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
- });
- };
- /**
- * Contains functions to deal with Status in LeanCloud.
- * @class
- */
- AV.Status = function (imageUrl, message) {
- this.data = {};
- this.inboxType = 'default';
- this.query = null;
- if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
- this.data = imageUrl;
- } else {
- if (imageUrl) {
- this.data.image = imageUrl;
- }
- if (message) {
- this.data.message = message;
- }
- }
- return this;
- };
- _.extend(AV.Status.prototype,
- /** @lends AV.Status.prototype */
- {
- /**
- * Gets the value of an attribute in status data.
- * @param {String} attr The string name of an attribute.
- */
- get: function get(attr) {
- return this.data[attr];
- },
- /**
- * Sets a hash of model attributes on the status data.
- * @param {String} key The key to set.
- * @param {any} value The value to give it.
- */
- set: function set(key, value) {
- this.data[key] = value;
- return this;
- },
- /**
- * Destroy this status,then it will not be avaiable in other user's inboxes.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the destroy
- * completes.
- */
- destroy: function destroy(options) {
- if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
- var request = AVRequest('statuses', null, this.id, 'DELETE', options);
- return request;
- },
- /**
- * Cast the AV.Status object to an AV.Object pointer.
- * @return {AV.Object} A AV.Object pointer.
- */
- toObject: function toObject() {
- if (!this.id) return null;
- return AV.Object.createWithoutData('_Status', this.id);
- },
- _getDataJSON: function _getDataJSON() {
- var json = _.clone(this.data);
- return AV._encode(json);
- },
- /**
- * Send a status by a AV.Query object.
- * @since 0.3.0
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the send
- * completes.
- * @example
- * // send a status to male users
- * var status = new AVStatus('image url', 'a message');
- * status.query = new AV.Query('_User');
- * status.query.equalTo('gender', 'male');
- * status.send().then(function(){
- * //send status successfully.
- * }, function(err){
- * //an error threw.
- * console.dir(err);
- * });
- */
- send: function send() {
- var _this = this;
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- if (!getSessionToken(options) && !AV.User.current()) {
- throw new Error('Please signin an user.');
- }
- if (!this.query) {
- return AV.Status.sendStatusToFollowers(this, options);
- }
- return getUserPointer(options).then(function (currUser) {
- var query = _this.query._getParams();
- query.className = _this.query.className;
- var data = {};
- data.query = query;
- _this.data = _this.data || {};
- _this.data.source = _this.data.source || currUser;
- data.data = _this._getDataJSON();
- data.inboxType = _this.inboxType || 'default';
- return AVRequest('statuses', null, null, 'POST', data, options);
- }).then(function (response) {
- _this.id = response.objectId;
- _this.createdAt = AV._parseDate(response.createdAt);
- return _this;
- });
- },
- _finishFetch: function _finishFetch(serverData) {
- this.id = serverData.objectId;
- this.createdAt = AV._parseDate(serverData.createdAt);
- this.updatedAt = AV._parseDate(serverData.updatedAt);
- this.messageId = serverData.messageId;
- delete serverData.messageId;
- delete serverData.objectId;
- delete serverData.createdAt;
- delete serverData.updatedAt;
- this.data = AV._decode(serverData);
- }
- });
- /**
- * Send a status to current signined user's followers.
- * @since 0.3.0
- * @param {AV.Status} status A status object to be send to followers.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the send
- * completes.
- * @example
- * var status = new AVStatus('image url', 'a message');
- * AV.Status.sendStatusToFollowers(status).then(function(){
- * //send status successfully.
- * }, function(err){
- * //an error threw.
- * console.dir(err);
- * });
- */
- AV.Status.sendStatusToFollowers = function (status) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (!getSessionToken(options) && !AV.User.current()) {
- throw new Error('Please signin an user.');
- }
- return getUserPointer(options).then(function (currUser) {
- var query = {};
- query.className = '_Follower';
- query.keys = 'follower';
- query.where = {
- user: currUser
- };
- var data = {};
- data.query = query;
- status.data = status.data || {};
- status.data.source = status.data.source || currUser;
- data.data = status._getDataJSON();
- data.inboxType = status.inboxType || 'default';
- var request = AVRequest('statuses', null, null, 'POST', data, options);
- return request.then(function (response) {
- status.id = response.objectId;
- status.createdAt = AV._parseDate(response.createdAt);
- return status;
- });
- });
- };
- /**
- * <p>Send a status from current signined user to other user's private status inbox.</p>
- * @since 0.3.0
- * @param {AV.Status} status A status object to be send to followers.
- * @param {String} target The target user or user's objectId.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the send
- * completes.
- * @example
- * // send a private status to user '52e84e47e4b0f8de283b079b'
- * var status = new AVStatus('image url', 'a message');
- * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
- * //send status successfully.
- * }, function(err){
- * //an error threw.
- * console.dir(err);
- * });
- */
- AV.Status.sendPrivateStatus = function (status, target) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (!getSessionToken(options) && !AV.User.current()) {
- throw new Error('Please signin an user.');
- }
- if (!target) {
- throw new Error('Invalid target user.');
- }
- var userObjectId = _.isString(target) ? target : target.id;
- if (!userObjectId) {
- throw new Error('Invalid target user.');
- }
- return getUserPointer(options).then(function (currUser) {
- var query = {};
- query.className = '_User';
- query.where = {
- objectId: userObjectId
- };
- var data = {};
- data.query = query;
- status.data = status.data || {};
- status.data.source = status.data.source || currUser;
- data.data = status._getDataJSON();
- data.inboxType = 'private';
- status.inboxType = 'private';
- var request = AVRequest('statuses', null, null, 'POST', data, options);
- return request.then(function (response) {
- status.id = response.objectId;
- status.createdAt = AV._parseDate(response.createdAt);
- return status;
- });
- });
- };
- /**
- * Count unread statuses in someone's inbox.
- * @since 0.3.0
- * @param {AV.User} owner The status owner.
- * @param {String} inboxType The inbox type, 'default' by default.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the count
- * completes.
- * @example
- * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
- * console.log(response.unread); //unread statuses number.
- * console.log(response.total); //total statuses number.
- * });
- */
- AV.Status.countUnreadStatuses = function (owner) {
- var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (!_.isString(inboxType)) options = inboxType;
- if (!getSessionToken(options) && owner == null && !AV.User.current()) {
- throw new Error('Please signin an user or pass the owner objectId.');
- }
- return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
- var params = {};
- params.inboxType = AV._encode(inboxType);
- params.owner = AV._encode(owner);
- return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
- });
- };
- /**
- * reset unread statuses count in someone's inbox.
- * @since 2.1.0
- * @param {AV.User} owner The status owner.
- * @param {String} inboxType The inbox type, 'default' by default.
- * @param {AuthOptions} options
- * @return {Promise} A promise that is fulfilled when the reset
- * completes.
- * @example
- * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
- * console.log(response.unread); //unread statuses number.
- * console.log(response.total); //total statuses number.
- * });
- */
- AV.Status.resetUnreadCount = function (owner) {
- var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (!_.isString(inboxType)) options = inboxType;
- if (!getSessionToken(options) && owner == null && !AV.User.current()) {
- throw new Error('Please signin an user or pass the owner objectId.');
- }
- return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
- var params = {};
- params.inboxType = AV._encode(inboxType);
- params.owner = AV._encode(owner);
- return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
- });
- };
- /**
- * Create a status query to find someone's published statuses.
- * @since 0.3.0
- * @param {AV.User} source The status source, typically the publisher.
- * @return {AV.Query} The query object for status.
- * @example
- * //Find current user's published statuses.
- * var query = AV.Status.statusQuery(AV.User.current());
- * query.find().then(function(statuses){
- * //process statuses
- * });
- */
- AV.Status.statusQuery = function (source) {
- var query = new AV.Query('_Status');
- if (source) {
- query.equalTo('source', source);
- }
- return query;
- };
- /**
- * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
- * @class
- */
- AV.InboxQuery = AV.Query._extend(
- /** @lends AV.InboxQuery.prototype */
- {
- _objectClass: AV.Status,
- _sinceId: 0,
- _maxId: 0,
- _inboxType: 'default',
- _owner: null,
- _newObject: function _newObject() {
- return new AV.Status();
- },
- _createRequest: function _createRequest(params, options) {
- return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
- },
- /**
- * Sets the messageId of results to skip before returning any results.
- * This is useful for pagination.
- * Default is zero.
- * @param {Number} n the mesage id.
- * @return {AV.InboxQuery} Returns the query, so you can chain this call.
- */
- sinceId: function sinceId(id) {
- this._sinceId = id;
- return this;
- },
- /**
- * Sets the maximal messageId of results。
- * This is useful for pagination.
- * Default is zero that is no limition.
- * @param {Number} n the mesage id.
- * @return {AV.InboxQuery} Returns the query, so you can chain this call.
- */
- maxId: function maxId(id) {
- this._maxId = id;
- return this;
- },
- /**
- * Sets the owner of the querying inbox.
- * @param {AV.User} owner The inbox owner.
- * @return {AV.InboxQuery} Returns the query, so you can chain this call.
- */
- owner: function owner(_owner) {
- this._owner = _owner;
- return this;
- },
- /**
- * Sets the querying inbox type.default is 'default'.
- * @param {String} type The inbox type.
- * @return {AV.InboxQuery} Returns the query, so you can chain this call.
- */
- inboxType: function inboxType(type) {
- this._inboxType = type;
- return this;
- },
- _getParams: function _getParams() {
- var params = AV.InboxQuery.__super__._getParams.call(this);
- params.owner = AV._encode(this._owner);
- params.inboxType = AV._encode(this._inboxType);
- params.sinceId = AV._encode(this._sinceId);
- params.maxId = AV._encode(this._maxId);
- return params;
- }
- });
- /**
- * Create a inbox status query to find someone's inbox statuses.
- * @since 0.3.0
- * @param {AV.User} owner The inbox's owner
- * @param {String} inboxType The inbox type,'default' by default.
- * @return {AV.InboxQuery} The inbox query object.
- * @see AV.InboxQuery
- * @example
- * //Find current user's default inbox statuses.
- * var query = AV.Status.inboxQuery(AV.User.current());
- * //find the statuses after the last message id
- * query.sinceId(lastMessageId);
- * query.find().then(function(statuses){
- * //process statuses
- * });
- */
- AV.Status.inboxQuery = function (owner, inboxType) {
- var query = new AV.InboxQuery(AV.Status);
- if (owner) {
- query._owner = owner;
- }
- if (inboxType) {
- query._inboxType = inboxType;
- }
- return query;
- };
- };
- /***/ }),
- /* 564 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _ = __webpack_require__(3);
- var AVRequest = __webpack_require__(27)._request;
- module.exports = function (AV) {
- /**
- * A builder to generate sort string for app searching.For example:
- * @class
- * @since 0.5.1
- * @example
- * var builder = new AV.SearchSortBuilder();
- * builder.ascending('key1').descending('key2','max');
- * var query = new AV.SearchQuery('Player');
- * query.sortBy(builder);
- * query.find().then();
- */
- AV.SearchSortBuilder = function () {
- this._sortFields = [];
- };
- _.extend(AV.SearchSortBuilder.prototype,
- /** @lends AV.SearchSortBuilder.prototype */
- {
- _addField: function _addField(key, order, mode, missing) {
- var field = {};
- field[key] = {
- order: order || 'asc',
- mode: mode || 'avg',
- missing: '_' + (missing || 'last')
- };
- this._sortFields.push(field);
- return this;
- },
- /**
- * Sorts the results in ascending order by the given key and options.
- *
- * @param {String} key The key to order by.
- * @param {String} mode The sort mode, default is 'avg', you can choose
- * 'max' or 'min' too.
- * @param {String} missing The missing key behaviour, default is 'last',
- * you can choose 'first' too.
- * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
- */
- ascending: function ascending(key, mode, missing) {
- return this._addField(key, 'asc', mode, missing);
- },
- /**
- * Sorts the results in descending order by the given key and options.
- *
- * @param {String} key The key to order by.
- * @param {String} mode The sort mode, default is 'avg', you can choose
- * 'max' or 'min' too.
- * @param {String} missing The missing key behaviour, default is 'last',
- * you can choose 'first' too.
- * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
- */
- descending: function descending(key, mode, missing) {
- return this._addField(key, 'desc', mode, missing);
- },
- /**
- * Add a proximity based constraint for finding objects with key point
- * values near the point given.
- * @param {String} key The key that the AV.GeoPoint is stored in.
- * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
- * @param {Object} options The other options such as mode,order, unit etc.
- * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
- */
- whereNear: function whereNear(key, point, options) {
- options = options || {};
- var field = {};
- var geo = {
- lat: point.latitude,
- lon: point.longitude
- };
- var m = {
- order: options.order || 'asc',
- mode: options.mode || 'avg',
- unit: options.unit || 'km'
- };
- m[key] = geo;
- field['_geo_distance'] = m;
- this._sortFields.push(field);
- return this;
- },
- /**
- * Build a sort string by configuration.
- * @return {String} the sort string.
- */
- build: function build() {
- return (0, _stringify.default)(AV._encode(this._sortFields));
- }
- });
- /**
- * App searching query.Use just like AV.Query:
- *
- * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
- * for more details.
- * @class
- * @since 0.5.1
- * @example
- * var query = new AV.SearchQuery('Player');
- * query.queryString('*');
- * query.find().then(function(results) {
- * console.log('Found %d objects', query.hits());
- * //Process results
- * });
- */
- AV.SearchQuery = AV.Query._extend(
- /** @lends AV.SearchQuery.prototype */
- {
- _sid: null,
- _hits: 0,
- _queryString: null,
- _highlights: null,
- _sortBuilder: null,
- _clazz: null,
- constructor: function constructor(className) {
- if (className) {
- this._clazz = className;
- } else {
- className = '__INVALID_CLASS';
- }
- AV.Query.call(this, className);
- },
- _createRequest: function _createRequest(params, options) {
- return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
- },
- /**
- * Sets the sid of app searching query.Default is null.
- * @param {String} sid Scroll id for searching.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- sid: function sid(_sid) {
- this._sid = _sid;
- return this;
- },
- /**
- * Sets the query string of app searching.
- * @param {String} q The query string.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- queryString: function queryString(q) {
- this._queryString = q;
- return this;
- },
- /**
- * Sets the highlight fields. Such as
- * <pre><code>
- * query.highlights('title');
- * //or pass an array.
- * query.highlights(['title', 'content'])
- * </code></pre>
- * @param {String|String[]} highlights a list of fields.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- highlights: function highlights(_highlights) {
- var objects;
- if (_highlights && _.isString(_highlights)) {
- objects = _.toArray(arguments);
- } else {
- objects = _highlights;
- }
- this._highlights = objects;
- return this;
- },
- /**
- * Sets the sort builder for this query.
- * @see AV.SearchSortBuilder
- * @param { AV.SearchSortBuilder} builder The sort builder.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- *
- */
- sortBy: function sortBy(builder) {
- this._sortBuilder = builder;
- return this;
- },
- /**
- * Returns the number of objects that match this query.
- * @return {Number}
- */
- hits: function hits() {
- if (!this._hits) {
- this._hits = 0;
- }
- return this._hits;
- },
- _processResult: function _processResult(json) {
- delete json['className'];
- delete json['_app_url'];
- delete json['_deeplink'];
- return json;
- },
- /**
- * Returns true when there are more documents can be retrieved by this
- * query instance, you can call find function to get more results.
- * @see AV.SearchQuery#find
- * @return {Boolean}
- */
- hasMore: function hasMore() {
- return !this._hitEnd;
- },
- /**
- * Reset current query instance state(such as sid, hits etc) except params
- * for a new searching. After resetting, hasMore() will return true.
- */
- reset: function reset() {
- this._hitEnd = false;
- this._sid = null;
- this._hits = 0;
- },
- /**
- * Retrieves a list of AVObjects that satisfy this query.
- * Either options.success or options.error is called when the find
- * completes.
- *
- * @see AV.Query#find
- * @param {AuthOptions} options
- * @return {Promise} A promise that is resolved with the results when
- * the query completes.
- */
- find: function find(options) {
- var self = this;
- var request = this._createRequest(undefined, options);
- return request.then(function (response) {
- //update sid for next querying.
- if (response.sid) {
- self._oldSid = self._sid;
- self._sid = response.sid;
- } else {
- self._sid = null;
- self._hitEnd = true;
- }
- self._hits = response.hits || 0;
- return (0, _map.default)(_).call(_, response.results, function (json) {
- if (json.className) {
- response.className = json.className;
- }
- var obj = self._newObject(response);
- obj.appURL = json['_app_url'];
- obj._finishFetch(self._processResult(json), true);
- return obj;
- });
- });
- },
- _getParams: function _getParams() {
- var params = AV.SearchQuery.__super__._getParams.call(this);
- delete params.where;
- if (this._clazz) {
- params.clazz = this.className;
- }
- if (this._sid) {
- params.sid = this._sid;
- }
- if (!this._queryString) {
- throw new Error('Please set query string.');
- } else {
- params.q = this._queryString;
- }
- if (this._highlights) {
- params.highlights = this._highlights.join(',');
- }
- if (this._sortBuilder && params.order) {
- throw new Error('sort and order can not be set at same time.');
- }
- if (this._sortBuilder) {
- params.sort = this._sortBuilder.build();
- }
- return params;
- }
- });
- };
- /**
- * Sorts the results in ascending order by the given key.
- *
- * @method AV.SearchQuery#ascending
- * @param {String} key The key to order by.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- /**
- * Also sorts the results in ascending order by the given key. The previous sort keys have
- * precedence over this key.
- *
- * @method AV.SearchQuery#addAscending
- * @param {String} key The key to order by
- * @return {AV.SearchQuery} Returns the query so you can chain this call.
- */
- /**
- * Sorts the results in descending order by the given key.
- *
- * @method AV.SearchQuery#descending
- * @param {String} key The key to order by.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- /**
- * Also sorts the results in descending order by the given key. The previous sort keys have
- * precedence over this key.
- *
- * @method AV.SearchQuery#addDescending
- * @param {String} key The key to order by
- * @return {AV.SearchQuery} Returns the query so you can chain this call.
- */
- /**
- * Include nested AV.Objects for the provided key. You can use dot
- * notation to specify which fields in the included object are also fetch.
- * @method AV.SearchQuery#include
- * @param {String[]} keys The name of the key to include.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- /**
- * Sets the number of results to skip before returning any results.
- * This is useful for pagination.
- * Default is to skip zero results.
- * @method AV.SearchQuery#skip
- * @param {Number} n the number of results to skip.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- /**
- * Sets the limit of the number of results to return. The default limit is
- * 100, with a maximum of 1000 results being returned at a time.
- * @method AV.SearchQuery#limit
- * @param {Number} n the number of results to limit to.
- * @return {AV.SearchQuery} Returns the query, so you can chain this call.
- */
- /***/ }),
- /* 565 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3);
- var AVError = __webpack_require__(46);
- var _require = __webpack_require__(27),
- request = _require.request;
- module.exports = function (AV) {
- /**
- * 包含了使用了 LeanCloud
- * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
- * <p><strong><em>
- * 仅在云引擎运行环境下有效。
- * </em></strong></p>
- * @namespace
- */
- AV.Insight = AV.Insight || {};
- _.extend(AV.Insight,
- /** @lends AV.Insight */
- {
- /**
- * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
- * AV.Insight.JobQuery 查询任务状态和结果。
- * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
- * { "sql" : "select count(*) as c,gender from _User group by gender",
- * "saveAs": {
- * "className" : "UserGender",
- * "limit": 1
- * }
- * }
- * </pre></code>
- * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
- * @param {AuthOptions} [options]
- * @return {Promise} A promise that will be resolved with the result
- * of the function.
- */
- startJob: function startJob(jobConfig, options) {
- if (!jobConfig || !jobConfig.sql) {
- throw new Error('Please provide the sql to run the job.');
- }
- var data = {
- jobConfig: jobConfig,
- appId: AV.applicationId
- };
- return request({
- path: '/bigquery/jobs',
- method: 'POST',
- data: AV._encode(data, null, true),
- authOptions: options,
- signKey: false
- }).then(function (resp) {
- return AV._decode(resp).id;
- });
- },
- /**
- * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
- * <p><strong><em>
- * 仅在云引擎运行环境下有效。
- * </em></strong></p>
- * @param {String} event 监听的事件,目前尚不支持。
- * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
- * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
- *
- */
- on: function on(event, cb) {}
- });
- /**
- * 创建一个对象,用于查询 Insight 任务状态和结果。
- * @class
- * @param {String} id 任务 id
- * @since 0.5.5
- */
- AV.Insight.JobQuery = function (id, className) {
- if (!id) {
- throw new Error('Please provide the job id.');
- }
- this.id = id;
- this.className = className;
- this._skip = 0;
- this._limit = 100;
- };
- _.extend(AV.Insight.JobQuery.prototype,
- /** @lends AV.Insight.JobQuery.prototype */
- {
- /**
- * Sets the number of results to skip before returning any results.
- * This is useful for pagination.
- * Default is to skip zero results.
- * @param {Number} n the number of results to skip.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- skip: function skip(n) {
- this._skip = n;
- return this;
- },
- /**
- * Sets the limit of the number of results to return. The default limit is
- * 100, with a maximum of 1000 results being returned at a time.
- * @param {Number} n the number of results to limit to.
- * @return {AV.Query} Returns the query, so you can chain this call.
- */
- limit: function limit(n) {
- this._limit = n;
- return this;
- },
- /**
- * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
- * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
- * startTime、endTime 等信息。
- *
- * @param {AuthOptions} [options]
- * @return {Promise} A promise that will be resolved with the result
- * of the function.
- *
- */
- find: function find(options) {
- var params = {
- skip: this._skip,
- limit: this._limit
- };
- return request({
- path: "/bigquery/jobs/".concat(this.id),
- method: 'GET',
- query: params,
- authOptions: options,
- signKey: false
- }).then(function (response) {
- if (response.error) {
- return _promise.default.reject(new AVError(response.code, response.error));
- }
- return _promise.default.resolve(response);
- });
- }
- });
- };
- /***/ }),
- /* 566 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _ = __webpack_require__(3);
- var _require = __webpack_require__(27),
- LCRequest = _require.request;
- var _require2 = __webpack_require__(30),
- getSessionToken = _require2.getSessionToken;
- module.exports = function (AV) {
- var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
- if (authOptions.user) {
- if (!authOptions.user._sessionToken) {
- throw new Error('authOptions.user is not signed in.');
- }
- return _promise.default.resolve(authOptions.user);
- }
- if (authOptions.sessionToken) {
- return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
- }
- return AV.User.currentAsync();
- };
- var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
- var sessionToken = getSessionToken(authOptions);
- if (sessionToken) {
- return _promise.default.resolve(sessionToken);
- }
- return AV.User.currentAsync().then(function (user) {
- if (user) {
- return user.getSessionToken();
- }
- });
- };
- /**
- * Contains functions to deal with Friendship in LeanCloud.
- * @class
- */
- AV.Friendship = {
- /**
- * Request friendship.
- * @since 4.8.0
- * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
- * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
- * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<void>}
- */
- request: function request(options) {
- var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var friend;
- var attributes;
- if (options.friend) {
- friend = options.friend;
- attributes = options.attributes;
- } else {
- friend = options;
- }
- var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
- return getUserWithSessionToken(authOptions).then(function (userObj) {
- if (!userObj) {
- throw new Error('Please signin an user.');
- }
- return LCRequest({
- method: 'POST',
- path: '/users/friendshipRequests',
- data: {
- user: userObj._toPointer(),
- friend: friendObj._toPointer(),
- friendship: attributes
- },
- authOptions: authOptions
- });
- });
- },
- /**
- * Accept a friendship request.
- * @since 4.8.0
- * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
- * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
- * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<void>}
- */
- acceptRequest: function acceptRequest(options) {
- var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var request;
- var attributes;
- if (options.request) {
- request = options.request;
- attributes = options.attributes;
- } else {
- request = options;
- }
- var requestId = _.isString(request) ? request : request.id;
- return getSessionTokenAsync(authOptions).then(function (sessionToken) {
- if (!sessionToken) {
- throw new Error('Please signin an user.');
- }
- return LCRequest({
- method: 'PUT',
- path: '/users/friendshipRequests/' + requestId + '/accept',
- data: {
- friendship: AV._encode(attributes)
- },
- authOptions: authOptions
- });
- });
- },
- /**
- * Decline a friendship request.
- * @param {AV.Object | string} request The request (or it's objectId) to be declined.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<void>}
- */
- declineRequest: function declineRequest(request) {
- var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var requestId = _.isString(request) ? request : request.id;
- return getSessionTokenAsync(authOptions).then(function (sessionToken) {
- if (!sessionToken) {
- throw new Error('Please signin an user.');
- }
- return LCRequest({
- method: 'PUT',
- path: '/users/friendshipRequests/' + requestId + '/decline',
- authOptions: authOptions
- });
- });
- }
- };
- };
- /***/ }),
- /* 567 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _ = __webpack_require__(3);
- var _require = __webpack_require__(27),
- _request = _require._request;
- var AV = __webpack_require__(69);
- var serializeMessage = function serializeMessage(message) {
- if (typeof message === 'string') {
- return message;
- }
- if (typeof message.getPayload === 'function') {
- return (0, _stringify.default)(message.getPayload());
- }
- return (0, _stringify.default)(message);
- };
- /**
- * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
- * conversation. This class is a subclass of AV.Object, and retains the
- * same functionality of an AV.Object, but also extends it with various
- * conversation specific methods, like get members, creators of this conversation.
- * </p>
- *
- * @class AV.Conversation
- * @param {String} name The name of the Role to create.
- * @param {Object} [options]
- * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
- * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
- */
- module.exports = AV.Object.extend('_Conversation',
- /** @lends AV.Conversation.prototype */
- {
- constructor: function constructor(name) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- AV.Object.prototype.constructor.call(this, null, null);
- this.set('name', name);
- if (options.isSystem !== undefined) {
- this.set('sys', options.isSystem ? true : false);
- }
- if (options.isTransient !== undefined) {
- this.set('tr', options.isTransient ? true : false);
- }
- },
- /**
- * Get current conversation's creator.
- *
- * @return {String}
- */
- getCreator: function getCreator() {
- return this.get('c');
- },
- /**
- * Get the last message's time.
- *
- * @return {Date}
- */
- getLastMessageAt: function getLastMessageAt() {
- return this.get('lm');
- },
- /**
- * Get this conversation's members
- *
- * @return {String[]}
- */
- getMembers: function getMembers() {
- return this.get('m');
- },
- /**
- * Add a member to this conversation
- *
- * @param {String} member
- */
- addMember: function addMember(member) {
- return this.add('m', member);
- },
- /**
- * Get this conversation's members who set this conversation as muted.
- *
- * @return {String[]}
- */
- getMutedMembers: function getMutedMembers() {
- return this.get('mu');
- },
- /**
- * Get this conversation's name field.
- *
- * @return String
- */
- getName: function getName() {
- return this.get('name');
- },
- /**
- * Returns true if this conversation is transient conversation.
- *
- * @return {Boolean}
- */
- isTransient: function isTransient() {
- return this.get('tr');
- },
- /**
- * Returns true if this conversation is system conversation.
- *
- * @return {Boolean}
- */
- isSystem: function isSystem() {
- return this.get('sys');
- },
- /**
- * Send realtime message to this conversation, using HTTP request.
- *
- * @param {String} fromClient Sender's client id.
- * @param {String|Object} message The message which will send to conversation.
- * It could be a raw string, or an object with a `toJSON` method, like a
- * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
- * @param {Object} [options]
- * @param {Boolean} [options.transient] Whether send this message as transient message or not.
- * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
- * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
- * @param {AuthOptions} [authOptions]
- * @return {Promise}
- */
- send: function send(fromClient, message) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var data = {
- from_peer: fromClient,
- conv_id: this.id,
- transient: false,
- message: serializeMessage(message)
- };
- if (options.toClients !== undefined) {
- data.to_peers = options.toClients;
- }
- if (options.transient !== undefined) {
- data.transient = options.transient ? true : false;
- }
- if (options.pushData !== undefined) {
- data.push_data = options.pushData;
- }
- return _request('rtm', 'messages', null, 'POST', data, authOptions);
- },
- /**
- * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
- *
- * @param {String} fromClient Sender's client id.
- * @param {String|Object} message The message which will send to conversation.
- * It could be a raw string, or an object with a `toJSON` method, like a
- * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
- * @param {Object} [options]
- * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
- * @param {Object} [options.validTill] The message will valid till this time.
- * @param {AuthOptions} [authOptions]
- * @return {Promise}
- */
- broadcast: function broadcast(fromClient, message) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var data = {
- from_peer: fromClient,
- conv_id: this.id,
- message: serializeMessage(message)
- };
- if (options.pushData !== undefined) {
- data.push = options.pushData;
- }
- if (options.validTill !== undefined) {
- var ts = options.validTill;
- if (_.isDate(ts)) {
- ts = ts.getTime();
- }
- options.valid_till = ts;
- }
- return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
- }
- });
- /***/ }),
- /* 568 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _ = __webpack_require__(3);
- var _require = __webpack_require__(27),
- request = _require.request;
- var _require2 = __webpack_require__(30),
- ensureArray = _require2.ensureArray,
- parseDate = _require2.parseDate;
- var AV = __webpack_require__(69);
- /**
- * The version change interval for Leaderboard
- * @enum
- */
- AV.LeaderboardVersionChangeInterval = {
- NEVER: 'never',
- DAY: 'day',
- WEEK: 'week',
- MONTH: 'month'
- };
- /**
- * The order of the leaderboard results
- * @enum
- */
- AV.LeaderboardOrder = {
- ASCENDING: 'ascending',
- DESCENDING: 'descending'
- };
- /**
- * The update strategy for Leaderboard
- * @enum
- */
- AV.LeaderboardUpdateStrategy = {
- /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
- BETTER: 'better',
- /** Keep the last updated statistic */
- LAST: 'last',
- /** Keep the sum of all updated statistics */
- SUM: 'sum'
- };
- /**
- * @typedef {Object} Ranking
- * @property {number} rank Starts at 0
- * @property {number} value the statistic value of this ranking
- * @property {AV.User} user The user of this ranking
- * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
- */
- /**
- * @typedef {Object} LeaderboardArchive
- * @property {string} statisticName
- * @property {number} version version of the leaderboard
- * @property {string} status
- * @property {string} url URL for the downloadable archive
- * @property {Date} activatedAt time when this version became active
- * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
- */
- /**
- * @class
- */
- function Statistic(_ref) {
- var name = _ref.name,
- value = _ref.value,
- version = _ref.version;
- /**
- * @type {string}
- */
- this.name = name;
- /**
- * @type {number}
- */
- this.value = value;
- /**
- * @type {number?}
- */
- this.version = version;
- }
- var parseStatisticData = function parseStatisticData(statisticData) {
- var _AV$_decode = AV._decode(statisticData),
- name = _AV$_decode.statisticName,
- value = _AV$_decode.statisticValue,
- version = _AV$_decode.version;
- return new Statistic({
- name: name,
- value: value,
- version: version
- });
- };
- /**
- * @class
- */
- AV.Leaderboard = function Leaderboard(statisticName) {
- /**
- * @type {string}
- */
- this.statisticName = statisticName;
- /**
- * @type {AV.LeaderboardOrder}
- */
- this.order = undefined;
- /**
- * @type {AV.LeaderboardUpdateStrategy}
- */
- this.updateStrategy = undefined;
- /**
- * @type {AV.LeaderboardVersionChangeInterval}
- */
- this.versionChangeInterval = undefined;
- /**
- * @type {number}
- */
- this.version = undefined;
- /**
- * @type {Date?}
- */
- this.nextResetAt = undefined;
- /**
- * @type {Date?}
- */
- this.createdAt = undefined;
- };
- var Leaderboard = AV.Leaderboard;
- /**
- * Create an instance of Leaderboard for the give statistic name.
- * @param {string} statisticName
- * @return {AV.Leaderboard}
- */
- AV.Leaderboard.createWithoutData = function (statisticName) {
- return new Leaderboard(statisticName);
- };
- /**
- * (masterKey required) Create a new Leaderboard.
- * @param {Object} options
- * @param {string} options.statisticName
- * @param {AV.LeaderboardOrder} options.order
- * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
- * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
- * @param {AuthOptions} [authOptions]
- * @return {Promise<AV.Leaderboard>}
- */
- AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
- var statisticName = _ref2.statisticName,
- order = _ref2.order,
- versionChangeInterval = _ref2.versionChangeInterval,
- updateStrategy = _ref2.updateStrategy;
- return request({
- method: 'POST',
- path: '/leaderboard/leaderboards',
- data: {
- statisticName: statisticName,
- order: order,
- versionChangeInterval: versionChangeInterval,
- updateStrategy: updateStrategy
- },
- authOptions: authOptions
- }).then(function (data) {
- var leaderboard = new Leaderboard(statisticName);
- return leaderboard._finishFetch(data);
- });
- };
- /**
- * Get the Leaderboard with the specified statistic name.
- * @param {string} statisticName
- * @param {AuthOptions} [authOptions]
- * @return {Promise<AV.Leaderboard>}
- */
- AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
- return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
- };
- /**
- * Get Statistics for the specified user.
- * @param {AV.User} user The specified AV.User pointer.
- * @param {Object} [options]
- * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<Statistic[]>}
- */
- AV.Leaderboard.getStatistics = function (user) {
- var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- statisticNames = _ref3.statisticNames;
- var authOptions = arguments.length > 2 ? arguments[2] : undefined;
- return _promise.default.resolve().then(function () {
- if (!(user && user.id)) throw new Error('user must be an AV.User');
- return request({
- method: 'GET',
- path: "/leaderboard/users/".concat(user.id, "/statistics"),
- query: {
- statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
- },
- authOptions: authOptions
- }).then(function (_ref4) {
- var results = _ref4.results;
- return (0, _map.default)(results).call(results, parseStatisticData);
- });
- });
- };
- /**
- * Update Statistics for the specified user.
- * @param {AV.User} user The specified AV.User pointer.
- * @param {Object} statistics A name-value pair representing the statistics to update.
- * @param {AuthOptions} [options] AuthOptions plus:
- * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
- * @return {Promise<Statistic[]>}
- */
- AV.Leaderboard.updateStatistics = function (user, statistics) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- return _promise.default.resolve().then(function () {
- if (!(user && user.id)) throw new Error('user must be an AV.User');
- var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
- return {
- statisticName: key,
- statisticValue: value
- };
- });
- var overwrite = options.overwrite;
- return request({
- method: 'POST',
- path: "/leaderboard/users/".concat(user.id, "/statistics"),
- query: {
- overwrite: overwrite ? 1 : undefined
- },
- data: data,
- authOptions: options
- }).then(function (_ref5) {
- var results = _ref5.results;
- return (0, _map.default)(results).call(results, parseStatisticData);
- });
- });
- };
- /**
- * Delete Statistics for the specified user.
- * @param {AV.User} user The specified AV.User pointer.
- * @param {Object} statistics A name-value pair representing the statistics to delete.
- * @param {AuthOptions} [options]
- * @return {Promise<void>}
- */
- AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
- return _promise.default.resolve().then(function () {
- if (!(user && user.id)) throw new Error('user must be an AV.User');
- return request({
- method: 'DELETE',
- path: "/leaderboard/users/".concat(user.id, "/statistics"),
- query: {
- statistics: ensureArray(statisticNames).join(',')
- },
- authOptions: authOptions
- }).then(function () {
- return undefined;
- });
- });
- };
- _.extend(Leaderboard.prototype,
- /** @lends AV.Leaderboard.prototype */
- {
- _finishFetch: function _finishFetch(data) {
- var _this = this;
- _.forEach(data, function (value, key) {
- if (key === 'updatedAt' || key === 'objectId') return;
- if (key === 'expiredAt') {
- key = 'nextResetAt';
- }
- if (key === 'createdAt') {
- value = parseDate(value);
- }
- if (value && value.__type === 'Date') {
- value = parseDate(value.iso);
- }
- _this[key] = value;
- });
- return this;
- },
- /**
- * Fetch data from the srever.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<AV.Leaderboard>}
- */
- fetch: function fetch(authOptions) {
- var _this2 = this;
- return request({
- method: 'GET',
- path: "/leaderboard/leaderboards/".concat(this.statisticName),
- authOptions: authOptions
- }).then(function (data) {
- return _this2._finishFetch(data);
- });
- },
- /**
- * Counts the number of users participated in this leaderboard
- * @param {Object} [options]
- * @param {number} [options.version] Specify the version of the leaderboard
- * @param {AuthOptions} [authOptions]
- * @return {Promise<number>}
- */
- count: function count() {
- var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- version = _ref6.version;
- var authOptions = arguments.length > 1 ? arguments[1] : undefined;
- return request({
- method: 'GET',
- path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
- query: {
- count: 1,
- limit: 0,
- version: version
- },
- authOptions: authOptions
- }).then(function (_ref7) {
- var count = _ref7.count;
- return count;
- });
- },
- _getResults: function _getResults(_ref8, authOptions, userId) {
- var _context;
- var skip = _ref8.skip,
- limit = _ref8.limit,
- selectUserKeys = _ref8.selectUserKeys,
- includeUserKeys = _ref8.includeUserKeys,
- includeStatistics = _ref8.includeStatistics,
- version = _ref8.version;
- return request({
- method: 'GET',
- path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
- query: {
- skip: skip,
- limit: limit,
- selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
- includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
- includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
- version: version
- },
- authOptions: authOptions
- }).then(function (_ref9) {
- var rankings = _ref9.results;
- return (0, _map.default)(rankings).call(rankings, function (rankingData) {
- var _AV$_decode2 = AV._decode(rankingData),
- user = _AV$_decode2.user,
- value = _AV$_decode2.statisticValue,
- rank = _AV$_decode2.rank,
- _AV$_decode2$statisti = _AV$_decode2.statistics,
- statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
- return {
- user: user,
- value: value,
- rank: rank,
- includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
- };
- });
- });
- },
- /**
- * Retrieve a list of ranked users for this Leaderboard.
- * @param {Object} [options]
- * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
- * @param {number} [options.limit] The limit of the number of results.
- * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
- * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
- * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
- * @param {number} [options.version] Specify the version of the leaderboard
- * @param {AuthOptions} [authOptions]
- * @return {Promise<Ranking[]>}
- */
- getResults: function getResults() {
- var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- skip = _ref10.skip,
- limit = _ref10.limit,
- selectUserKeys = _ref10.selectUserKeys,
- includeUserKeys = _ref10.includeUserKeys,
- includeStatistics = _ref10.includeStatistics,
- version = _ref10.version;
- var authOptions = arguments.length > 1 ? arguments[1] : undefined;
- return this._getResults({
- skip: skip,
- limit: limit,
- selectUserKeys: selectUserKeys,
- includeUserKeys: includeUserKeys,
- includeStatistics: includeStatistics,
- version: version
- }, authOptions);
- },
- /**
- * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
- * @param {AV.User} user The specified AV.User pointer.
- * @param {Object} [options]
- * @param {number} [options.limit] The limit of the number of results.
- * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
- * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
- * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
- * @param {number} [options.version] Specify the version of the leaderboard
- * @param {AuthOptions} [authOptions]
- * @return {Promise<Ranking[]>}
- */
- getResultsAroundUser: function getResultsAroundUser(user) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var authOptions = arguments.length > 2 ? arguments[2] : undefined;
- // getResultsAroundUser(options, authOptions)
- if (user && typeof user.id !== 'string') {
- return this.getResultsAroundUser(undefined, user, options);
- }
- var limit = options.limit,
- selectUserKeys = options.selectUserKeys,
- includeUserKeys = options.includeUserKeys,
- includeStatistics = options.includeStatistics,
- version = options.version;
- return this._getResults({
- limit: limit,
- selectUserKeys: selectUserKeys,
- includeUserKeys: includeUserKeys,
- includeStatistics: includeStatistics,
- version: version
- }, authOptions, user ? user.id : 'self');
- },
- _update: function _update(data, authOptions) {
- var _this3 = this;
- return request({
- method: 'PUT',
- path: "/leaderboard/leaderboards/".concat(this.statisticName),
- data: data,
- authOptions: authOptions
- }).then(function (result) {
- return _this3._finishFetch(result);
- });
- },
- /**
- * (masterKey required) Update the version change interval of the Leaderboard.
- * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
- * @param {AuthOptions} [authOptions]
- * @return {Promise<AV.Leaderboard>}
- */
- updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
- return this._update({
- versionChangeInterval: versionChangeInterval
- }, authOptions);
- },
- /**
- * (masterKey required) Update the version change interval of the Leaderboard.
- * @param {AV.LeaderboardUpdateStrategy} updateStrategy
- * @param {AuthOptions} [authOptions]
- * @return {Promise<AV.Leaderboard>}
- */
- updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
- return this._update({
- updateStrategy: updateStrategy
- }, authOptions);
- },
- /**
- * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<AV.Leaderboard>}
- */
- reset: function reset(authOptions) {
- var _this4 = this;
- return request({
- method: 'PUT',
- path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
- authOptions: authOptions
- }).then(function (data) {
- return _this4._finishFetch(data);
- });
- },
- /**
- * (masterKey required) Delete the Leaderboard and its all archived versions.
- * @param {AuthOptions} [authOptions]
- * @return {void}
- */
- destroy: function destroy(authOptions) {
- return AV.request({
- method: 'DELETE',
- path: "/leaderboard/leaderboards/".concat(this.statisticName),
- authOptions: authOptions
- }).then(function () {
- return undefined;
- });
- },
- /**
- * (masterKey required) Get archived versions.
- * @param {Object} [options]
- * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
- * @param {number} [options.limit] The limit of the number of results.
- * @param {AuthOptions} [authOptions]
- * @return {Promise<LeaderboardArchive[]>}
- */
- getArchives: function getArchives() {
- var _this5 = this;
- var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- skip = _ref11.skip,
- limit = _ref11.limit;
- var authOptions = arguments.length > 1 ? arguments[1] : undefined;
- return request({
- method: 'GET',
- path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
- query: {
- skip: skip,
- limit: limit
- },
- authOptions: authOptions
- }).then(function (_ref12) {
- var results = _ref12.results;
- return (0, _map.default)(results).call(results, function (_ref13) {
- var version = _ref13.version,
- status = _ref13.status,
- url = _ref13.url,
- activatedAt = _ref13.activatedAt,
- deactivatedAt = _ref13.deactivatedAt;
- return {
- statisticName: _this5.statisticName,
- version: version,
- status: status,
- url: url,
- activatedAt: parseDate(activatedAt.iso),
- deactivatedAt: parseDate(deactivatedAt.iso)
- };
- });
- });
- }
- });
- /***/ }),
- /* 569 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _typeof2 = _interopRequireDefault(__webpack_require__(73));
- var _defineProperty = _interopRequireDefault(__webpack_require__(92));
- var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238));
- var _assign2 = _interopRequireDefault(__webpack_require__(152));
- var _indexOf = _interopRequireDefault(__webpack_require__(71));
- var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _symbol = _interopRequireDefault(__webpack_require__(149));
- var _iterator = _interopRequireDefault(__webpack_require__(576));
- var _weakMap = _interopRequireDefault(__webpack_require__(260));
- var _keys = _interopRequireDefault(__webpack_require__(115));
- var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
- var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
- var _map = _interopRequireDefault(__webpack_require__(583));
- (0, _defineProperty.default)(exports, '__esModule', {
- value: true
- });
- /******************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var _extendStatics$ = function extendStatics$1(d, b) {
- _extendStatics$ = _setPrototypeOf.default || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
- }
- };
- return _extendStatics$(d, b);
- };
- function __extends$1(d, b) {
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- _extendStatics$(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var _assign = function __assign() {
- _assign = _assign2.default || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) {
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- }
- return t;
- };
- return _assign.apply(this, arguments);
- };
- function __rest(s, e) {
- var t = {};
- for (var p in s) {
- if (Object.prototype.hasOwnProperty.call(s, p) && (0, _indexOf.default)(e).call(e, p) < 0) t[p] = s[p];
- }
- if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) {
- if ((0, _indexOf.default)(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
- }
- return t;
- }
- function __awaiter(thisArg, _arguments, P, generator) {
- function adopt(value) {
- return value instanceof P ? value : new P(function (resolve) {
- resolve(value);
- });
- }
- return new (P || (P = _promise.default))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- }
- function __generator(thisArg, body) {
- var _ = {
- label: 0,
- sent: function sent() {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: []
- },
- f,
- y,
- t,
- g;
- return g = {
- next: verb(0),
- "throw": verb(1),
- "return": verb(2)
- }, typeof _symbol.default === "function" && (g[_iterator.default] = function () {
- return this;
- }), g;
- function verb(n) {
- return function (v) {
- return step([n, v]);
- };
- }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_) {
- try {
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
- if (y = 0, t) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
- case 4:
- _.label++;
- return {
- value: op[1],
- done: false
- };
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
- case 7:
- op = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
- _ = 0;
- continue;
- }
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
- _.label = op[1];
- break;
- }
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op);
- break;
- }
- if (t[2]) _.ops.pop();
- _.trys.pop();
- continue;
- }
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- }
- if (op[0] & 5) throw op[1];
- return {
- value: op[0] ? op[1] : void 0,
- done: true
- };
- }
- }
- var PROVIDER = "lc_weapp";
- var PLATFORM = "weixin";
- function getLoginCode() {
- return new _promise.default(function (resolve, reject) {
- wx.login({
- success: function success(res) {
- return res.code ? resolve(res.code) : reject(new Error(res.errMsg));
- },
- fail: function fail(_a) {
- var errMsg = _a.errMsg;
- return reject(new Error(errMsg));
- }
- });
- });
- }
- var getAuthInfo = function getAuthInfo(_a) {
- var _b = _a === void 0 ? {} : _a,
- _c = _b.platform,
- platform = _c === void 0 ? PLATFORM : _c,
- _d = _b.preferUnionId,
- preferUnionId = _d === void 0 ? false : _d,
- _e = _b.asMainAccount,
- asMainAccount = _e === void 0 ? false : _e;
- return __awaiter(this, void 0, void 0, function () {
- var code, authData;
- return __generator(this, function (_f) {
- switch (_f.label) {
- case 0:
- return [4
- /*yield*/
- , getLoginCode()];
- case 1:
- code = _f.sent();
- authData = {
- code: code
- };
- if (preferUnionId) {
- authData.platform = platform;
- authData.main_account = asMainAccount;
- }
- return [2
- /*return*/
- , {
- authData: authData,
- platform: platform,
- provider: PROVIDER
- }];
- }
- });
- });
- };
- var storage = {
- getItem: function getItem(key) {
- return wx.getStorageSync(key);
- },
- setItem: function setItem(key, value) {
- return wx.setStorageSync(key, value);
- },
- removeItem: function removeItem(key) {
- return wx.removeStorageSync(key);
- },
- clear: function clear() {
- return wx.clearStorageSync();
- }
- };
- /******************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = _setPrototypeOf.default || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- function __extends(d, b) {
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var AbortError =
- /** @class */
- function (_super) {
- __extends(AbortError, _super);
- function AbortError() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.name = "AbortError";
- return _this;
- }
- return AbortError;
- }(Error);
- var request = function request(url, options) {
- if (options === void 0) {
- options = {};
- }
- var method = options.method,
- data = options.data,
- headers = options.headers,
- signal = options.signal;
- if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
- return _promise.default.reject(new AbortError("Request aborted"));
- }
- return new _promise.default(function (resolve, reject) {
- var task = wx.request({
- url: url,
- method: method,
- data: data,
- header: headers,
- complete: function complete(res) {
- signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
- if (!res.statusCode) {
- reject(new Error(res.errMsg));
- return;
- }
- resolve({
- ok: !(res.statusCode >= 400),
- status: res.statusCode,
- headers: res.header,
- data: res.data
- });
- }
- });
- var abortListener = function abortListener() {
- reject(new AbortError("Request aborted"));
- task.abort();
- };
- signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
- });
- };
- var upload = function upload(url, file, options) {
- if (options === void 0) {
- options = {};
- }
- var headers = options.headers,
- data = options.data,
- onprogress = options.onprogress,
- signal = options.signal;
- if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
- return _promise.default.reject(new AbortError("Request aborted"));
- }
- if (!(file && file.data && file.data.uri)) {
- return _promise.default.reject(new TypeError("File data must be an object like { uri: localPath }."));
- }
- return new _promise.default(function (resolve, reject) {
- var task = wx.uploadFile({
- url: url,
- header: headers,
- filePath: file.data.uri,
- name: file.field,
- formData: data,
- success: function success(response) {
- var status = response.statusCode,
- data = response.data,
- rest = __rest(response, ["statusCode", "data"]);
- resolve(_assign(_assign({}, rest), {
- data: typeof data === "string" ? JSON.parse(data) : data,
- status: status,
- ok: !(status >= 400)
- }));
- },
- fail: function fail(response) {
- reject(new Error(response.errMsg));
- },
- complete: function complete() {
- signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
- }
- });
- var abortListener = function abortListener() {
- reject(new AbortError("Request aborted"));
- task.abort();
- };
- signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
- if (onprogress) {
- task.onProgressUpdate(function (event) {
- return onprogress({
- loaded: event.totalBytesSent,
- total: event.totalBytesExpectedToSend,
- percent: event.progress
- });
- });
- }
- });
- };
- /**
- * @author Toru Nagashima <https://github.com/mysticatea>
- * @copyright 2015 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
- /**
- * @typedef {object} PrivateData
- * @property {EventTarget} eventTarget The event target.
- * @property {{type:string}} event The original event object.
- * @property {number} eventPhase The current event phase.
- * @property {EventTarget|null} currentTarget The current event target.
- * @property {boolean} canceled The flag to prevent default.
- * @property {boolean} stopped The flag to stop propagation.
- * @property {boolean} immediateStopped The flag to stop propagation immediately.
- * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
- * @property {number} timeStamp The unix time.
- * @private
- */
- /**
- * Private data for event wrappers.
- * @type {WeakMap<Event, PrivateData>}
- * @private
- */
- var privateData = new _weakMap.default();
- /**
- * Cache for wrapper classes.
- * @type {WeakMap<Object, Function>}
- * @private
- */
- var wrappers = new _weakMap.default();
- /**
- * Get private data.
- * @param {Event} event The event object to get private data.
- * @returns {PrivateData} The private data of the event.
- * @private
- */
- function pd(event) {
- var retv = privateData.get(event);
- console.assert(retv != null, "'this' is expected an Event object, but got", event);
- return retv;
- }
- /**
- * https://dom.spec.whatwg.org/#set-the-canceled-flag
- * @param data {PrivateData} private data.
- */
- function setCancelFlag(data) {
- if (data.passiveListener != null) {
- if (typeof console !== "undefined" && typeof console.error === "function") {
- console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
- }
- return;
- }
- if (!data.event.cancelable) {
- return;
- }
- data.canceled = true;
- if (typeof data.event.preventDefault === "function") {
- data.event.preventDefault();
- }
- }
- /**
- * @see https://dom.spec.whatwg.org/#interface-event
- * @private
- */
- /**
- * The event wrapper.
- * @constructor
- * @param {EventTarget} eventTarget The event target of this dispatching.
- * @param {Event|{type:string}} event The original event to wrap.
- */
- function Event(eventTarget, event) {
- privateData.set(this, {
- eventTarget: eventTarget,
- event: event,
- eventPhase: 2,
- currentTarget: eventTarget,
- canceled: false,
- stopped: false,
- immediateStopped: false,
- passiveListener: null,
- timeStamp: event.timeStamp || Date.now()
- }); // https://heycam.github.io/webidl/#Unforgeable
- (0, _defineProperty.default)(this, "isTrusted", {
- value: false,
- enumerable: true
- }); // Define accessors
- var keys = (0, _keys.default)(event);
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- if (!(key in this)) {
- (0, _defineProperty.default)(this, key, defineRedirectDescriptor(key));
- }
- }
- } // Should be enumerable, but class methods are not enumerable.
- Event.prototype = {
- /**
- * The type of this event.
- * @type {string}
- */
- get type() {
- return pd(this).event.type;
- },
- /**
- * The target of this event.
- * @type {EventTarget}
- */
- get target() {
- return pd(this).eventTarget;
- },
- /**
- * The target of this event.
- * @type {EventTarget}
- */
- get currentTarget() {
- return pd(this).currentTarget;
- },
- /**
- * @returns {EventTarget[]} The composed path of this event.
- */
- composedPath: function composedPath() {
- var currentTarget = pd(this).currentTarget;
- if (currentTarget == null) {
- return [];
- }
- return [currentTarget];
- },
- /**
- * Constant of NONE.
- * @type {number}
- */
- get NONE() {
- return 0;
- },
- /**
- * Constant of CAPTURING_PHASE.
- * @type {number}
- */
- get CAPTURING_PHASE() {
- return 1;
- },
- /**
- * Constant of AT_TARGET.
- * @type {number}
- */
- get AT_TARGET() {
- return 2;
- },
- /**
- * Constant of BUBBLING_PHASE.
- * @type {number}
- */
- get BUBBLING_PHASE() {
- return 3;
- },
- /**
- * The target of this event.
- * @type {number}
- */
- get eventPhase() {
- return pd(this).eventPhase;
- },
- /**
- * Stop event bubbling.
- * @returns {void}
- */
- stopPropagation: function stopPropagation() {
- var data = pd(this);
- data.stopped = true;
- if (typeof data.event.stopPropagation === "function") {
- data.event.stopPropagation();
- }
- },
- /**
- * Stop event bubbling.
- * @returns {void}
- */
- stopImmediatePropagation: function stopImmediatePropagation() {
- var data = pd(this);
- data.stopped = true;
- data.immediateStopped = true;
- if (typeof data.event.stopImmediatePropagation === "function") {
- data.event.stopImmediatePropagation();
- }
- },
- /**
- * The flag to be bubbling.
- * @type {boolean}
- */
- get bubbles() {
- return Boolean(pd(this).event.bubbles);
- },
- /**
- * The flag to be cancelable.
- * @type {boolean}
- */
- get cancelable() {
- return Boolean(pd(this).event.cancelable);
- },
- /**
- * Cancel this event.
- * @returns {void}
- */
- preventDefault: function preventDefault() {
- setCancelFlag(pd(this));
- },
- /**
- * The flag to indicate cancellation state.
- * @type {boolean}
- */
- get defaultPrevented() {
- return pd(this).canceled;
- },
- /**
- * The flag to be composed.
- * @type {boolean}
- */
- get composed() {
- return Boolean(pd(this).event.composed);
- },
- /**
- * The unix time of this event.
- * @type {number}
- */
- get timeStamp() {
- return pd(this).timeStamp;
- },
- /**
- * The target of this event.
- * @type {EventTarget}
- * @deprecated
- */
- get srcElement() {
- return pd(this).eventTarget;
- },
- /**
- * The flag to stop event bubbling.
- * @type {boolean}
- * @deprecated
- */
- get cancelBubble() {
- return pd(this).stopped;
- },
- set cancelBubble(value) {
- if (!value) {
- return;
- }
- var data = pd(this);
- data.stopped = true;
- if (typeof data.event.cancelBubble === "boolean") {
- data.event.cancelBubble = true;
- }
- },
- /**
- * The flag to indicate cancellation state.
- * @type {boolean}
- * @deprecated
- */
- get returnValue() {
- return !pd(this).canceled;
- },
- set returnValue(value) {
- if (!value) {
- setCancelFlag(pd(this));
- }
- },
- /**
- * Initialize this event object. But do nothing under event dispatching.
- * @param {string} type The event type.
- * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
- * @param {boolean} [cancelable=false] The flag to be possible to cancel.
- * @deprecated
- */
- initEvent: function initEvent() {// Do nothing.
- }
- }; // `constructor` is not enumerable.
- (0, _defineProperty.default)(Event.prototype, "constructor", {
- value: Event,
- configurable: true,
- writable: true
- }); // Ensure `event instanceof window.Event` is `true`.
- if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
- (0, _setPrototypeOf.default)(Event.prototype, window.Event.prototype); // Make association for wrappers.
- wrappers.set(window.Event.prototype, Event);
- }
- /**
- * Get the property descriptor to redirect a given property.
- * @param {string} key Property name to define property descriptor.
- * @returns {PropertyDescriptor} The property descriptor to redirect the property.
- * @private
- */
- function defineRedirectDescriptor(key) {
- return {
- get: function get() {
- return pd(this).event[key];
- },
- set: function set(value) {
- pd(this).event[key] = value;
- },
- configurable: true,
- enumerable: true
- };
- }
- /**
- * Get the property descriptor to call a given method property.
- * @param {string} key Property name to define property descriptor.
- * @returns {PropertyDescriptor} The property descriptor to call the method property.
- * @private
- */
- function defineCallDescriptor(key) {
- return {
- value: function value() {
- var event = pd(this).event;
- return event[key].apply(event, arguments);
- },
- configurable: true,
- enumerable: true
- };
- }
- /**
- * Define new wrapper class.
- * @param {Function} BaseEvent The base wrapper class.
- * @param {Object} proto The prototype of the original event.
- * @returns {Function} The defined wrapper class.
- * @private
- */
- function defineWrapper(BaseEvent, proto) {
- var keys = (0, _keys.default)(proto);
- if (keys.length === 0) {
- return BaseEvent;
- }
- /** CustomEvent */
- function CustomEvent(eventTarget, event) {
- BaseEvent.call(this, eventTarget, event);
- }
- CustomEvent.prototype = Object.create(BaseEvent.prototype, {
- constructor: {
- value: CustomEvent,
- configurable: true,
- writable: true
- }
- }); // Define accessors.
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- if (!(key in BaseEvent.prototype)) {
- var descriptor = (0, _getOwnPropertyDescriptor.default)(proto, key);
- var isFunc = typeof descriptor.value === "function";
- (0, _defineProperty.default)(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
- }
- }
- return CustomEvent;
- }
- /**
- * Get the wrapper class of a given prototype.
- * @param {Object} proto The prototype of the original event to get its wrapper.
- * @returns {Function} The wrapper class.
- * @private
- */
- function getWrapper(proto) {
- if (proto == null || proto === Object.prototype) {
- return Event;
- }
- var wrapper = wrappers.get(proto);
- if (wrapper == null) {
- wrapper = defineWrapper(getWrapper((0, _getPrototypeOf.default)(proto)), proto);
- wrappers.set(proto, wrapper);
- }
- return wrapper;
- }
- /**
- * Wrap a given event to management a dispatching.
- * @param {EventTarget} eventTarget The event target of this dispatching.
- * @param {Object} event The event to wrap.
- * @returns {Event} The wrapper instance.
- * @private
- */
- function wrapEvent(eventTarget, event) {
- var Wrapper = getWrapper((0, _getPrototypeOf.default)(event));
- return new Wrapper(eventTarget, event);
- }
- /**
- * Get the immediateStopped flag of a given event.
- * @param {Event} event The event to get.
- * @returns {boolean} The flag to stop propagation immediately.
- * @private
- */
- function isStopped(event) {
- return pd(event).immediateStopped;
- }
- /**
- * Set the current event phase of a given event.
- * @param {Event} event The event to set current target.
- * @param {number} eventPhase New event phase.
- * @returns {void}
- * @private
- */
- function setEventPhase(event, eventPhase) {
- pd(event).eventPhase = eventPhase;
- }
- /**
- * Set the current target of a given event.
- * @param {Event} event The event to set current target.
- * @param {EventTarget|null} currentTarget New current target.
- * @returns {void}
- * @private
- */
- function setCurrentTarget(event, currentTarget) {
- pd(event).currentTarget = currentTarget;
- }
- /**
- * Set a passive listener of a given event.
- * @param {Event} event The event to set current target.
- * @param {Function|null} passiveListener New passive listener.
- * @returns {void}
- * @private
- */
- function setPassiveListener(event, passiveListener) {
- pd(event).passiveListener = passiveListener;
- }
- /**
- * @typedef {object} ListenerNode
- * @property {Function} listener
- * @property {1|2|3} listenerType
- * @property {boolean} passive
- * @property {boolean} once
- * @property {ListenerNode|null} next
- * @private
- */
- /**
- * @type {WeakMap<object, Map<string, ListenerNode>>}
- * @private
- */
- var listenersMap = new _weakMap.default(); // Listener types
- var CAPTURE = 1;
- var BUBBLE = 2;
- var ATTRIBUTE = 3;
- /**
- * Check whether a given value is an object or not.
- * @param {any} x The value to check.
- * @returns {boolean} `true` if the value is an object.
- */
- function isObject(x) {
- return x !== null && (0, _typeof2.default)(x) === "object"; //eslint-disable-line no-restricted-syntax
- }
- /**
- * Get listeners.
- * @param {EventTarget} eventTarget The event target to get.
- * @returns {Map<string, ListenerNode>} The listeners.
- * @private
- */
- function getListeners(eventTarget) {
- var listeners = listenersMap.get(eventTarget);
- if (listeners == null) {
- throw new TypeError("'this' is expected an EventTarget object, but got another value.");
- }
- return listeners;
- }
- /**
- * Get the property descriptor for the event attribute of a given event.
- * @param {string} eventName The event name to get property descriptor.
- * @returns {PropertyDescriptor} The property descriptor.
- * @private
- */
- function defineEventAttributeDescriptor(eventName) {
- return {
- get: function get() {
- var listeners = getListeners(this);
- var node = listeners.get(eventName);
- while (node != null) {
- if (node.listenerType === ATTRIBUTE) {
- return node.listener;
- }
- node = node.next;
- }
- return null;
- },
- set: function set(listener) {
- if (typeof listener !== "function" && !isObject(listener)) {
- listener = null; // eslint-disable-line no-param-reassign
- }
- var listeners = getListeners(this); // Traverse to the tail while removing old value.
- var prev = null;
- var node = listeners.get(eventName);
- while (node != null) {
- if (node.listenerType === ATTRIBUTE) {
- // Remove old value.
- if (prev !== null) {
- prev.next = node.next;
- } else if (node.next !== null) {
- listeners.set(eventName, node.next);
- } else {
- listeners.delete(eventName);
- }
- } else {
- prev = node;
- }
- node = node.next;
- } // Add new value.
- if (listener !== null) {
- var newNode = {
- listener: listener,
- listenerType: ATTRIBUTE,
- passive: false,
- once: false,
- next: null
- };
- if (prev === null) {
- listeners.set(eventName, newNode);
- } else {
- prev.next = newNode;
- }
- }
- },
- configurable: true,
- enumerable: true
- };
- }
- /**
- * Define an event attribute (e.g. `eventTarget.onclick`).
- * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
- * @param {string} eventName The event name to define.
- * @returns {void}
- */
- function defineEventAttribute(eventTargetPrototype, eventName) {
- (0, _defineProperty.default)(eventTargetPrototype, "on".concat(eventName), defineEventAttributeDescriptor(eventName));
- }
- /**
- * Define a custom EventTarget with event attributes.
- * @param {string[]} eventNames Event names for event attributes.
- * @returns {EventTarget} The custom EventTarget.
- * @private
- */
- function defineCustomEventTarget(eventNames) {
- /** CustomEventTarget */
- function CustomEventTarget() {
- EventTarget.call(this);
- }
- CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
- constructor: {
- value: CustomEventTarget,
- configurable: true,
- writable: true
- }
- });
- for (var i = 0; i < eventNames.length; ++i) {
- defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
- }
- return CustomEventTarget;
- }
- /**
- * EventTarget.
- *
- * - This is constructor if no arguments.
- * - This is a function which returns a CustomEventTarget constructor if there are arguments.
- *
- * For example:
- *
- * class A extends EventTarget {}
- * class B extends EventTarget("message") {}
- * class C extends EventTarget("message", "error") {}
- * class D extends EventTarget(["message", "error"]) {}
- */
- function EventTarget() {
- /*eslint-disable consistent-return */
- if (this instanceof EventTarget) {
- listenersMap.set(this, new _map.default());
- return;
- }
- if (arguments.length === 1 && Array.isArray(arguments[0])) {
- return defineCustomEventTarget(arguments[0]);
- }
- if (arguments.length > 0) {
- var types = new Array(arguments.length);
- for (var i = 0; i < arguments.length; ++i) {
- types[i] = arguments[i];
- }
- return defineCustomEventTarget(types);
- }
- throw new TypeError("Cannot call a class as a function");
- /*eslint-enable consistent-return */
- } // Should be enumerable, but class methods are not enumerable.
- EventTarget.prototype = {
- /**
- * Add a given listener to this event target.
- * @param {string} eventName The event name to add.
- * @param {Function} listener The listener to add.
- * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
- * @returns {void}
- */
- addEventListener: function addEventListener(eventName, listener, options) {
- if (listener == null) {
- return;
- }
- if (typeof listener !== "function" && !isObject(listener)) {
- throw new TypeError("'listener' should be a function or an object.");
- }
- var listeners = getListeners(this);
- var optionsIsObj = isObject(options);
- var capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
- var listenerType = capture ? CAPTURE : BUBBLE;
- var newNode = {
- listener: listener,
- listenerType: listenerType,
- passive: optionsIsObj && Boolean(options.passive),
- once: optionsIsObj && Boolean(options.once),
- next: null
- }; // Set it as the first node if the first node is null.
- var node = listeners.get(eventName);
- if (node === undefined) {
- listeners.set(eventName, newNode);
- return;
- } // Traverse to the tail while checking duplication..
- var prev = null;
- while (node != null) {
- if (node.listener === listener && node.listenerType === listenerType) {
- // Should ignore duplication.
- return;
- }
- prev = node;
- node = node.next;
- } // Add it.
- prev.next = newNode;
- },
- /**
- * Remove a given listener from this event target.
- * @param {string} eventName The event name to remove.
- * @param {Function} listener The listener to remove.
- * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
- * @returns {void}
- */
- removeEventListener: function removeEventListener(eventName, listener, options) {
- if (listener == null) {
- return;
- }
- var listeners = getListeners(this);
- var capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
- var listenerType = capture ? CAPTURE : BUBBLE;
- var prev = null;
- var node = listeners.get(eventName);
- while (node != null) {
- if (node.listener === listener && node.listenerType === listenerType) {
- if (prev !== null) {
- prev.next = node.next;
- } else if (node.next !== null) {
- listeners.set(eventName, node.next);
- } else {
- listeners.delete(eventName);
- }
- return;
- }
- prev = node;
- node = node.next;
- }
- },
- /**
- * Dispatch a given event.
- * @param {Event|{type:string}} event The event to dispatch.
- * @returns {boolean} `false` if canceled.
- */
- dispatchEvent: function dispatchEvent(event) {
- if (event == null || typeof event.type !== "string") {
- throw new TypeError('"event.type" should be a string.');
- } // If listeners aren't registered, terminate.
- var listeners = getListeners(this);
- var eventName = event.type;
- var node = listeners.get(eventName);
- if (node == null) {
- return true;
- } // Since we cannot rewrite several properties, so wrap object.
- var wrappedEvent = wrapEvent(this, event); // This doesn't process capturing phase and bubbling phase.
- // This isn't participating in a tree.
- var prev = null;
- while (node != null) {
- // Remove this listener if it's once
- if (node.once) {
- if (prev !== null) {
- prev.next = node.next;
- } else if (node.next !== null) {
- listeners.set(eventName, node.next);
- } else {
- listeners.delete(eventName);
- }
- } else {
- prev = node;
- } // Call this listener
- setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
- if (typeof node.listener === "function") {
- try {
- node.listener.call(this, wrappedEvent);
- } catch (err) {
- if (typeof console !== "undefined" && typeof console.error === "function") {
- console.error(err);
- }
- }
- } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
- node.listener.handleEvent(wrappedEvent);
- } // Break if `event.stopImmediatePropagation` was called.
- if (isStopped(wrappedEvent)) {
- break;
- }
- node = node.next;
- }
- setPassiveListener(wrappedEvent, null);
- setEventPhase(wrappedEvent, 0);
- setCurrentTarget(wrappedEvent, null);
- return !wrappedEvent.defaultPrevented;
- }
- }; // `constructor` is not enumerable.
- (0, _defineProperty.default)(EventTarget.prototype, "constructor", {
- value: EventTarget,
- configurable: true,
- writable: true
- }); // Ensure `eventTarget instanceof window.EventTarget` is `true`.
- if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
- (0, _setPrototypeOf.default)(EventTarget.prototype, window.EventTarget.prototype);
- }
- var WS =
- /** @class */
- function (_super) {
- __extends$1(WS, _super);
- function WS(url, protocol) {
- var _this = _super.call(this) || this;
- _this._readyState = WS.CLOSED;
- if (!url) {
- throw new TypeError("Failed to construct 'WebSocket': url required");
- }
- _this._url = url;
- _this._protocol = protocol;
- return _this;
- }
- (0, _defineProperty.default)(WS.prototype, "url", {
- get: function get() {
- return this._url;
- },
- enumerable: false,
- configurable: true
- });
- (0, _defineProperty.default)(WS.prototype, "protocol", {
- get: function get() {
- return this._protocol;
- },
- enumerable: false,
- configurable: true
- });
- (0, _defineProperty.default)(WS.prototype, "readyState", {
- get: function get() {
- return this._readyState;
- },
- enumerable: false,
- configurable: true
- });
- WS.CONNECTING = 0;
- WS.OPEN = 1;
- WS.CLOSING = 2;
- WS.CLOSED = 3;
- return WS;
- }(EventTarget("open", "error", "message", "close"));
- var WechatWS =
- /** @class */
- function (_super) {
- __extends$1(WechatWS, _super);
- function WechatWS(url, protocol) {
- var _this = _super.call(this, url, protocol) || this;
- if (protocol && !(wx.canIUse && wx.canIUse("connectSocket.object.protocols"))) {
- throw new Error("subprotocol not supported in weapp");
- }
- _this._readyState = WS.CONNECTING;
- var errorHandler = function errorHandler(event) {
- _this._readyState = WS.CLOSED;
- _this.dispatchEvent({
- type: "error",
- message: event.errMsg
- });
- };
- var socketTask = wx.connectSocket({
- url: url,
- protocols: _this._protocol === undefined || Array.isArray(_this._protocol) ? _this._protocol : [_this._protocol],
- fail: function fail(error) {
- return setTimeout(function () {
- return errorHandler(error);
- }, 0);
- }
- });
- _this._socketTask = socketTask;
- socketTask.onOpen(function () {
- _this._readyState = WS.OPEN;
- _this.dispatchEvent({
- type: "open"
- });
- });
- socketTask.onError(errorHandler);
- socketTask.onMessage(function (event) {
- var data = event.data;
- _this.dispatchEvent({
- data: data,
- type: "message"
- });
- });
- socketTask.onClose(function (event) {
- _this._readyState = WS.CLOSED;
- var code = event.code,
- reason = event.reason;
- _this.dispatchEvent({
- code: code,
- reason: reason,
- type: "close"
- });
- });
- return _this;
- }
- WechatWS.prototype.close = function () {
- if (this.readyState === WS.CLOSED) return;
- if (this.readyState === WS.CONNECTING) {
- console.warn("close WebSocket which is connecting might not work");
- }
- this._socketTask.close({});
- };
- WechatWS.prototype.send = function (data) {
- if (this.readyState !== WS.OPEN) {
- throw new Error("INVALID_STATE_ERR");
- }
- if (!(typeof data === "string" || data instanceof ArrayBuffer)) {
- throw new TypeError("only String/ArrayBuffer supported");
- }
- this._socketTask.send({
- data: data
- });
- };
- return WechatWS;
- }(WS);
- var WebSocket = WechatWS;
- var platformInfo = {
- name: "Weapp"
- };
- exports.WebSocket = WebSocket;
- exports.getAuthInfo = getAuthInfo;
- exports.platformInfo = platformInfo;
- exports.request = request;
- exports.storage = storage;
- exports.upload = upload;
- /***/ }),
- /* 570 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(571);
- module.exports = parent;
- /***/ }),
- /* 571 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(572);
- var path = __webpack_require__(5);
- module.exports = path.Object.assign;
- /***/ }),
- /* 572 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var assign = __webpack_require__(573);
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- // eslint-disable-next-line es-x/no-object-assign -- required for testing
- $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
- assign: assign
- });
- /***/ }),
- /* 573 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var DESCRIPTORS = __webpack_require__(14);
- var uncurryThis = __webpack_require__(4);
- var call = __webpack_require__(15);
- var fails = __webpack_require__(2);
- var objectKeys = __webpack_require__(105);
- var getOwnPropertySymbolsModule = __webpack_require__(104);
- var propertyIsEnumerableModule = __webpack_require__(120);
- var toObject = __webpack_require__(34);
- var IndexedObject = __webpack_require__(95);
- // eslint-disable-next-line es-x/no-object-assign -- safe
- var $assign = Object.assign;
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- var defineProperty = Object.defineProperty;
- var concat = uncurryThis([].concat);
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- module.exports = !$assign || fails(function () {
- // should have correct order of operations (Edge bug)
- if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
- enumerable: true,
- get: function () {
- defineProperty(this, 'b', {
- value: 3,
- enumerable: false
- });
- }
- }), { b: 2 })).b !== 1) return true;
- // should work with symbols and should have deterministic property order (V8 bug)
- var A = {};
- var B = {};
- // eslint-disable-next-line es-x/no-symbol -- safe
- var symbol = Symbol();
- var alphabet = 'abcdefghijklmnopqrst';
- A[symbol] = 7;
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
- return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
- var T = toObject(target);
- var argumentsLength = arguments.length;
- var index = 1;
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
- while (argumentsLength > index) {
- var S = IndexedObject(arguments[index++]);
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- key = keys[j++];
- if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
- }
- } return T;
- } : $assign;
- /***/ }),
- /* 574 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(575);
- module.exports = parent;
- /***/ }),
- /* 575 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(244);
- var path = __webpack_require__(5);
- module.exports = path.Object.getOwnPropertySymbols;
- /***/ }),
- /* 576 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(249);
- /***/ }),
- /* 577 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(578);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 578 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(53);
- __webpack_require__(579);
- var path = __webpack_require__(5);
- module.exports = path.WeakMap;
- /***/ }),
- /* 579 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- __webpack_require__(580);
- /***/ }),
- /* 580 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var global = __webpack_require__(7);
- var uncurryThis = __webpack_require__(4);
- var defineBuiltIns = __webpack_require__(154);
- var InternalMetadataModule = __webpack_require__(94);
- var collection = __webpack_require__(155);
- var collectionWeak = __webpack_require__(582);
- var isObject = __webpack_require__(11);
- var isExtensible = __webpack_require__(261);
- var enforceInternalState = __webpack_require__(43).enforce;
- var NATIVE_WEAK_MAP = __webpack_require__(170);
- var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
- var InternalWeakMap;
- var wrapper = function (init) {
- return function WeakMap() {
- return init(this, arguments.length ? arguments[0] : undefined);
- };
- };
- // `WeakMap` constructor
- // https://tc39.es/ecma262/#sec-weakmap-constructor
- var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
- // IE11 WeakMap frozen keys fix
- // We can't use feature detection because it crash some old IE builds
- // https://github.com/zloirock/core-js/issues/485
- if (NATIVE_WEAK_MAP && IS_IE11) {
- InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
- InternalMetadataModule.enable();
- var WeakMapPrototype = $WeakMap.prototype;
- var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
- var nativeHas = uncurryThis(WeakMapPrototype.has);
- var nativeGet = uncurryThis(WeakMapPrototype.get);
- var nativeSet = uncurryThis(WeakMapPrototype.set);
- defineBuiltIns(WeakMapPrototype, {
- 'delete': function (key) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- return nativeDelete(this, key) || state.frozen['delete'](key);
- } return nativeDelete(this, key);
- },
- has: function has(key) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- return nativeHas(this, key) || state.frozen.has(key);
- } return nativeHas(this, key);
- },
- get: function get(key) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
- } return nativeGet(this, key);
- },
- set: function set(key, value) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
- } else nativeSet(this, key, value);
- return this;
- }
- });
- }
- /***/ }),
- /* 581 */
- /***/ (function(module, exports, __webpack_require__) {
- // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
- var fails = __webpack_require__(2);
- module.exports = fails(function () {
- if (typeof ArrayBuffer == 'function') {
- var buffer = new ArrayBuffer(8);
- // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
- if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
- }
- });
- /***/ }),
- /* 582 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var uncurryThis = __webpack_require__(4);
- var defineBuiltIns = __webpack_require__(154);
- var getWeakData = __webpack_require__(94).getWeakData;
- var anObject = __webpack_require__(20);
- var isObject = __webpack_require__(11);
- var anInstance = __webpack_require__(108);
- var iterate = __webpack_require__(42);
- var ArrayIterationModule = __webpack_require__(70);
- var hasOwn = __webpack_require__(13);
- var InternalStateModule = __webpack_require__(43);
- var setInternalState = InternalStateModule.set;
- var internalStateGetterFor = InternalStateModule.getterFor;
- var find = ArrayIterationModule.find;
- var findIndex = ArrayIterationModule.findIndex;
- var splice = uncurryThis([].splice);
- var id = 0;
- // fallback for uncaught frozen keys
- var uncaughtFrozenStore = function (store) {
- return store.frozen || (store.frozen = new UncaughtFrozenStore());
- };
- var UncaughtFrozenStore = function () {
- this.entries = [];
- };
- var findUncaughtFrozen = function (store, key) {
- return find(store.entries, function (it) {
- return it[0] === key;
- });
- };
- UncaughtFrozenStore.prototype = {
- get: function (key) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) return entry[1];
- },
- has: function (key) {
- return !!findUncaughtFrozen(this, key);
- },
- set: function (key, value) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) entry[1] = value;
- else this.entries.push([key, value]);
- },
- 'delete': function (key) {
- var index = findIndex(this.entries, function (it) {
- return it[0] === key;
- });
- if (~index) splice(this.entries, index, 1);
- return !!~index;
- }
- };
- module.exports = {
- getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
- var Constructor = wrapper(function (that, iterable) {
- anInstance(that, Prototype);
- setInternalState(that, {
- type: CONSTRUCTOR_NAME,
- id: id++,
- frozen: undefined
- });
- if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
- });
- var Prototype = Constructor.prototype;
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var define = function (that, key, value) {
- var state = getInternalState(that);
- var data = getWeakData(anObject(key), true);
- if (data === true) uncaughtFrozenStore(state).set(key, value);
- else data[state.id] = value;
- return that;
- };
- defineBuiltIns(Prototype, {
- // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
- // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
- // https://tc39.es/ecma262/#sec-weakset.prototype.delete
- 'delete': function (key) {
- var state = getInternalState(this);
- if (!isObject(key)) return false;
- var data = getWeakData(key);
- if (data === true) return uncaughtFrozenStore(state)['delete'](key);
- return data && hasOwn(data, state.id) && delete data[state.id];
- },
- // `{ WeakMap, WeakSet }.prototype.has(key)` methods
- // https://tc39.es/ecma262/#sec-weakmap.prototype.has
- // https://tc39.es/ecma262/#sec-weakset.prototype.has
- has: function has(key) {
- var state = getInternalState(this);
- if (!isObject(key)) return false;
- var data = getWeakData(key);
- if (data === true) return uncaughtFrozenStore(state).has(key);
- return data && hasOwn(data, state.id);
- }
- });
- defineBuiltIns(Prototype, IS_MAP ? {
- // `WeakMap.prototype.get(key)` method
- // https://tc39.es/ecma262/#sec-weakmap.prototype.get
- get: function get(key) {
- var state = getInternalState(this);
- if (isObject(key)) {
- var data = getWeakData(key);
- if (data === true) return uncaughtFrozenStore(state).get(key);
- return data ? data[state.id] : undefined;
- }
- },
- // `WeakMap.prototype.set(key, value)` method
- // https://tc39.es/ecma262/#sec-weakmap.prototype.set
- set: function set(key, value) {
- return define(this, key, value);
- }
- } : {
- // `WeakSet.prototype.add(value)` method
- // https://tc39.es/ecma262/#sec-weakset.prototype.add
- add: function add(value) {
- return define(this, value, true);
- }
- });
- return Constructor;
- }
- };
- /***/ }),
- /* 583 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(584);
- /***/ }),
- /* 584 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(585);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 585 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(586);
- __webpack_require__(53);
- __webpack_require__(55);
- var path = __webpack_require__(5);
- module.exports = path.Map;
- /***/ }),
- /* 586 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- __webpack_require__(587);
- /***/ }),
- /* 587 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var collection = __webpack_require__(155);
- var collectionStrong = __webpack_require__(263);
- // `Map` constructor
- // https://tc39.es/ecma262/#sec-map-objects
- collection('Map', function (init) {
- return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
- }, collectionStrong);
- /***/ }),
- /* 588 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _require = __webpack_require__(156),
- Realtime = _require.Realtime,
- setRTMAdapters = _require.setAdapters;
- var _require2 = __webpack_require__(664),
- LiveQueryPlugin = _require2.LiveQueryPlugin;
- Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
- module.exports = function (AV) {
- AV._sharedConfig.liveQueryRealtime = Realtime;
- var setAdapters = AV.setAdapters;
- AV.setAdapters = function (adapters) {
- setAdapters(adapters);
- setRTMAdapters(adapters);
- };
- return AV;
- };
- /***/ }),
- /* 589 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- var _interopRequireDefault = __webpack_require__(1);
- var _typeof3 = _interopRequireDefault(__webpack_require__(73));
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(92));
- var _freeze = _interopRequireDefault(__webpack_require__(590));
- var _assign = _interopRequireDefault(__webpack_require__(152));
- var _symbol = _interopRequireDefault(__webpack_require__(149));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _keys = _interopRequireDefault(__webpack_require__(115));
- var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
- var _filter = _interopRequireDefault(__webpack_require__(250));
- var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
- var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(594));
- var _defineProperties = _interopRequireDefault(__webpack_require__(598));
- var _promise = _interopRequireDefault(__webpack_require__(12));
- var _slice = _interopRequireDefault(__webpack_require__(61));
- var _indexOf = _interopRequireDefault(__webpack_require__(71));
- var _weakMap = _interopRequireDefault(__webpack_require__(260));
- var _stringify = _interopRequireDefault(__webpack_require__(36));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _reduce = _interopRequireDefault(__webpack_require__(602));
- var _find = _interopRequireDefault(__webpack_require__(93));
- var _set = _interopRequireDefault(__webpack_require__(264));
- var _context6, _context15;
- (0, _defineProperty2.default)(exports, '__esModule', {
- value: true
- });
- function _interopDefault(ex) {
- return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
- }
- var protobufLight = _interopDefault(__webpack_require__(612));
- var EventEmitter = _interopDefault(__webpack_require__(616));
- var _regeneratorRuntime = _interopDefault(__webpack_require__(617));
- var _asyncToGenerator = _interopDefault(__webpack_require__(619));
- var _toConsumableArray = _interopDefault(__webpack_require__(620));
- var _defineProperty = _interopDefault(__webpack_require__(623));
- var _objectWithoutProperties = _interopDefault(__webpack_require__(624));
- var _assertThisInitialized = _interopDefault(__webpack_require__(626));
- var _inheritsLoose = _interopDefault(__webpack_require__(627));
- var d = _interopDefault(__webpack_require__(60));
- var shuffle = _interopDefault(__webpack_require__(628));
- var values = _interopDefault(__webpack_require__(269));
- var _toArray = _interopDefault(__webpack_require__(655));
- var _createClass = _interopDefault(__webpack_require__(658));
- var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(659));
- var StateMachine = _interopDefault(__webpack_require__(660));
- var _typeof = _interopDefault(__webpack_require__(661));
- var isPlainObject = _interopDefault(__webpack_require__(662));
- var promiseTimeout = __webpack_require__(251);
- var messageCompiled = protobufLight.newBuilder({})['import']({
- "package": 'push_server.messages2',
- syntax: 'proto2',
- options: {
- objc_class_prefix: 'AVIM'
- },
- messages: [{
- name: 'JsonObjectMessage',
- syntax: 'proto2',
- fields: [{
- rule: 'required',
- type: 'string',
- name: 'data',
- id: 1
- }]
- }, {
- name: 'UnreadTuple',
- syntax: 'proto2',
- fields: [{
- rule: 'required',
- type: 'string',
- name: 'cid',
- id: 1
- }, {
- rule: 'required',
- type: 'int32',
- name: 'unread',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'mid',
- id: 3
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'timestamp',
- id: 4
- }, {
- rule: 'optional',
- type: 'string',
- name: 'from',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'data',
- id: 6
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'patchTimestamp',
- id: 7
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'mentioned',
- id: 8
- }, {
- rule: 'optional',
- type: 'bytes',
- name: 'binaryMsg',
- id: 9
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'convType',
- id: 10
- }]
- }, {
- name: 'LogItem',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'from',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'data',
- id: 2
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'timestamp',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'msgId',
- id: 4
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'ackAt',
- id: 5
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'readAt',
- id: 6
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'patchTimestamp',
- id: 7
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'mentionAll',
- id: 8
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'mentionPids',
- id: 9
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'bin',
- id: 10
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'convType',
- id: 11
- }]
- }, {
- name: 'ConvMemberInfo',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'pid',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'role',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'infoId',
- id: 3
- }]
- }, {
- name: 'DataCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'repeated',
- type: 'string',
- name: 'ids',
- id: 1
- }, {
- rule: 'repeated',
- type: 'JsonObjectMessage',
- name: 'msg',
- id: 2
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'offline',
- id: 3
- }]
- }, {
- name: 'SessionCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'n',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 's',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'ua',
- id: 4
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'r',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'tag',
- id: 6
- }, {
- rule: 'optional',
- type: 'string',
- name: 'deviceId',
- id: 7
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'sessionPeerIds',
- id: 8
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'onlineSessionPeerIds',
- id: 9
- }, {
- rule: 'optional',
- type: 'string',
- name: 'st',
- id: 10
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'stTtl',
- id: 11
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'code',
- id: 12
- }, {
- rule: 'optional',
- type: 'string',
- name: 'reason',
- id: 13
- }, {
- rule: 'optional',
- type: 'string',
- name: 'deviceToken',
- id: 14
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'sp',
- id: 15
- }, {
- rule: 'optional',
- type: 'string',
- name: 'detail',
- id: 16
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'lastUnreadNotifTime',
- id: 17
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'lastPatchTime',
- id: 18
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'configBitmap',
- id: 19
- }]
- }, {
- name: 'ErrorCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'required',
- type: 'int32',
- name: 'code',
- id: 1
- }, {
- rule: 'required',
- type: 'string',
- name: 'reason',
- id: 2
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'appCode',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'detail',
- id: 4
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'pids',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'appMsg',
- id: 6
- }]
- }, {
- name: 'DirectCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'msg',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'uid',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'fromPeerId',
- id: 3
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'timestamp',
- id: 4
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'offline',
- id: 5
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'hasMore',
- id: 6
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'toPeerIds',
- id: 7
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'r',
- id: 10
- }, {
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 11
- }, {
- rule: 'optional',
- type: 'string',
- name: 'id',
- id: 12
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'transient',
- id: 13
- }, {
- rule: 'optional',
- type: 'string',
- name: 'dt',
- id: 14
- }, {
- rule: 'optional',
- type: 'string',
- name: 'roomId',
- id: 15
- }, {
- rule: 'optional',
- type: 'string',
- name: 'pushData',
- id: 16
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'will',
- id: 17
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'patchTimestamp',
- id: 18
- }, {
- rule: 'optional',
- type: 'bytes',
- name: 'binaryMsg',
- id: 19
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'mentionPids',
- id: 20
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'mentionAll',
- id: 21
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'convType',
- id: 22
- }]
- }, {
- name: 'AckCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'int32',
- name: 'code',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'reason',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'mid',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 4
- }, {
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'uid',
- id: 6
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'fromts',
- id: 7
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'tots',
- id: 8
- }, {
- rule: 'optional',
- type: 'string',
- name: 'type',
- id: 9
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'ids',
- id: 10
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'appCode',
- id: 11
- }, {
- rule: 'optional',
- type: 'string',
- name: 'appMsg',
- id: 12
- }]
- }, {
- name: 'UnreadCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'repeated',
- type: 'UnreadTuple',
- name: 'convs',
- id: 1
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'notifTime',
- id: 2
- }]
- }, {
- name: 'ConvCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'repeated',
- type: 'string',
- name: 'm',
- id: 1
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'transient',
- id: 2
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'unique',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 4
- }, {
- rule: 'optional',
- type: 'string',
- name: 'cdate',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'initBy',
- id: 6
- }, {
- rule: 'optional',
- type: 'string',
- name: 'sort',
- id: 7
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'limit',
- id: 8
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'skip',
- id: 9
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'flag',
- id: 10
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'count',
- id: 11
- }, {
- rule: 'optional',
- type: 'string',
- name: 'udate',
- id: 12
- }, {
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 13
- }, {
- rule: 'optional',
- type: 'string',
- name: 'n',
- id: 14
- }, {
- rule: 'optional',
- type: 'string',
- name: 's',
- id: 15
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'statusSub',
- id: 16
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'statusPub',
- id: 17
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'statusTTL',
- id: 18
- }, {
- rule: 'optional',
- type: 'string',
- name: 'uniqueId',
- id: 19
- }, {
- rule: 'optional',
- type: 'string',
- name: 'targetClientId',
- id: 20
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'maxReadTimestamp',
- id: 21
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'maxAckTimestamp',
- id: 22
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'queryAllMembers',
- id: 23
- }, {
- rule: 'repeated',
- type: 'MaxReadTuple',
- name: 'maxReadTuples',
- id: 24
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'cids',
- id: 25
- }, {
- rule: 'optional',
- type: 'ConvMemberInfo',
- name: 'info',
- id: 26
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'tempConv',
- id: 27
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'tempConvTTL',
- id: 28
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'tempConvIds',
- id: 29
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'allowedPids',
- id: 30
- }, {
- rule: 'repeated',
- type: 'ErrorCommand',
- name: 'failedPids',
- id: 31
- }, {
- rule: 'optional',
- type: 'string',
- name: 'next',
- id: 40
- }, {
- rule: 'optional',
- type: 'JsonObjectMessage',
- name: 'results',
- id: 100
- }, {
- rule: 'optional',
- type: 'JsonObjectMessage',
- name: 'where',
- id: 101
- }, {
- rule: 'optional',
- type: 'JsonObjectMessage',
- name: 'attr',
- id: 103
- }, {
- rule: 'optional',
- type: 'JsonObjectMessage',
- name: 'attrModified',
- id: 104
- }]
- }, {
- name: 'RoomCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'roomId',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 's',
- id: 2
- }, {
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'n',
- id: 4
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'transient',
- id: 5
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'roomPeerIds',
- id: 6
- }, {
- rule: 'optional',
- type: 'string',
- name: 'byPeerId',
- id: 7
- }]
- }, {
- name: 'LogsCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 1
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'l',
- id: 2
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'limit',
- id: 3
- }, {
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 4
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'tt',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'tmid',
- id: 6
- }, {
- rule: 'optional',
- type: 'string',
- name: 'mid',
- id: 7
- }, {
- rule: 'optional',
- type: 'string',
- name: 'checksum',
- id: 8
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'stored',
- id: 9
- }, {
- rule: 'optional',
- type: 'QueryDirection',
- name: 'direction',
- id: 10,
- options: {
- "default": 'OLD'
- }
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'tIncluded',
- id: 11
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'ttIncluded',
- id: 12
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'lctype',
- id: 13
- }, {
- rule: 'repeated',
- type: 'LogItem',
- name: 'logs',
- id: 105
- }],
- enums: [{
- name: 'QueryDirection',
- syntax: 'proto2',
- values: [{
- name: 'OLD',
- id: 1
- }, {
- name: 'NEW',
- id: 2
- }]
- }]
- }, {
- name: 'RcpCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'id',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 2
- }, {
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 3
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'read',
- id: 4
- }, {
- rule: 'optional',
- type: 'string',
- name: 'from',
- id: 5
- }]
- }, {
- name: 'ReadTuple',
- syntax: 'proto2',
- fields: [{
- rule: 'required',
- type: 'string',
- name: 'cid',
- id: 1
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'timestamp',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'mid',
- id: 3
- }]
- }, {
- name: 'MaxReadTuple',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'pid',
- id: 1
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'maxAckTimestamp',
- id: 2
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'maxReadTimestamp',
- id: 3
- }]
- }, {
- name: 'ReadCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 1
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'cids',
- id: 2
- }, {
- rule: 'repeated',
- type: 'ReadTuple',
- name: 'convs',
- id: 3
- }]
- }, {
- name: 'PresenceCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'StatusType',
- name: 'status',
- id: 1
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'sessionPeerIds',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 3
- }]
- }, {
- name: 'ReportCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'bool',
- name: 'initiative',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'type',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'data',
- id: 3
- }]
- }, {
- name: 'PatchItem',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 1
- }, {
- rule: 'optional',
- type: 'string',
- name: 'mid',
- id: 2
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'timestamp',
- id: 3
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'recall',
- id: 4
- }, {
- rule: 'optional',
- type: 'string',
- name: 'data',
- id: 5
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'patchTimestamp',
- id: 6
- }, {
- rule: 'optional',
- type: 'string',
- name: 'from',
- id: 7
- }, {
- rule: 'optional',
- type: 'bytes',
- name: 'binaryMsg',
- id: 8
- }, {
- rule: 'optional',
- type: 'bool',
- name: 'mentionAll',
- id: 9
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'mentionPids',
- id: 10
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'patchCode',
- id: 11
- }, {
- rule: 'optional',
- type: 'string',
- name: 'patchReason',
- id: 12
- }]
- }, {
- name: 'PatchCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'repeated',
- type: 'PatchItem',
- name: 'patches',
- id: 1
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'lastPatchTime',
- id: 2
- }]
- }, {
- name: 'PubsubCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'cid',
- id: 1
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'cids',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'topic',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'subtopic',
- id: 4
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'topics',
- id: 5
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'subtopics',
- id: 6
- }, {
- rule: 'optional',
- type: 'JsonObjectMessage',
- name: 'results',
- id: 7
- }]
- }, {
- name: 'BlacklistCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'string',
- name: 'srcCid',
- id: 1
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'toPids',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'srcPid',
- id: 3
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'toCids',
- id: 4
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'limit',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'next',
- id: 6
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'blockedPids',
- id: 8
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'blockedCids',
- id: 9
- }, {
- rule: 'repeated',
- type: 'string',
- name: 'allowedPids',
- id: 10
- }, {
- rule: 'repeated',
- type: 'ErrorCommand',
- name: 'failedPids',
- id: 11
- }, {
- rule: 'optional',
- type: 'int64',
- name: 't',
- id: 12
- }, {
- rule: 'optional',
- type: 'string',
- name: 'n',
- id: 13
- }, {
- rule: 'optional',
- type: 'string',
- name: 's',
- id: 14
- }]
- }, {
- name: 'GenericCommand',
- syntax: 'proto2',
- fields: [{
- rule: 'optional',
- type: 'CommandType',
- name: 'cmd',
- id: 1
- }, {
- rule: 'optional',
- type: 'OpType',
- name: 'op',
- id: 2
- }, {
- rule: 'optional',
- type: 'string',
- name: 'appId',
- id: 3
- }, {
- rule: 'optional',
- type: 'string',
- name: 'peerId',
- id: 4
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'i',
- id: 5
- }, {
- rule: 'optional',
- type: 'string',
- name: 'installationId',
- id: 6
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'priority',
- id: 7
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'service',
- id: 8
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'serverTs',
- id: 9
- }, {
- rule: 'optional',
- type: 'int64',
- name: 'clientTs',
- id: 10
- }, {
- rule: 'optional',
- type: 'int32',
- name: 'notificationType',
- id: 11
- }, {
- rule: 'optional',
- type: 'DataCommand',
- name: 'dataMessage',
- id: 101
- }, {
- rule: 'optional',
- type: 'SessionCommand',
- name: 'sessionMessage',
- id: 102
- }, {
- rule: 'optional',
- type: 'ErrorCommand',
- name: 'errorMessage',
- id: 103
- }, {
- rule: 'optional',
- type: 'DirectCommand',
- name: 'directMessage',
- id: 104
- }, {
- rule: 'optional',
- type: 'AckCommand',
- name: 'ackMessage',
- id: 105
- }, {
- rule: 'optional',
- type: 'UnreadCommand',
- name: 'unreadMessage',
- id: 106
- }, {
- rule: 'optional',
- type: 'ReadCommand',
- name: 'readMessage',
- id: 107
- }, {
- rule: 'optional',
- type: 'RcpCommand',
- name: 'rcpMessage',
- id: 108
- }, {
- rule: 'optional',
- type: 'LogsCommand',
- name: 'logsMessage',
- id: 109
- }, {
- rule: 'optional',
- type: 'ConvCommand',
- name: 'convMessage',
- id: 110
- }, {
- rule: 'optional',
- type: 'RoomCommand',
- name: 'roomMessage',
- id: 111
- }, {
- rule: 'optional',
- type: 'PresenceCommand',
- name: 'presenceMessage',
- id: 112
- }, {
- rule: 'optional',
- type: 'ReportCommand',
- name: 'reportMessage',
- id: 113
- }, {
- rule: 'optional',
- type: 'PatchCommand',
- name: 'patchMessage',
- id: 114
- }, {
- rule: 'optional',
- type: 'PubsubCommand',
- name: 'pubsubMessage',
- id: 115
- }, {
- rule: 'optional',
- type: 'BlacklistCommand',
- name: 'blacklistMessage',
- id: 116
- }]
- }],
- enums: [{
- name: 'CommandType',
- syntax: 'proto2',
- values: [{
- name: 'session',
- id: 0
- }, {
- name: 'conv',
- id: 1
- }, {
- name: 'direct',
- id: 2
- }, {
- name: 'ack',
- id: 3
- }, {
- name: 'rcp',
- id: 4
- }, {
- name: 'unread',
- id: 5
- }, {
- name: 'logs',
- id: 6
- }, {
- name: 'error',
- id: 7
- }, {
- name: 'login',
- id: 8
- }, {
- name: 'data',
- id: 9
- }, {
- name: 'room',
- id: 10
- }, {
- name: 'read',
- id: 11
- }, {
- name: 'presence',
- id: 12
- }, {
- name: 'report',
- id: 13
- }, {
- name: 'echo',
- id: 14
- }, {
- name: 'loggedin',
- id: 15
- }, {
- name: 'logout',
- id: 16
- }, {
- name: 'loggedout',
- id: 17
- }, {
- name: 'patch',
- id: 18
- }, {
- name: 'pubsub',
- id: 19
- }, {
- name: 'blacklist',
- id: 20
- }, {
- name: 'goaway',
- id: 21
- }]
- }, {
- name: 'OpType',
- syntax: 'proto2',
- values: [{
- name: 'open',
- id: 1
- }, {
- name: 'add',
- id: 2
- }, {
- name: 'remove',
- id: 3
- }, {
- name: 'close',
- id: 4
- }, {
- name: 'opened',
- id: 5
- }, {
- name: 'closed',
- id: 6
- }, {
- name: 'query',
- id: 7
- }, {
- name: 'query_result',
- id: 8
- }, {
- name: 'conflict',
- id: 9
- }, {
- name: 'added',
- id: 10
- }, {
- name: 'removed',
- id: 11
- }, {
- name: 'refresh',
- id: 12
- }, {
- name: 'refreshed',
- id: 13
- }, {
- name: 'start',
- id: 30
- }, {
- name: 'started',
- id: 31
- }, {
- name: 'joined',
- id: 32
- }, {
- name: 'members_joined',
- id: 33
- }, {
- name: 'left',
- id: 39
- }, {
- name: 'members_left',
- id: 40
- }, {
- name: 'results',
- id: 42
- }, {
- name: 'count',
- id: 43
- }, {
- name: 'result',
- id: 44
- }, {
- name: 'update',
- id: 45
- }, {
- name: 'updated',
- id: 46
- }, {
- name: 'mute',
- id: 47
- }, {
- name: 'unmute',
- id: 48
- }, {
- name: 'status',
- id: 49
- }, {
- name: 'members',
- id: 50
- }, {
- name: 'max_read',
- id: 51
- }, {
- name: 'is_member',
- id: 52
- }, {
- name: 'member_info_update',
- id: 53
- }, {
- name: 'member_info_updated',
- id: 54
- }, {
- name: 'member_info_changed',
- id: 55
- }, {
- name: 'join',
- id: 80
- }, {
- name: 'invite',
- id: 81
- }, {
- name: 'leave',
- id: 82
- }, {
- name: 'kick',
- id: 83
- }, {
- name: 'reject',
- id: 84
- }, {
- name: 'invited',
- id: 85
- }, {
- name: 'kicked',
- id: 86
- }, {
- name: 'upload',
- id: 100
- }, {
- name: 'uploaded',
- id: 101
- }, {
- name: 'subscribe',
- id: 120
- }, {
- name: 'subscribed',
- id: 121
- }, {
- name: 'unsubscribe',
- id: 122
- }, {
- name: 'unsubscribed',
- id: 123
- }, {
- name: 'is_subscribed',
- id: 124
- }, {
- name: 'modify',
- id: 150
- }, {
- name: 'modified',
- id: 151
- }, {
- name: 'block',
- id: 170
- }, {
- name: 'unblock',
- id: 171
- }, {
- name: 'blocked',
- id: 172
- }, {
- name: 'unblocked',
- id: 173
- }, {
- name: 'members_blocked',
- id: 174
- }, {
- name: 'members_unblocked',
- id: 175
- }, {
- name: 'check_block',
- id: 176
- }, {
- name: 'check_result',
- id: 177
- }, {
- name: 'add_shutup',
- id: 180
- }, {
- name: 'remove_shutup',
- id: 181
- }, {
- name: 'query_shutup',
- id: 182
- }, {
- name: 'shutup_added',
- id: 183
- }, {
- name: 'shutup_removed',
- id: 184
- }, {
- name: 'shutup_result',
- id: 185
- }, {
- name: 'shutuped',
- id: 186
- }, {
- name: 'unshutuped',
- id: 187
- }, {
- name: 'members_shutuped',
- id: 188
- }, {
- name: 'members_unshutuped',
- id: 189
- }, {
- name: 'check_shutup',
- id: 190
- }]
- }, {
- name: 'StatusType',
- syntax: 'proto2',
- values: [{
- name: 'on',
- id: 1
- }, {
- name: 'off',
- id: 2
- }]
- }],
- isNamespace: true
- }).build();
- var _messages$push_server = messageCompiled.push_server.messages2,
- JsonObjectMessage = _messages$push_server.JsonObjectMessage,
- UnreadTuple = _messages$push_server.UnreadTuple,
- LogItem = _messages$push_server.LogItem,
- DataCommand = _messages$push_server.DataCommand,
- SessionCommand = _messages$push_server.SessionCommand,
- ErrorCommand = _messages$push_server.ErrorCommand,
- DirectCommand = _messages$push_server.DirectCommand,
- AckCommand = _messages$push_server.AckCommand,
- UnreadCommand = _messages$push_server.UnreadCommand,
- ConvCommand = _messages$push_server.ConvCommand,
- RoomCommand = _messages$push_server.RoomCommand,
- LogsCommand = _messages$push_server.LogsCommand,
- RcpCommand = _messages$push_server.RcpCommand,
- ReadTuple = _messages$push_server.ReadTuple,
- MaxReadTuple = _messages$push_server.MaxReadTuple,
- ReadCommand = _messages$push_server.ReadCommand,
- PresenceCommand = _messages$push_server.PresenceCommand,
- ReportCommand = _messages$push_server.ReportCommand,
- GenericCommand = _messages$push_server.GenericCommand,
- BlacklistCommand = _messages$push_server.BlacklistCommand,
- PatchCommand = _messages$push_server.PatchCommand,
- PatchItem = _messages$push_server.PatchItem,
- ConvMemberInfo = _messages$push_server.ConvMemberInfo,
- CommandType = _messages$push_server.CommandType,
- OpType = _messages$push_server.OpType,
- StatusType = _messages$push_server.StatusType;
- var message = /*#__PURE__*/(0, _freeze.default)({
- __proto__: null,
- JsonObjectMessage: JsonObjectMessage,
- UnreadTuple: UnreadTuple,
- LogItem: LogItem,
- DataCommand: DataCommand,
- SessionCommand: SessionCommand,
- ErrorCommand: ErrorCommand,
- DirectCommand: DirectCommand,
- AckCommand: AckCommand,
- UnreadCommand: UnreadCommand,
- ConvCommand: ConvCommand,
- RoomCommand: RoomCommand,
- LogsCommand: LogsCommand,
- RcpCommand: RcpCommand,
- ReadTuple: ReadTuple,
- MaxReadTuple: MaxReadTuple,
- ReadCommand: ReadCommand,
- PresenceCommand: PresenceCommand,
- ReportCommand: ReportCommand,
- GenericCommand: GenericCommand,
- BlacklistCommand: BlacklistCommand,
- PatchCommand: PatchCommand,
- PatchItem: PatchItem,
- ConvMemberInfo: ConvMemberInfo,
- CommandType: CommandType,
- OpType: OpType,
- StatusType: StatusType
- });
- var adapters = {};
- var getAdapter = function getAdapter(name) {
- var adapter = adapters[name];
- if (adapter === undefined) {
- throw new Error("".concat(name, " adapter is not configured"));
- }
- return adapter;
- };
- /**
- * 指定 Adapters
- * @function
- * @memberof module:leancloud-realtime
- * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
- */
- var setAdapters = function setAdapters(newAdapters) {
- (0, _assign.default)(adapters, newAdapters);
- };
- /* eslint-disable */
- var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
- var EXPIRED = (0, _symbol.default)('expired');
- var debug = d('LC:Expirable');
- var Expirable = /*#__PURE__*/function () {
- function Expirable(value, ttl) {
- this.originalValue = value;
- if (typeof ttl === 'number') {
- this.expiredAt = Date.now() + ttl;
- }
- }
- _createClass(Expirable, [{
- key: "value",
- get: function get() {
- var expired = this.expiredAt && this.expiredAt <= Date.now();
- if (expired) debug("expired: ".concat(this.originalValue));
- return expired ? EXPIRED : this.originalValue;
- }
- }]);
- return Expirable;
- }();
- Expirable.EXPIRED = EXPIRED;
- var debug$1 = d('LC:Cache');
- var Cache = /*#__PURE__*/function () {
- function Cache() {
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
- this.name = name;
- this._map = {};
- }
- var _proto = Cache.prototype;
- _proto.get = function get(key) {
- var _context5;
- var cache = this._map[key];
- if (cache) {
- var value = cache.value;
- if (value !== Expirable.EXPIRED) {
- debug$1('[%s] hit: %s', this.name, key);
- return value;
- }
- delete this._map[key];
- }
- debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
- return null;
- };
- _proto.set = function set(key, value, ttl) {
- debug$1('[%s] set: %s %d', this.name, key, ttl);
- this._map[key] = new Expirable(value, ttl);
- };
- return Cache;
- }();
- function ownKeys(object, enumerableOnly) {
- var keys = (0, _keys.default)(object);
- if (_getOwnPropertySymbols.default) {
- var symbols = (0, _getOwnPropertySymbols.default)(object);
- if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
- return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
- });
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (_getOwnPropertyDescriptors.default) {
- (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
- } else {
- ownKeys(Object(source)).forEach(function (key) {
- (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
- });
- }
- }
- return target;
- }
- /**
- * 调试日志控制器
- * @const
- * @memberof module:leancloud-realtime
- * @example
- * debug.enable(); // 启用调试日志
- * debug.disable(); // 关闭调试日志
- */
- var debug$2 = {
- enable: function enable() {
- var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
- return d.enable(namespaces);
- },
- disable: d.disable
- };
- var tryAll = function tryAll(promiseConstructors) {
- var promise = new _promise.default(promiseConstructors[0]);
- if (promiseConstructors.length === 1) {
- return promise;
- }
- return promise["catch"](function () {
- return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
- });
- }; // eslint-disable-next-line no-sequences
- var tap = function tap(interceptor) {
- return function (value) {
- return interceptor(value), value;
- };
- };
- var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
- var map = new _weakMap.default(); // protected property helper
- var internal = function internal(object) {
- if (!map.has(object)) {
- map.set(object, {});
- }
- return map.get(object);
- };
- var compact = function compact(obj, filter) {
- if (!isPlainObject(obj)) return obj;
- var object = _objectSpread({}, obj);
- (0, _keys.default)(object).forEach(function (prop) {
- var value = object[prop];
- if (value === filter) {
- delete object[prop];
- } else {
- object[prop] = compact(value, filter);
- }
- });
- return object;
- }; // debug utility
- var removeNull = function removeNull(obj) {
- return compact(obj, null);
- };
- var trim = function trim(message) {
- return removeNull(JSON.parse((0, _stringify.default)(message)));
- };
- var ensureArray = function ensureArray(target) {
- if (Array.isArray(target)) {
- return target;
- }
- if (target === undefined || target === null) {
- return [];
- }
- return [target];
- };
- var isWeapp = // eslint-disable-next-line no-undef
- (typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator
- var isCNApp = function isCNApp(appId) {
- return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
- };
- var equalBuffer = function equalBuffer(buffer1, buffer2) {
- if (!buffer1 || !buffer2) return false;
- if (buffer1.byteLength !== buffer2.byteLength) return false;
- var a = new Uint8Array(buffer1);
- var b = new Uint8Array(buffer2);
- return !a.some(function (value, index) {
- return value !== b[index];
- });
- };
- var _class;
- function ownKeys$1(object, enumerableOnly) {
- var keys = (0, _keys.default)(object);
- if (_getOwnPropertySymbols.default) {
- var symbols = (0, _getOwnPropertySymbols.default)(object);
- if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
- return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
- });
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread$1(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys$1(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (_getOwnPropertyDescriptors.default) {
- (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
- } else {
- ownKeys$1(Object(source)).forEach(function (key) {
- (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
- });
- }
- }
- return target;
- }
- var debug$3 = d('LC:WebSocketPlus');
- var OPEN = 'open';
- var DISCONNECT = 'disconnect';
- var RECONNECT = 'reconnect';
- var RETRY = 'retry';
- var SCHEDULE = 'schedule';
- var OFFLINE = 'offline';
- var ONLINE = 'online';
- var ERROR = 'error';
- var MESSAGE = 'message';
- var HEARTBEAT_TIME = 180000;
- var TIMEOUT_TIME = 380000;
- var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
- return Math.min(1000 * Math.pow(2, attempt), 300000);
- };
- var requireConnected = function requireConnected(target, name, descriptor) {
- return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
- value: function requireConnectedWrapper() {
- var _context7;
- var _descriptor$value;
- this.checkConnectionAvailability(name);
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
- }
- });
- };
- var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
- _inheritsLoose(WebSocketPlus, _EventEmitter);
- _createClass(WebSocketPlus, [{
- key: "urls",
- get: function get() {
- return this._urls;
- },
- set: function set(urls) {
- this._urls = ensureArray(urls);
- }
- }]);
- function WebSocketPlus(getUrls, protocol) {
- var _this;
- _this = _EventEmitter.call(this) || this;
- _this.init();
- _this._protocol = protocol;
- _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
- _this._urls = urls;
- return _this._open();
- }).then(function () {
- _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
- if (global$1.addEventListener) {
- _this.__pause = function () {
- if (_this.can('pause')) _this.pause();
- };
- _this.__resume = function () {
- if (_this.can('resume')) _this.resume();
- };
- global$1.addEventListener('offline', _this.__pause);
- global$1.addEventListener('online', _this.__resume);
- }
- _this.open();
- })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
- return _this;
- }
- var _proto = WebSocketPlus.prototype;
- _proto._open = function _open() {
- var _this2 = this;
- return this._createWs(this._urls, this._protocol).then(function (ws) {
- var _context8;
- var _this2$_urls = _toArray(_this2._urls),
- first = _this2$_urls[0],
- reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
- _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
- return ws;
- });
- };
- _proto._createWs = function _createWs(urls, protocol) {
- var _this3 = this;
- return tryAll((0, _map.default)(urls).call(urls, function (url) {
- return function (resolve, reject) {
- var _context9;
- debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
- var WebSocket = getAdapter('WebSocket');
- var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
- ws.binaryType = _this3.binaryType || 'arraybuffer';
- ws.onopen = function () {
- return resolve(ws);
- };
- ws.onclose = function (error) {
- if (error instanceof Error) {
- return reject(error);
- } // in browser, error event is useless
- return reject(new Error("Failed to connect [".concat(url, "]")));
- };
- ws.onerror = ws.onclose;
- };
- })).then(function (ws) {
- _this3._ws = ws;
- _this3._ws.onclose = _this3._handleClose.bind(_this3);
- _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
- return ws;
- });
- };
- _proto._destroyWs = function _destroyWs() {
- var ws = this._ws;
- if (!ws) return;
- ws.onopen = null;
- ws.onclose = null;
- ws.onerror = null;
- ws.onmessage = null;
- this._ws = null;
- ws.close();
- } // eslint-disable-next-line class-methods-use-this
- ;
- _proto.onbeforeevent = function onbeforeevent(event, from, to) {
- var _context10, _context11;
- for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
- payload[_key2 - 3] = arguments[_key2];
- }
- debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
- };
- _proto.onopen = function onopen() {
- this.emit(OPEN);
- };
- _proto.onconnected = function onconnected() {
- this._startConnectionKeeper();
- };
- _proto.onleaveconnected = function onleaveconnected(event, from, to) {
- this._stopConnectionKeeper();
- this._destroyWs();
- if (to === 'offline' || to === 'disconnected') {
- this.emit(DISCONNECT);
- }
- };
- _proto.onpause = function onpause() {
- this.emit(OFFLINE);
- };
- _proto.onbeforeresume = function onbeforeresume() {
- this.emit(ONLINE);
- };
- _proto.onreconnect = function onreconnect() {
- this.emit(RECONNECT);
- };
- _proto.ondisconnected = function ondisconnected(event, from, to) {
- var _context12;
- var _this4 = this;
- var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
- debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
- this.emit(SCHEDULE, attempt, delay);
- if (this.__scheduledRetry) {
- clearTimeout(this.__scheduledRetry);
- }
- this.__scheduledRetry = setTimeout(function () {
- if (_this4.is('disconnected')) {
- _this4.retry(attempt);
- }
- }, delay);
- };
- _proto.onretry = function onretry(event, from, to) {
- var _this5 = this;
- var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- this.emit(RETRY, attempt);
- this._open().then(function () {
- return _this5.can('reconnect') && _this5.reconnect();
- }, function () {
- return _this5.can('fail') && _this5.fail(attempt + 1);
- });
- };
- _proto.onerror = function onerror(event, from, to, error) {
- this.emit(ERROR, error);
- };
- _proto.onclose = function onclose() {
- if (global$1.removeEventListener) {
- if (this.__pause) global$1.removeEventListener('offline', this.__pause);
- if (this.__resume) global$1.removeEventListener('online', this.__resume);
- }
- };
- _proto.checkConnectionAvailability = function checkConnectionAvailability() {
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
- if (!this.is('connected')) {
- var _context13;
- var currentState = this.current;
- console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
- if (this.is('disconnected') || this.is('reconnecting')) {
- console.warn('disconnect and reconnect event should be handled to avoid such calls.');
- }
- throw new Error('Connection unavailable');
- }
- } // jsdoc-ignore-start
- ;
- _proto. // jsdoc-ignore-end
- _ping = function _ping() {
- debug$3('ping');
- try {
- this.ping();
- } catch (error) {
- console.warn("websocket ping error: ".concat(error.message));
- }
- };
- _proto.ping = function ping() {
- if (this._ws.ping) {
- this._ws.ping();
- } else {
- console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
- }
- };
- _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
- var _this6 = this;
- debug$3('_postponeTimeoutTimer');
- this._clearTimeoutTimers();
- this._timeoutTimer = setTimeout(function () {
- debug$3('timeout');
- _this6.disconnect();
- }, TIMEOUT_TIME);
- };
- _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
- if (this._timeoutTimer) {
- clearTimeout(this._timeoutTimer);
- }
- };
- _proto._startConnectionKeeper = function _startConnectionKeeper() {
- debug$3('start connection keeper');
- this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
- var addListener = this._ws.addListener || this._ws.addEventListener;
- if (!addListener) {
- debug$3('connection keeper disabled due to the lack of #addEventListener.');
- return;
- }
- addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
- addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
- this._postponeTimeoutTimer();
- };
- _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
- debug$3('stop connection keeper'); // websockets/ws#489
- var removeListener = this._ws.removeListener || this._ws.removeEventListener;
- if (removeListener) {
- removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
- removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
- this._clearTimeoutTimers();
- }
- if (this._heartbeatTimer) {
- clearInterval(this._heartbeatTimer);
- }
- };
- _proto._handleClose = function _handleClose(event) {
- var _context14;
- debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
- if (this.isFinished()) return;
- this.handleClose(event);
- };
- _proto.handleClose = function handleClose() {
- // reconnect
- this.disconnect();
- } // jsdoc-ignore-start
- ;
- _proto. // jsdoc-ignore-end
- send = function send(data) {
- debug$3('send', data);
- this._ws.send(data);
- };
- _proto._handleMessage = function _handleMessage(event) {
- debug$3('message', event.data);
- this.handleMessage(event.data);
- };
- _proto.handleMessage = function handleMessage(message) {
- this.emit(MESSAGE, message);
- };
- return WebSocketPlus;
- }(EventEmitter), (_applyDecoratedDescriptor(_class.prototype, "_ping", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_ping"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "send", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "send"), _class.prototype)), _class);
- StateMachine.create({
- target: WebSocketPlus.prototype,
- initial: {
- state: 'initialized',
- event: 'init',
- defer: true
- },
- terminal: 'closed',
- events: [{
- name: 'open',
- from: 'initialized',
- to: 'connected'
- }, {
- name: 'disconnect',
- from: 'connected',
- to: 'disconnected'
- }, {
- name: 'retry',
- from: 'disconnected',
- to: 'reconnecting'
- }, {
- name: 'fail',
- from: 'reconnecting',
- to: 'disconnected'
- }, {
- name: 'reconnect',
- from: 'reconnecting',
- to: 'connected'
- }, {
- name: 'pause',
- from: ['connected', 'disconnected', 'reconnecting'],
- to: 'offline'
- }, {}, {
- name: 'resume',
- from: 'offline',
- to: 'disconnected'
- }, {
- name: 'close',
- from: ['connected', 'disconnected', 'reconnecting', 'offline'],
- to: 'closed'
- }, {
- name: 'throw',
- from: '*',
- to: 'error'
- }]
- });
- var error = (0, _freeze.default)({
- 1000: {
- name: 'CLOSE_NORMAL'
- },
- 1006: {
- name: 'CLOSE_ABNORMAL'
- },
- 4100: {
- name: 'APP_NOT_AVAILABLE',
- message: 'App not exists or realtime message service is disabled.'
- },
- 4102: {
- name: 'SIGNATURE_FAILED',
- message: 'Login signature mismatch.'
- },
- 4103: {
- name: 'INVALID_LOGIN',
- message: 'Malformed clientId.'
- },
- 4105: {
- name: 'SESSION_REQUIRED',
- message: 'Message sent before session opened.'
- },
- 4107: {
- name: 'READ_TIMEOUT'
- },
- 4108: {
- name: 'LOGIN_TIMEOUT'
- },
- 4109: {
- name: 'FRAME_TOO_LONG'
- },
- 4110: {
- name: 'INVALID_ORIGIN',
- message: 'Access denied by domain whitelist.'
- },
- 4111: {
- name: 'SESSION_CONFLICT'
- },
- 4112: {
- name: 'SESSION_TOKEN_EXPIRED'
- },
- 4113: {
- name: 'APP_QUOTA_EXCEEDED',
- message: 'The daily active users limit exceeded.'
- },
- 4116: {
- name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
- message: 'Command sent too fast.'
- },
- 4200: {
- name: 'INTERNAL_ERROR',
- message: 'Internal error, please contact LeanCloud for support.'
- },
- 4301: {
- name: 'CONVERSATION_API_FAILED',
- message: 'Upstream Conversatoin API failed, see error.detail for details.'
- },
- 4302: {
- name: 'CONVERSATION_SIGNATURE_FAILED',
- message: 'Conversation action signature mismatch.'
- },
- 4303: {
- name: 'CONVERSATION_NOT_FOUND'
- },
- 4304: {
- name: 'CONVERSATION_FULL'
- },
- 4305: {
- name: 'CONVERSATION_REJECTED_BY_APP',
- message: 'Conversation action rejected by hook.'
- },
- 4306: {
- name: 'CONVERSATION_UPDATE_FAILED'
- },
- 4307: {
- name: 'CONVERSATION_READ_ONLY'
- },
- 4308: {
- name: 'CONVERSATION_NOT_ALLOWED'
- },
- 4309: {
- name: 'CONVERSATION_UPDATE_REJECTED',
- message: 'Conversation update rejected because the client is not a member.'
- },
- 4310: {
- name: 'CONVERSATION_QUERY_FAILED',
- message: 'Conversation query failed because it is too expansive.'
- },
- 4311: {
- name: 'CONVERSATION_LOG_FAILED'
- },
- 4312: {
- name: 'CONVERSATION_LOG_REJECTED',
- message: 'Message query rejected because the client is not a member of the conversation.'
- },
- 4313: {
- name: 'SYSTEM_CONVERSATION_REQUIRED'
- },
- 4314: {
- name: 'NORMAL_CONVERSATION_REQUIRED'
- },
- 4315: {
- name: 'CONVERSATION_BLACKLISTED',
- message: 'Blacklisted in the conversation.'
- },
- 4316: {
- name: 'TRANSIENT_CONVERSATION_REQUIRED'
- },
- 4317: {
- name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
- },
- 4318: {
- name: 'CONVERSATION_API_QUOTA_EXCEEDED',
- message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
- },
- 4323: {
- name: 'TEMPORARY_CONVERSATION_EXPIRED',
- message: 'Temporary conversation expired or does not exist.'
- },
- 4401: {
- name: 'INVALID_MESSAGING_TARGET',
- message: 'Conversation does not exist or client is not a member.'
- },
- 4402: {
- name: 'MESSAGE_REJECTED_BY_APP',
- message: 'Message rejected by hook.'
- },
- 4403: {
- name: 'MESSAGE_OWNERSHIP_REQUIRED'
- },
- 4404: {
- name: 'MESSAGE_NOT_FOUND'
- },
- 4405: {
- name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
- message: 'Message update rejected by hook.'
- },
- 4406: {
- name: 'MESSAGE_EDIT_DISABLED'
- },
- 4407: {
- name: 'MESSAGE_RECALL_DISABLED'
- },
- 5130: {
- name: 'OWNER_PROMOTION_NOT_ALLOWED',
- message: "Updating a member's role to owner is not allowed."
- }
- });
- var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
- return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
- }, {}));
- var createError = function createError(_ref) {
- var code = _ref.code,
- reason = _ref.reason,
- appCode = _ref.appCode,
- detail = _ref.detail,
- errorMessage = _ref.error;
- var message = reason || detail || errorMessage;
- var name = reason;
- if (!message && error[code]) {
- name = error[code].name;
- message = error[code].message || name;
- }
- if (!message) {
- message = "Unknow Error: ".concat(code);
- }
- var err = new Error(message);
- return (0, _assign.default)(err, {
- code: code,
- appCode: appCode,
- detail: detail,
- name: name
- });
- };
- var debug$4 = d('LC:Connection');
- var COMMAND_TIMEOUT = 20000;
- var EXPIRE = (0, _symbol.default)('expire');
- var isIdempotentCommand = function isIdempotentCommand(command) {
- return !(command.cmd === CommandType.direct || command.cmd === CommandType.session && command.op === OpType.open || command.cmd === CommandType.conv && (command.op === OpType.start || command.op === OpType.update || command.op === OpType.members));
- };
- var Connection = /*#__PURE__*/function (_WebSocketPlus) {
- _inheritsLoose(Connection, _WebSocketPlus);
- function Connection(getUrl, _ref) {
- var _context16;
- var _this;
- var format = _ref.format,
- version = _ref.version;
- debug$4('initializing Connection');
- var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
- _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
- _this._protocolFormat = format;
- _this._commands = {};
- _this._serialId = 0;
- return _this;
- }
- var _proto = Connection.prototype;
- _proto.send = /*#__PURE__*/function () {
- var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
- var _this2 = this;
- var waitingForRespond,
- buffer,
- serialId,
- duplicatedCommand,
- message,
- promise,
- _args = arguments;
- return _regeneratorRuntime.wrap(function _callee$(_context) {
- var _context17, _context18;
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
- if (!waitingForRespond) {
- _context.next = 11;
- break;
- }
- if (!isIdempotentCommand(command)) {
- _context.next = 8;
- break;
- }
- buffer = command.toArrayBuffer();
- duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
- var targetBuffer = _ref2.buffer,
- targetCommand = _ref2.command;
- return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
- });
- if (!duplicatedCommand) {
- _context.next = 8;
- break;
- }
- console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
- return _context.abrupt("return", duplicatedCommand.promise);
- case 8:
- this._serialId += 1;
- serialId = this._serialId;
- command.i = serialId;
- // eslint-disable-line no-param-reassign
- case 11:
- if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
- if (this._protocolFormat === 'proto2base64') {
- message = command.toBase64();
- } else if (command.toArrayBuffer) {
- message = command.toArrayBuffer();
- }
- if (message) {
- _context.next = 15;
- break;
- }
- throw new TypeError("".concat(command, " is not a GenericCommand"));
- case 15:
- _WebSocketPlus.prototype.send.call(this, message);
- if (waitingForRespond) {
- _context.next = 18;
- break;
- }
- return _context.abrupt("return", undefined);
- case 18:
- promise = new _promise.default(function (resolve, reject) {
- _this2._commands[serialId] = {
- command: command,
- buffer: buffer,
- resolve: resolve,
- reject: reject,
- timeout: setTimeout(function () {
- if (_this2._commands[serialId]) {
- var _context19;
- if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
- reject(createError({
- error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
- name: 'COMMAND_TIMEOUT'
- }));
- delete _this2._commands[serialId];
- }
- }, COMMAND_TIMEOUT)
- };
- });
- this._commands[serialId].promise = promise;
- return _context.abrupt("return", promise);
- case 21:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function send(_x) {
- return _send.apply(this, arguments);
- }
- return send;
- }();
- _proto.handleMessage = function handleMessage(msg) {
- var message;
- try {
- message = GenericCommand.decode(msg);
- if (debug$4.enabled) debug$4('↓ %O received', trim(message));
- } catch (e) {
- console.warn('Decode message failed:', e.message, msg);
- return;
- }
- var serialId = message.i;
- if (serialId) {
- if (this._commands[serialId]) {
- clearTimeout(this._commands[serialId].timeout);
- if (message.cmd === CommandType.error) {
- this._commands[serialId].reject(createError(message.errorMessage));
- } else {
- this._commands[serialId].resolve(message);
- }
- delete this._commands[serialId];
- } else {
- console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
- }
- } else {
- switch (message.cmd) {
- case CommandType.error:
- {
- this.emit(ERROR, createError(message.errorMessage));
- return;
- }
- case CommandType.goaway:
- {
- this.emit(EXPIRE);
- return;
- }
- default:
- {
- this.emit(MESSAGE, message);
- }
- }
- }
- };
- _proto.ping = function ping() {
- return this.send(new GenericCommand({
- cmd: CommandType.echo
- }))["catch"](function (error) {
- return debug$4('ping failed:', error);
- });
- };
- return Connection;
- }(WebSocketPlus);
- var debug$5 = d('LC:request');
- var request = function request(_ref) {
- var _ref$method = _ref.method,
- method = _ref$method === void 0 ? 'GET' : _ref$method,
- _url = _ref.url,
- query = _ref.query,
- headers = _ref.headers,
- data = _ref.data,
- time = _ref.timeout;
- var url = _url;
- if (query) {
- var _context20, _context21, _context23;
- var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
- var _context22;
- var value = query[key];
- if (value === undefined) return undefined;
- var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
- return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
- })).call(_context20, function (qs) {
- return qs;
- }).join('&');
- url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
- }
- debug$5('Req: %O %O %O', method, url, {
- headers: headers,
- data: data
- });
- var request = getAdapter('request');
- var promise = request(url, {
- method: method,
- headers: headers,
- data: data
- }).then(function (response) {
- if (response.ok === false) {
- var error = createError(response.data);
- error.response = response;
- throw error;
- }
- debug$5('Res: %O %O %O', url, response.status, response.data);
- return response.data;
- })["catch"](function (error) {
- if (error.response) {
- debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
- }
- throw error;
- });
- return time ? promiseTimeout.timeout(promise, time) : promise;
- };
- var applyDecorators = function applyDecorators(decorators, target) {
- if (decorators) {
- decorators.forEach(function (decorator) {
- try {
- decorator(target);
- } catch (error) {
- if (decorator._pluginName) {
- error.message += "[".concat(decorator._pluginName, "]");
- }
- throw error;
- }
- });
- }
- };
- var applyDispatcher = function applyDispatcher(dispatchers, payload) {
- var _context24;
- return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
- return resultPromise.then(function (shouldDispatch) {
- return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
- })["catch"](function (error) {
- if (dispatcher._pluginName) {
- // eslint-disable-next-line no-param-reassign
- error.message += "[".concat(dispatcher._pluginName, "]");
- }
- throw error;
- });
- }, _promise.default.resolve(true));
- };
- var version = "5.0.0-rc.7";
- function ownKeys$2(object, enumerableOnly) {
- var keys = (0, _keys.default)(object);
- if (_getOwnPropertySymbols.default) {
- var symbols = (0, _getOwnPropertySymbols.default)(object);
- if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
- return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
- });
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread$2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys$2(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (_getOwnPropertyDescriptors.default) {
- (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
- } else {
- ownKeys$2(Object(source)).forEach(function (key) {
- (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
- });
- }
- }
- return target;
- }
- var debug$6 = d('LC:Realtime');
- var routerCache = new Cache('push-router');
- var initializedApp = {};
- var Realtime = /*#__PURE__*/function (_EventEmitter) {
- _inheritsLoose(Realtime, _EventEmitter);
- /**
- * @extends EventEmitter
- * @param {Object} options
- * @param {String} options.appId
- * @param {String} options.appKey (since 4.0.0)
- * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
- * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
- * 适用于 WebSocket 实现不支持二进制数据格式的情况
- * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
- * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
- * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
- */
- function Realtime(_ref) {
- var _context25;
- var _this2;
- var plugins = _ref.plugins,
- options = _objectWithoutProperties(_ref, ["plugins"]);
- debug$6('initializing Realtime %s %O', version, options);
- _this2 = _EventEmitter.call(this) || this;
- var appId = options.appId;
- if (typeof appId !== 'string') {
- throw new TypeError("appId [".concat(appId, "] is not a string"));
- }
- if (initializedApp[appId]) {
- throw new Error("App [".concat(appId, "] is already initialized."));
- }
- initializedApp[appId] = true;
- if (typeof options.appKey !== 'string') {
- throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
- }
- if (isCNApp(appId)) {
- if (!options.server) {
- throw new TypeError("server option is required for apps from CN region");
- }
- }
- _this2._options = _objectSpread$2({
- appId: undefined,
- appKey: undefined,
- noBinary: false,
- ssl: true,
- RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
- }, options);
- _this2._cache = new Cache('endpoints');
- var _this = internal(_assertThisInitialized(_this2));
- _this.clients = new _set.default();
- _this.pendingClients = new _set.default();
- var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
- debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
- return plugin.name;
- }));
- _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
- (0, _keys.default)(plugin).forEach(function (hook) {
- if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
- var _context26;
- if (plugin.name) {
- ensureArray(plugin[hook]).forEach(function (value) {
- // eslint-disable-next-line no-param-reassign
- value._pluginName = plugin.name;
- });
- } // eslint-disable-next-line no-param-reassign
- result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
- }
- });
- return result;
- }, {}); // onRealtimeCreate hook
- applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
- return _this2;
- }
- var _proto = Realtime.prototype;
- _proto._request = /*#__PURE__*/function () {
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
- var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
- return _regeneratorRuntime.wrap(function _callee$(_context) {
- var _context27, _context28;
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- method = _ref2.method, _url = _ref2.url, _ref2$version = _ref2.version, version = _ref2$version === void 0 ? '1.1' : _ref2$version, path = _ref2.path, query = _ref2.query, headers = _ref2.headers, data = _ref2.data;
- url = _url;
- if (url) {
- _context.next = 9;
- break;
- }
- _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
- _context.next = 6;
- return this.constructor._getServerUrls({
- appId: appId,
- server: server
- });
- case 6:
- _yield$this$construct = _context.sent;
- api = _yield$this$construct.api;
- url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
- case 9:
- return _context.abrupt("return", request({
- url: url,
- method: method,
- query: query,
- headers: _objectSpread$2({
- 'X-LC-Id': this._options.appId,
- 'X-LC-Key': this._options.appKey
- }, headers),
- data: data
- }));
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function _request(_x) {
- return _request2.apply(this, arguments);
- }
- return _request;
- }();
- _proto._open = function _open() {
- var _this3 = this;
- if (this._openPromise) return this._openPromise;
- var format = 'protobuf2';
- if (this._options.noBinary) {
- // 不发送 binary data,fallback to base64 string
- format = 'proto2base64';
- }
- var version = 3;
- var protocol = {
- format: format,
- version: version
- };
- this._openPromise = new _promise.default(function (resolve, reject) {
- debug$6('No connection established, create a new one.');
- var connection = new Connection(function () {
- return _this3._getRTMServers(_this3._options);
- }, protocol);
- connection.on(OPEN, function () {
- return resolve(connection);
- }).on(ERROR, function (error) {
- delete _this3._openPromise;
- reject(error);
- }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- debug$6('Connection expired. Refresh endpoints.');
- _this3._cache.set('endpoints', null, 0);
- _context2.next = 4;
- return _this3._getRTMServers(_this3._options);
- case 4:
- connection.urls = _context2.sent;
- connection.disconnect();
- case 6:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
- /**
- * 连接断开。
- * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
- * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
- * @event Realtime#DISCONNECT
- */
- /**
- * 计划在一段时间后尝试重新连接
- * @event Realtime#SCHEDULE
- * @param {Number} attempt 尝试重连的次数
- * @param {Number} delay 延迟的毫秒数
- */
- /**
- * 正在尝试重新连接
- * @event Realtime#RETRY
- * @param {Number} attempt 尝试重连的次数
- */
- /**
- * 连接恢复正常。
- * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
- * @event Realtime#RECONNECT
- */
- /**
- * 客户端连接断开
- * @event IMClient#DISCONNECT
- * @see Realtime#event:DISCONNECT
- * @since 3.2.0
- */
- /**
- * 计划在一段时间后尝试重新连接
- * @event IMClient#SCHEDULE
- * @param {Number} attempt 尝试重连的次数
- * @param {Number} delay 延迟的毫秒数
- * @since 3.2.0
- */
- /**
- * 正在尝试重新连接
- * @event IMClient#RETRY
- * @param {Number} attempt 尝试重连的次数
- * @since 3.2.0
- */
- /**
- * 客户端进入离线状态。
- * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
- * @event Realtime#OFFLINE
- * @since 3.4.0
- */
- /**
- * 客户端恢复在线状态
- * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
- * @event Realtime#ONLINE
- * @since 3.4.0
- */
- /**
- * 进入离线状态。
- * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
- * @event IMClient#OFFLINE
- * @since 3.4.0
- */
- /**
- * 恢复在线状态
- * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
- * @event IMClient#ONLINE
- * @since 3.4.0
- */
- // event proxy
- [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
- return connection.on(event, function () {
- var _context29;
- for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
- payload[_key] = arguments[_key];
- }
- debug$6("".concat(event, " event emitted. %o"), payload);
- _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
- if (event !== RECONNECT) {
- internal(_this3).clients.forEach(function (client) {
- var _context30;
- client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
- });
- }
- });
- }); // override handleClose
- connection.handleClose = function handleClose(event) {
- var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
- return errorCode === event.code;
- });
- if (isFatal) {
- // in these cases, SDK should throw.
- this["throw"](createError(event));
- } else {
- // reconnect
- this.disconnect();
- }
- };
- internal(_this3).connection = connection;
- });
- return this._openPromise;
- };
- _proto._getRTMServers = /*#__PURE__*/function () {
- var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
- var info, cachedEndPoints, _info, server, secondary, ttl;
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- if (!options.RTMServers) {
- _context3.next = 2;
- break;
- }
- return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
- case 2:
- cachedEndPoints = this._cache.get('endpoints');
- if (!cachedEndPoints) {
- _context3.next = 7;
- break;
- }
- info = cachedEndPoints;
- _context3.next = 14;
- break;
- case 7:
- _context3.next = 9;
- return this.constructor._fetchRTMServers(options);
- case 9:
- info = _context3.sent;
- _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
- if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
- _context3.next = 13;
- break;
- }
- throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
- case 13:
- this._cache.set('endpoints', info, info.ttl * 1000);
- case 14:
- debug$6('endpoint info: %O', info);
- return _context3.abrupt("return", [info.server, info.secondary]);
- case 16:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function _getRTMServers(_x2) {
- return _getRTMServers2.apply(this, arguments);
- }
- return _getRTMServers;
- }();
- Realtime._getServerUrls = /*#__PURE__*/function () {
- var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
- var appId, server, cachedRouter, defaultProtocol;
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- appId = _ref4.appId, server = _ref4.server;
- debug$6('fetch server urls');
- if (!server) {
- _context4.next = 6;
- break;
- }
- if (!(typeof server !== 'string')) {
- _context4.next = 5;
- break;
- }
- return _context4.abrupt("return", server);
- case 5:
- return _context4.abrupt("return", {
- RTMRouter: server,
- api: server
- });
- case 6:
- cachedRouter = routerCache.get(appId);
- if (!cachedRouter) {
- _context4.next = 9;
- break;
- }
- return _context4.abrupt("return", cachedRouter);
- case 9:
- defaultProtocol = 'https://';
- return _context4.abrupt("return", request({
- url: 'https://app-router.com/2/route',
- query: {
- appId: appId
- },
- timeout: 20000
- }).then(tap(debug$6)).then(function (_ref5) {
- var _context31, _context32;
- var RTMRouterServer = _ref5.rtm_router_server,
- APIServer = _ref5.api_server,
- _ref5$ttl = _ref5.ttl,
- ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
- if (!RTMRouterServer) {
- throw new Error('rtm router not exists');
- }
- var serverUrls = {
- RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
- api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
- };
- routerCache.set(appId, serverUrls, ttl * 1000);
- return serverUrls;
- })["catch"](function () {
- var _context33, _context34, _context35, _context36;
- var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
- var domain = 'lncldglobal.com';
- return {
- RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
- api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
- };
- }));
- case 11:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
- }));
- function _getServerUrls(_x3) {
- return _getServerUrls2.apply(this, arguments);
- }
- return _getServerUrls;
- }();
- Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
- var appId = _ref6.appId,
- ssl = _ref6.ssl,
- server = _ref6.server,
- RTMServerName = _ref6.RTMServerName;
- debug$6('fetch endpoint info');
- return this._getServerUrls({
- appId: appId,
- server: server
- }).then(tap(debug$6)).then(function (_ref7) {
- var RTMRouter = _ref7.RTMRouter;
- return request({
- url: "".concat(RTMRouter, "/v1/route"),
- query: {
- appId: appId,
- secure: ssl,
- features: isWeapp ? 'wechat' : undefined,
- server: RTMServerName,
- _t: Date.now()
- },
- timeout: 20000
- }).then(tap(debug$6));
- });
- };
- _proto._close = function _close() {
- if (this._openPromise) {
- this._openPromise.then(function (connection) {
- return connection.close();
- });
- }
- delete this._openPromise;
- }
- /**
- * 手动进行重连。
- * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
- * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
- */
- ;
- _proto.retry = function retry() {
- var _internal = internal(this),
- connection = _internal.connection;
- if (!connection) {
- throw new Error('no connection established');
- }
- if (connection.cannot('retry')) {
- throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
- }
- return connection.retry();
- }
- /**
- * 暂停,使 SDK 进入离线状态。
- * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
- * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
- *
- * @since 3.4.0
- * @see Realtime#event:OFFLINE
- */
- ;
- _proto.pause = function pause() {
- // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
- // 因此不像 retry,这个方法应该尽可能 loose
- var _internal2 = internal(this),
- connection = _internal2.connection;
- if (!connection) return;
- if (connection.can('pause')) connection.pause();
- }
- /**
- * 恢复在线状态。
- * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
- *
- * @since 3.4.0
- * @see Realtime#event:ONLINE
- */
- ;
- _proto.resume = function resume() {
- // 与 pause 一样,这个方法应该尽可能 loose
- var _internal3 = internal(this),
- connection = _internal3.connection;
- if (!connection) return;
- if (connection.can('resume')) connection.resume();
- };
- _proto._registerPending = function _registerPending(value) {
- internal(this).pendingClients.add(value);
- };
- _proto._deregisterPending = function _deregisterPending(client) {
- internal(this).pendingClients["delete"](client);
- };
- _proto._register = function _register(client) {
- internal(this).clients.add(client);
- };
- _proto._deregister = function _deregister(client) {
- var _this = internal(this);
- _this.clients["delete"](client);
- if (_this.clients.size + _this.pendingClients.size === 0) {
- this._close();
- }
- };
- _proto._dispatchCommand = function _dispatchCommand(command) {
- return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
- // no plugin handled this command
- if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
- return false;
- });
- };
- return Realtime;
- }(EventEmitter); // For test purpose only
- var polyfilledPromise = _promise.default;
- exports.EventEmitter = EventEmitter;
- exports.Promise = polyfilledPromise;
- exports.Protocals = message;
- exports.Protocols = message;
- exports.Realtime = Realtime;
- exports.debug = debug$2;
- exports.getAdapter = getAdapter;
- exports.setAdapters = setAdapters;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
- /***/ }),
- /* 590 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(591);
- /***/ }),
- /* 591 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(592);
- module.exports = parent;
- /***/ }),
- /* 592 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(593);
- var path = __webpack_require__(5);
- module.exports = path.Object.freeze;
- /***/ }),
- /* 593 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var FREEZING = __webpack_require__(262);
- var fails = __webpack_require__(2);
- var isObject = __webpack_require__(11);
- var onFreeze = __webpack_require__(94).onFreeze;
- // eslint-disable-next-line es-x/no-object-freeze -- safe
- var $freeze = Object.freeze;
- var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
- // `Object.freeze` method
- // https://tc39.es/ecma262/#sec-object.freeze
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
- freeze: function freeze(it) {
- return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
- }
- });
- /***/ }),
- /* 594 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(595);
- /***/ }),
- /* 595 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(596);
- module.exports = parent;
- /***/ }),
- /* 596 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(597);
- var path = __webpack_require__(5);
- module.exports = path.Object.getOwnPropertyDescriptors;
- /***/ }),
- /* 597 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var DESCRIPTORS = __webpack_require__(14);
- var ownKeys = __webpack_require__(162);
- var toIndexedObject = __webpack_require__(32);
- var getOwnPropertyDescriptorModule = __webpack_require__(62);
- var createProperty = __webpack_require__(91);
- // `Object.getOwnPropertyDescriptors` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
- $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
- getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
- var O = toIndexedObject(object);
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var keys = ownKeys(O);
- var result = {};
- var index = 0;
- var key, descriptor;
- while (keys.length > index) {
- descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
- if (descriptor !== undefined) createProperty(result, key, descriptor);
- }
- return result;
- }
- });
- /***/ }),
- /* 598 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(599);
- /***/ }),
- /* 599 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(600);
- module.exports = parent;
- /***/ }),
- /* 600 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(601);
- var path = __webpack_require__(5);
- var Object = path.Object;
- var defineProperties = module.exports = function defineProperties(T, D) {
- return Object.defineProperties(T, D);
- };
- if (Object.defineProperties.sham) defineProperties.sham = true;
- /***/ }),
- /* 601 */
- /***/ (function(module, exports, __webpack_require__) {
- var $ = __webpack_require__(0);
- var DESCRIPTORS = __webpack_require__(14);
- var defineProperties = __webpack_require__(128).f;
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- // eslint-disable-next-line es-x/no-object-defineproperties -- safe
- $({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
- defineProperties: defineProperties
- });
- /***/ }),
- /* 602 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(603);
- /***/ }),
- /* 603 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(604);
- module.exports = parent;
- /***/ }),
- /* 604 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototypeOf = __webpack_require__(19);
- var method = __webpack_require__(605);
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.reduce;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
- };
- /***/ }),
- /* 605 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(606);
- var entryVirtual = __webpack_require__(40);
- module.exports = entryVirtual('Array').reduce;
- /***/ }),
- /* 606 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var $ = __webpack_require__(0);
- var $reduce = __webpack_require__(607).left;
- var arrayMethodIsStrict = __webpack_require__(231);
- var CHROME_VERSION = __webpack_require__(77);
- var IS_NODE = __webpack_require__(107);
- var STRICT_METHOD = arrayMethodIsStrict('reduce');
- // Chrome 80-82 has a critical bug
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
- var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
- reduce: function reduce(callbackfn /* , initialValue */) {
- var length = arguments.length;
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
- }
- });
- /***/ }),
- /* 607 */
- /***/ (function(module, exports, __webpack_require__) {
- var aCallable = __webpack_require__(31);
- var toObject = __webpack_require__(34);
- var IndexedObject = __webpack_require__(95);
- var lengthOfArrayLike = __webpack_require__(41);
- var $TypeError = TypeError;
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
- var createMethod = function (IS_RIGHT) {
- return function (that, callbackfn, argumentsLength, memo) {
- aCallable(callbackfn);
- var O = toObject(that);
- var self = IndexedObject(O);
- var length = lengthOfArrayLike(O);
- var index = IS_RIGHT ? length - 1 : 0;
- var i = IS_RIGHT ? -1 : 1;
- if (argumentsLength < 2) while (true) {
- if (index in self) {
- memo = self[index];
- index += i;
- break;
- }
- index += i;
- if (IS_RIGHT ? index < 0 : length <= index) {
- throw $TypeError('Reduce of empty array with no initial value');
- }
- }
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
- memo = callbackfn(memo, self[index], index, O);
- }
- return memo;
- };
- };
- module.exports = {
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- left: createMethod(false),
- // `Array.prototype.reduceRight` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
- right: createMethod(true)
- };
- /***/ }),
- /* 608 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(609);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 609 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(53);
- __webpack_require__(610);
- __webpack_require__(55);
- var path = __webpack_require__(5);
- module.exports = path.Set;
- /***/ }),
- /* 610 */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- __webpack_require__(611);
- /***/ }),
- /* 611 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var collection = __webpack_require__(155);
- var collectionStrong = __webpack_require__(263);
- // `Set` constructor
- // https://tc39.es/ecma262/#sec-set-objects
- collection('Set', function (init) {
- return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
- }, collectionStrong);
- /***/ }),
- /* 612 */
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
- Copyright 2013 Daniel Wirtz <dcode@dcode.io>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
- * Released under the Apache License, Version 2.0
- * see: https://github.com/dcodeIO/protobuf.js for details
- */
- (function(global, factory) {
- /* AMD */ if (true)
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(613)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
- module["exports"] = factory(require("bytebuffer"), true);
- /* Global */ else
- (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
- })(this, function(ByteBuffer, isCommonJS) {
- "use strict";
- /**
- * The ProtoBuf namespace.
- * @exports ProtoBuf
- * @namespace
- * @expose
- */
- var ProtoBuf = {};
- /**
- * @type {!function(new: ByteBuffer, ...[*])}
- * @expose
- */
- ProtoBuf.ByteBuffer = ByteBuffer;
- /**
- * @type {?function(new: Long, ...[*])}
- * @expose
- */
- ProtoBuf.Long = ByteBuffer.Long || null;
- /**
- * ProtoBuf.js version.
- * @type {string}
- * @const
- * @expose
- */
- ProtoBuf.VERSION = "5.0.3";
- /**
- * Wire types.
- * @type {Object.<string,number>}
- * @const
- * @expose
- */
- ProtoBuf.WIRE_TYPES = {};
- /**
- * Varint wire type.
- * @type {number}
- * @expose
- */
- ProtoBuf.WIRE_TYPES.VARINT = 0;
- /**
- * Fixed 64 bits wire type.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.WIRE_TYPES.BITS64 = 1;
- /**
- * Length delimited wire type.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.WIRE_TYPES.LDELIM = 2;
- /**
- * Start group wire type.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
- /**
- * End group wire type.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
- /**
- * Fixed 32 bits wire type.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.WIRE_TYPES.BITS32 = 5;
- /**
- * Packable wire types.
- * @type {!Array.<number>}
- * @const
- * @expose
- */
- ProtoBuf.PACKABLE_WIRE_TYPES = [
- ProtoBuf.WIRE_TYPES.VARINT,
- ProtoBuf.WIRE_TYPES.BITS64,
- ProtoBuf.WIRE_TYPES.BITS32
- ];
- /**
- * Types.
- * @dict
- * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
- * @const
- * @expose
- */
- ProtoBuf.TYPES = {
- // According to the protobuf spec.
- "int32": {
- name: "int32",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: 0
- },
- "uint32": {
- name: "uint32",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: 0
- },
- "sint32": {
- name: "sint32",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: 0
- },
- "int64": {
- name: "int64",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
- },
- "uint64": {
- name: "uint64",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
- },
- "sint64": {
- name: "sint64",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
- },
- "bool": {
- name: "bool",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: false
- },
- "double": {
- name: "double",
- wireType: ProtoBuf.WIRE_TYPES.BITS64,
- defaultValue: 0
- },
- "string": {
- name: "string",
- wireType: ProtoBuf.WIRE_TYPES.LDELIM,
- defaultValue: ""
- },
- "bytes": {
- name: "bytes",
- wireType: ProtoBuf.WIRE_TYPES.LDELIM,
- defaultValue: null // overridden in the code, must be a unique instance
- },
- "fixed32": {
- name: "fixed32",
- wireType: ProtoBuf.WIRE_TYPES.BITS32,
- defaultValue: 0
- },
- "sfixed32": {
- name: "sfixed32",
- wireType: ProtoBuf.WIRE_TYPES.BITS32,
- defaultValue: 0
- },
- "fixed64": {
- name: "fixed64",
- wireType: ProtoBuf.WIRE_TYPES.BITS64,
- defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
- },
- "sfixed64": {
- name: "sfixed64",
- wireType: ProtoBuf.WIRE_TYPES.BITS64,
- defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
- },
- "float": {
- name: "float",
- wireType: ProtoBuf.WIRE_TYPES.BITS32,
- defaultValue: 0
- },
- "enum": {
- name: "enum",
- wireType: ProtoBuf.WIRE_TYPES.VARINT,
- defaultValue: 0
- },
- "message": {
- name: "message",
- wireType: ProtoBuf.WIRE_TYPES.LDELIM,
- defaultValue: null
- },
- "group": {
- name: "group",
- wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
- defaultValue: null
- }
- };
- /**
- * Valid map key types.
- * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
- * @const
- * @expose
- */
- ProtoBuf.MAP_KEY_TYPES = [
- ProtoBuf.TYPES["int32"],
- ProtoBuf.TYPES["sint32"],
- ProtoBuf.TYPES["sfixed32"],
- ProtoBuf.TYPES["uint32"],
- ProtoBuf.TYPES["fixed32"],
- ProtoBuf.TYPES["int64"],
- ProtoBuf.TYPES["sint64"],
- ProtoBuf.TYPES["sfixed64"],
- ProtoBuf.TYPES["uint64"],
- ProtoBuf.TYPES["fixed64"],
- ProtoBuf.TYPES["bool"],
- ProtoBuf.TYPES["string"],
- ProtoBuf.TYPES["bytes"]
- ];
- /**
- * Minimum field id.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.ID_MIN = 1;
- /**
- * Maximum field id.
- * @type {number}
- * @const
- * @expose
- */
- ProtoBuf.ID_MAX = 0x1FFFFFFF;
- /**
- * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
- * Must be set prior to parsing.
- * @type {boolean}
- * @expose
- */
- ProtoBuf.convertFieldsToCamelCase = false;
- /**
- * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
- * setting this to `false` prior to building messages.
- * @type {boolean}
- * @expose
- */
- ProtoBuf.populateAccessors = true;
- /**
- * By default, messages are populated with default values if a field is not present on the wire. To disable
- * this behavior, set this setting to `false`.
- * @type {boolean}
- * @expose
- */
- ProtoBuf.populateDefaults = true;
- /**
- * @alias ProtoBuf.Util
- * @expose
- */
- ProtoBuf.Util = (function() {
- "use strict";
- /**
- * ProtoBuf utilities.
- * @exports ProtoBuf.Util
- * @namespace
- */
- var Util = {};
- /**
- * Flag if running in node or not.
- * @type {boolean}
- * @const
- * @expose
- */
- Util.IS_NODE = !!(
- typeof process === 'object' && process+'' === '[object process]' && !process['browser']
- );
- /**
- * Constructs a XMLHttpRequest object.
- * @return {XMLHttpRequest}
- * @throws {Error} If XMLHttpRequest is not supported
- * @expose
- */
- Util.XHR = function() {
- // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
- var XMLHttpFactories = [
- function () {return new XMLHttpRequest()},
- function () {return new ActiveXObject("Msxml2.XMLHTTP")},
- function () {return new ActiveXObject("Msxml3.XMLHTTP")},
- function () {return new ActiveXObject("Microsoft.XMLHTTP")}
- ];
- /** @type {?XMLHttpRequest} */
- var xhr = null;
- for (var i=0;i<XMLHttpFactories.length;i++) {
- try { xhr = XMLHttpFactories[i](); }
- catch (e) { continue; }
- break;
- }
- if (!xhr)
- throw Error("XMLHttpRequest is not supported");
- return xhr;
- };
- /**
- * Fetches a resource.
- * @param {string} path Resource path
- * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
- * be fetched synchronously. If the request failed, contents will be null.
- * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
- * @expose
- */
- Util.fetch = function(path, callback) {
- if (callback && typeof callback != 'function')
- callback = null;
- if (Util.IS_NODE) {
- var fs = __webpack_require__(615);
- if (callback) {
- fs.readFile(path, function(err, data) {
- if (err)
- callback(null);
- else
- callback(""+data);
- });
- } else
- try {
- return fs.readFileSync(path);
- } catch (e) {
- return null;
- }
- } else {
- var xhr = Util.XHR();
- xhr.open('GET', path, callback ? true : false);
- // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
- xhr.setRequestHeader('Accept', 'text/plain');
- if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
- if (callback) {
- xhr.onreadystatechange = function() {
- if (xhr.readyState != 4) return;
- if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
- callback(xhr.responseText);
- else
- callback(null);
- };
- if (xhr.readyState == 4)
- return;
- xhr.send(null);
- } else {
- xhr.send(null);
- if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
- return xhr.responseText;
- return null;
- }
- }
- };
- /**
- * Converts a string to camel case.
- * @param {string} str
- * @returns {string}
- * @expose
- */
- Util.toCamelCase = function(str) {
- return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
- return $1.toUpperCase();
- });
- };
- return Util;
- })();
- /**
- * Language expressions.
- * @type {!Object.<string,!RegExp>}
- * @expose
- */
- ProtoBuf.Lang = {
- // Characters always ending a statement
- DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
- // Field rules
- RULE: /^(?:required|optional|repeated|map)$/,
- // Field types
- TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
- // Names
- NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
- // Type definitions
- TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
- // Type references
- TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
- // Fully qualified type references
- FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
- // All numbers
- NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
- // Decimal numbers
- NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
- // Hexadecimal numbers
- NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
- // Octal numbers
- NUMBER_OCT: /^0[0-7]+$/,
- // Floating point numbers
- NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
- // Booleans
- BOOL: /^(?:true|false)$/i,
- // Id numbers
- ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
- // Negative id numbers (enum values)
- NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
- // Whitespaces
- WHITESPACE: /\s/,
- // All strings
- STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
- // Double quoted strings
- STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
- // Single quoted strings
- STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
- };
- /**
- * @alias ProtoBuf.Reflect
- * @expose
- */
- ProtoBuf.Reflect = (function(ProtoBuf) {
- "use strict";
- /**
- * Reflection types.
- * @exports ProtoBuf.Reflect
- * @namespace
- */
- var Reflect = {};
- /**
- * Constructs a Reflect base class.
- * @exports ProtoBuf.Reflect.T
- * @constructor
- * @abstract
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {?ProtoBuf.Reflect.T} parent Parent object
- * @param {string} name Object name
- */
- var T = function(builder, parent, name) {
- /**
- * Builder reference.
- * @type {!ProtoBuf.Builder}
- * @expose
- */
- this.builder = builder;
- /**
- * Parent object.
- * @type {?ProtoBuf.Reflect.T}
- * @expose
- */
- this.parent = parent;
- /**
- * Object name in namespace.
- * @type {string}
- * @expose
- */
- this.name = name;
- /**
- * Fully qualified class name
- * @type {string}
- * @expose
- */
- this.className;
- };
- /**
- * @alias ProtoBuf.Reflect.T.prototype
- * @inner
- */
- var TPrototype = T.prototype;
- /**
- * Returns the fully qualified name of this object.
- * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
- * @expose
- */
- TPrototype.fqn = function() {
- var name = this.name,
- ptr = this;
- do {
- ptr = ptr.parent;
- if (ptr == null)
- break;
- name = ptr.name+"."+name;
- } while (true);
- return name;
- };
- /**
- * Returns a string representation of this Reflect object (its fully qualified name).
- * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
- * @return String representation
- * @expose
- */
- TPrototype.toString = function(includeClass) {
- return (includeClass ? this.className + " " : "") + this.fqn();
- };
- /**
- * Builds this type.
- * @throws {Error} If this type cannot be built directly
- * @expose
- */
- TPrototype.build = function() {
- throw Error(this.toString(true)+" cannot be built directly");
- };
- /**
- * @alias ProtoBuf.Reflect.T
- * @expose
- */
- Reflect.T = T;
- /**
- * Constructs a new Namespace.
- * @exports ProtoBuf.Reflect.Namespace
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
- * @param {string} name Namespace name
- * @param {Object.<string,*>=} options Namespace options
- * @param {string?} syntax The syntax level of this definition (e.g., proto3)
- * @constructor
- * @extends ProtoBuf.Reflect.T
- */
- var Namespace = function(builder, parent, name, options, syntax) {
- T.call(this, builder, parent, name);
- /**
- * @override
- */
- this.className = "Namespace";
- /**
- * Children inside the namespace.
- * @type {!Array.<ProtoBuf.Reflect.T>}
- */
- this.children = [];
- /**
- * Options.
- * @type {!Object.<string, *>}
- */
- this.options = options || {};
- /**
- * Syntax level (e.g., proto2 or proto3).
- * @type {!string}
- */
- this.syntax = syntax || "proto2";
- };
- /**
- * @alias ProtoBuf.Reflect.Namespace.prototype
- * @inner
- */
- var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
- /**
- * Returns an array of the namespace's children.
- * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
- * @return {Array.<ProtoBuf.Reflect.T>}
- * @expose
- */
- NamespacePrototype.getChildren = function(type) {
- type = type || null;
- if (type == null)
- return this.children.slice();
- var children = [];
- for (var i=0, k=this.children.length; i<k; ++i)
- if (this.children[i] instanceof type)
- children.push(this.children[i]);
- return children;
- };
- /**
- * Adds a child to the namespace.
- * @param {ProtoBuf.Reflect.T} child Child
- * @throws {Error} If the child cannot be added (duplicate)
- * @expose
- */
- NamespacePrototype.addChild = function(child) {
- var other;
- if (other = this.getChild(child.name)) {
- // Try to revert camelcase transformation on collision
- if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
- other.name = other.originalName; // Revert previous first (effectively keeps both originals)
- else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
- child.name = child.originalName;
- else
- throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
- }
- this.children.push(child);
- };
- /**
- * Gets a child by its name or id.
- * @param {string|number} nameOrId Child name or id
- * @return {?ProtoBuf.Reflect.T} The child or null if not found
- * @expose
- */
- NamespacePrototype.getChild = function(nameOrId) {
- var key = typeof nameOrId === 'number' ? 'id' : 'name';
- for (var i=0, k=this.children.length; i<k; ++i)
- if (this.children[i][key] === nameOrId)
- return this.children[i];
- return null;
- };
- /**
- * Resolves a reflect object inside of this namespace.
- * @param {string|!Array.<string>} qn Qualified name to resolve
- * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
- * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
- * @expose
- */
- NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
- var part = typeof qn === 'string' ? qn.split(".") : qn,
- ptr = this,
- i = 0;
- if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
- while (ptr.parent !== null)
- ptr = ptr.parent;
- i++;
- }
- var child;
- do {
- do {
- if (!(ptr instanceof Reflect.Namespace)) {
- ptr = null;
- break;
- }
- child = ptr.getChild(part[i]);
- if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
- ptr = null;
- break;
- }
- ptr = child; i++;
- } while (i < part.length);
- if (ptr != null)
- break; // Found
- // Else search the parent
- if (this.parent !== null)
- return this.parent.resolve(qn, excludeNonNamespace);
- } while (ptr != null);
- return ptr;
- };
- /**
- * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
- * @param {!ProtoBuf.Reflect.T} t Reflection type
- * @returns {string} The shortest qualified name or, if there is none, the fqn
- * @expose
- */
- NamespacePrototype.qn = function(t) {
- var part = [], ptr = t;
- do {
- part.unshift(ptr.name);
- ptr = ptr.parent;
- } while (ptr !== null);
- for (var len=1; len <= part.length; len++) {
- var qn = part.slice(part.length-len);
- if (t === this.resolve(qn, t instanceof Reflect.Namespace))
- return qn.join(".");
- }
- return t.fqn();
- };
- /**
- * Builds the namespace and returns the runtime counterpart.
- * @return {Object.<string,Function|Object>} Runtime namespace
- * @expose
- */
- NamespacePrototype.build = function() {
- /** @dict */
- var ns = {};
- var children = this.children;
- for (var i=0, k=children.length, child; i<k; ++i) {
- child = children[i];
- if (child instanceof Namespace)
- ns[child.name] = child.build();
- }
- if (Object.defineProperty)
- Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
- return ns;
- };
- /**
- * Builds the namespace's '$options' property.
- * @return {Object.<string,*>}
- */
- NamespacePrototype.buildOpt = function() {
- var opt = {},
- keys = Object.keys(this.options);
- for (var i=0, k=keys.length; i<k; ++i) {
- var key = keys[i],
- val = this.options[keys[i]];
- // TODO: Options are not resolved, yet.
- // if (val instanceof Namespace) {
- // opt[key] = val.build();
- // } else {
- opt[key] = val;
- // }
- }
- return opt;
- };
- /**
- * Gets the value assigned to the option with the specified name.
- * @param {string=} name Returns the option value if specified, otherwise all options are returned.
- * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
- */
- NamespacePrototype.getOption = function(name) {
- if (typeof name === 'undefined')
- return this.options;
- return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
- };
- /**
- * @alias ProtoBuf.Reflect.Namespace
- * @expose
- */
- Reflect.Namespace = Namespace;
- /**
- * Constructs a new Element implementation that checks and converts values for a
- * particular field type, as appropriate.
- *
- * An Element represents a single value: either the value of a singular field,
- * or a value contained in one entry of a repeated field or map field. This
- * class does not implement these higher-level concepts; it only encapsulates
- * the low-level typechecking and conversion.
- *
- * @exports ProtoBuf.Reflect.Element
- * @param {{name: string, wireType: number}} type Resolved data type
- * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
- * (e.g. submessage field).
- * @param {boolean} isMapKey Is this element a Map key? The value will be
- * converted to string form if so.
- * @param {string} syntax Syntax level of defining message type, e.g.,
- * proto2 or proto3.
- * @param {string} name Name of the field containing this element (for error
- * messages)
- * @constructor
- */
- var Element = function(type, resolvedType, isMapKey, syntax, name) {
- /**
- * Element type, as a string (e.g., int32).
- * @type {{name: string, wireType: number}}
- */
- this.type = type;
- /**
- * Element type reference to submessage or enum definition, if needed.
- * @type {ProtoBuf.Reflect.T|null}
- */
- this.resolvedType = resolvedType;
- /**
- * Element is a map key.
- * @type {boolean}
- */
- this.isMapKey = isMapKey;
- /**
- * Syntax level of defining message type, e.g., proto2 or proto3.
- * @type {string}
- */
- this.syntax = syntax;
- /**
- * Name of the field containing this element (for error messages)
- * @type {string}
- */
- this.name = name;
- if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
- throw Error("Invalid map key type: " + type.name);
- };
- var ElementPrototype = Element.prototype;
- /**
- * Obtains a (new) default value for the specified type.
- * @param type {string|{name: string, wireType: number}} Field type
- * @returns {*} Default value
- * @inner
- */
- function mkDefault(type) {
- if (typeof type === 'string')
- type = ProtoBuf.TYPES[type];
- if (typeof type.defaultValue === 'undefined')
- throw Error("default value for type "+type.name+" is not supported");
- if (type == ProtoBuf.TYPES["bytes"])
- return new ByteBuffer(0);
- return type.defaultValue;
- }
- /**
- * Returns the default value for this field in proto3.
- * @function
- * @param type {string|{name: string, wireType: number}} the field type
- * @returns {*} Default value
- */
- Element.defaultFieldValue = mkDefault;
- /**
- * Makes a Long from a value.
- * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
- * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
- * strings and numbers
- * @returns {!Long}
- * @throws {Error} If the value cannot be converted to a Long
- * @inner
- */
- function mkLong(value, unsigned) {
- if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
- && value.low === value.low && value.high === value.high)
- return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
- if (typeof value === 'string')
- return ProtoBuf.Long.fromString(value, unsigned || false, 10);
- if (typeof value === 'number')
- return ProtoBuf.Long.fromNumber(value, unsigned || false);
- throw Error("not convertible to Long");
- }
- ElementPrototype.toString = function() {
- return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
- }
- /**
- * Checks if the given value can be set for an element of this type (singular
- * field or one element of a repeated field or map).
- * @param {*} value Value to check
- * @return {*} Verified, maybe adjusted, value
- * @throws {Error} If the value cannot be verified for this element slot
- * @expose
- */
- ElementPrototype.verifyValue = function(value) {
- var self = this;
- function fail(val, msg) {
- throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
- }
- switch (this.type) {
- // Signed 32bit
- case ProtoBuf.TYPES["int32"]:
- case ProtoBuf.TYPES["sint32"]:
- case ProtoBuf.TYPES["sfixed32"]:
- // Account for !NaN: value === value
- if (typeof value !== 'number' || (value === value && value % 1 !== 0))
- fail(typeof value, "not an integer");
- return value > 4294967295 ? value | 0 : value;
- // Unsigned 32bit
- case ProtoBuf.TYPES["uint32"]:
- case ProtoBuf.TYPES["fixed32"]:
- if (typeof value !== 'number' || (value === value && value % 1 !== 0))
- fail(typeof value, "not an integer");
- return value < 0 ? value >>> 0 : value;
- // Signed 64bit
- case ProtoBuf.TYPES["int64"]:
- case ProtoBuf.TYPES["sint64"]:
- case ProtoBuf.TYPES["sfixed64"]: {
- if (ProtoBuf.Long)
- try {
- return mkLong(value, false);
- } catch (e) {
- fail(typeof value, e.message);
- }
- else
- fail(typeof value, "requires Long.js");
- }
- // Unsigned 64bit
- case ProtoBuf.TYPES["uint64"]:
- case ProtoBuf.TYPES["fixed64"]: {
- if (ProtoBuf.Long)
- try {
- return mkLong(value, true);
- } catch (e) {
- fail(typeof value, e.message);
- }
- else
- fail(typeof value, "requires Long.js");
- }
- // Bool
- case ProtoBuf.TYPES["bool"]:
- if (typeof value !== 'boolean')
- fail(typeof value, "not a boolean");
- return value;
- // Float
- case ProtoBuf.TYPES["float"]:
- case ProtoBuf.TYPES["double"]:
- if (typeof value !== 'number')
- fail(typeof value, "not a number");
- return value;
- // Length-delimited string
- case ProtoBuf.TYPES["string"]:
- if (typeof value !== 'string' && !(value && value instanceof String))
- fail(typeof value, "not a string");
- return ""+value; // Convert String object to string
- // Length-delimited bytes
- case ProtoBuf.TYPES["bytes"]:
- if (ByteBuffer.isByteBuffer(value))
- return value;
- return ByteBuffer.wrap(value, "base64");
- // Constant enum value
- case ProtoBuf.TYPES["enum"]: {
- var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
- for (i=0; i<values.length; i++)
- if (values[i].name == value)
- return values[i].id;
- else if (values[i].id == value)
- return values[i].id;
- if (this.syntax === 'proto3') {
- // proto3: just make sure it's an integer.
- if (typeof value !== 'number' || (value === value && value % 1 !== 0))
- fail(typeof value, "not an integer");
- if (value > 4294967295 || value < 0)
- fail(typeof value, "not in range for uint32")
- return value;
- } else {
- // proto2 requires enum values to be valid.
- fail(value, "not a valid enum value");
- }
- }
- // Embedded message
- case ProtoBuf.TYPES["group"]:
- case ProtoBuf.TYPES["message"]: {
- if (!value || typeof value !== 'object')
- fail(typeof value, "object expected");
- if (value instanceof this.resolvedType.clazz)
- return value;
- if (value instanceof ProtoBuf.Builder.Message) {
- // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
- var obj = {};
- for (var i in value)
- if (value.hasOwnProperty(i))
- obj[i] = value[i];
- value = obj;
- }
- // Else let's try to construct one from a key-value object
- return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
- }
- }
- // We should never end here
- throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
- };
- /**
- * Calculates the byte length of an element on the wire.
- * @param {number} id Field number
- * @param {*} value Field value
- * @returns {number} Byte length
- * @throws {Error} If the value cannot be calculated
- * @expose
- */
- ElementPrototype.calculateLength = function(id, value) {
- if (value === null) return 0; // Nothing to encode
- // Tag has already been written
- var n;
- switch (this.type) {
- case ProtoBuf.TYPES["int32"]:
- return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
- case ProtoBuf.TYPES["uint32"]:
- return ByteBuffer.calculateVarint32(value);
- case ProtoBuf.TYPES["sint32"]:
- return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
- case ProtoBuf.TYPES["fixed32"]:
- case ProtoBuf.TYPES["sfixed32"]:
- case ProtoBuf.TYPES["float"]:
- return 4;
- case ProtoBuf.TYPES["int64"]:
- case ProtoBuf.TYPES["uint64"]:
- return ByteBuffer.calculateVarint64(value);
- case ProtoBuf.TYPES["sint64"]:
- return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
- case ProtoBuf.TYPES["fixed64"]:
- case ProtoBuf.TYPES["sfixed64"]:
- return 8;
- case ProtoBuf.TYPES["bool"]:
- return 1;
- case ProtoBuf.TYPES["enum"]:
- return ByteBuffer.calculateVarint32(value);
- case ProtoBuf.TYPES["double"]:
- return 8;
- case ProtoBuf.TYPES["string"]:
- n = ByteBuffer.calculateUTF8Bytes(value);
- return ByteBuffer.calculateVarint32(n) + n;
- case ProtoBuf.TYPES["bytes"]:
- if (value.remaining() < 0)
- throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
- return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
- case ProtoBuf.TYPES["message"]:
- n = this.resolvedType.calculate(value);
- return ByteBuffer.calculateVarint32(n) + n;
- case ProtoBuf.TYPES["group"]:
- n = this.resolvedType.calculate(value);
- return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
- }
- // We should never end here
- throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
- };
- /**
- * Encodes a value to the specified buffer. Does not encode the key.
- * @param {number} id Field number
- * @param {*} value Field value
- * @param {ByteBuffer} buffer ByteBuffer to encode to
- * @return {ByteBuffer} The ByteBuffer for chaining
- * @throws {Error} If the value cannot be encoded
- * @expose
- */
- ElementPrototype.encodeValue = function(id, value, buffer) {
- if (value === null) return buffer; // Nothing to encode
- // Tag has already been written
- switch (this.type) {
- // 32bit signed varint
- case ProtoBuf.TYPES["int32"]:
- // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
- // long – it is, effectively, treated like a very large unsigned integer." (see #122)
- if (value < 0)
- buffer.writeVarint64(value);
- else
- buffer.writeVarint32(value);
- break;
- // 32bit unsigned varint
- case ProtoBuf.TYPES["uint32"]:
- buffer.writeVarint32(value);
- break;
- // 32bit varint zig-zag
- case ProtoBuf.TYPES["sint32"]:
- buffer.writeVarint32ZigZag(value);
- break;
- // Fixed unsigned 32bit
- case ProtoBuf.TYPES["fixed32"]:
- buffer.writeUint32(value);
- break;
- // Fixed signed 32bit
- case ProtoBuf.TYPES["sfixed32"]:
- buffer.writeInt32(value);
- break;
- // 64bit varint as-is
- case ProtoBuf.TYPES["int64"]:
- case ProtoBuf.TYPES["uint64"]:
- buffer.writeVarint64(value); // throws
- break;
- // 64bit varint zig-zag
- case ProtoBuf.TYPES["sint64"]:
- buffer.writeVarint64ZigZag(value); // throws
- break;
- // Fixed unsigned 64bit
- case ProtoBuf.TYPES["fixed64"]:
- buffer.writeUint64(value); // throws
- break;
- // Fixed signed 64bit
- case ProtoBuf.TYPES["sfixed64"]:
- buffer.writeInt64(value); // throws
- break;
- // Bool
- case ProtoBuf.TYPES["bool"]:
- if (typeof value === 'string')
- buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
- else
- buffer.writeVarint32(value ? 1 : 0);
- break;
- // Constant enum value
- case ProtoBuf.TYPES["enum"]:
- buffer.writeVarint32(value);
- break;
- // 32bit float
- case ProtoBuf.TYPES["float"]:
- buffer.writeFloat32(value);
- break;
- // 64bit float
- case ProtoBuf.TYPES["double"]:
- buffer.writeFloat64(value);
- break;
- // Length-delimited string
- case ProtoBuf.TYPES["string"]:
- buffer.writeVString(value);
- break;
- // Length-delimited bytes
- case ProtoBuf.TYPES["bytes"]:
- if (value.remaining() < 0)
- throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
- var prevOffset = value.offset;
- buffer.writeVarint32(value.remaining());
- buffer.append(value);
- value.offset = prevOffset;
- break;
- // Embedded message
- case ProtoBuf.TYPES["message"]:
- var bb = new ByteBuffer().LE();
- this.resolvedType.encode(value, bb);
- buffer.writeVarint32(bb.offset);
- buffer.append(bb.flip());
- break;
- // Legacy group
- case ProtoBuf.TYPES["group"]:
- this.resolvedType.encode(value, buffer);
- buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
- break;
- default:
- // We should never end here
- throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
- }
- return buffer;
- };
- /**
- * Decode one element value from the specified buffer.
- * @param {ByteBuffer} buffer ByteBuffer to decode from
- * @param {number} wireType The field wire type
- * @param {number} id The field number
- * @return {*} Decoded value
- * @throws {Error} If the field cannot be decoded
- * @expose
- */
- ElementPrototype.decode = function(buffer, wireType, id) {
- if (wireType != this.type.wireType)
- throw Error("Unexpected wire type for element");
- var value, nBytes;
- switch (this.type) {
- // 32bit signed varint
- case ProtoBuf.TYPES["int32"]:
- return buffer.readVarint32() | 0;
- // 32bit unsigned varint
- case ProtoBuf.TYPES["uint32"]:
- return buffer.readVarint32() >>> 0;
- // 32bit signed varint zig-zag
- case ProtoBuf.TYPES["sint32"]:
- return buffer.readVarint32ZigZag() | 0;
- // Fixed 32bit unsigned
- case ProtoBuf.TYPES["fixed32"]:
- return buffer.readUint32() >>> 0;
- case ProtoBuf.TYPES["sfixed32"]:
- return buffer.readInt32() | 0;
- // 64bit signed varint
- case ProtoBuf.TYPES["int64"]:
- return buffer.readVarint64();
- // 64bit unsigned varint
- case ProtoBuf.TYPES["uint64"]:
- return buffer.readVarint64().toUnsigned();
- // 64bit signed varint zig-zag
- case ProtoBuf.TYPES["sint64"]:
- return buffer.readVarint64ZigZag();
- // Fixed 64bit unsigned
- case ProtoBuf.TYPES["fixed64"]:
- return buffer.readUint64();
- // Fixed 64bit signed
- case ProtoBuf.TYPES["sfixed64"]:
- return buffer.readInt64();
- // Bool varint
- case ProtoBuf.TYPES["bool"]:
- return !!buffer.readVarint32();
- // Constant enum value (varint)
- case ProtoBuf.TYPES["enum"]:
- // The following Builder.Message#set will already throw
- return buffer.readVarint32();
- // 32bit float
- case ProtoBuf.TYPES["float"]:
- return buffer.readFloat();
- // 64bit float
- case ProtoBuf.TYPES["double"]:
- return buffer.readDouble();
- // Length-delimited string
- case ProtoBuf.TYPES["string"]:
- return buffer.readVString();
- // Length-delimited bytes
- case ProtoBuf.TYPES["bytes"]: {
- nBytes = buffer.readVarint32();
- if (buffer.remaining() < nBytes)
- throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
- value = buffer.clone(); // Offset already set
- value.limit = value.offset+nBytes;
- buffer.offset += nBytes;
- return value;
- }
- // Length-delimited embedded message
- case ProtoBuf.TYPES["message"]: {
- nBytes = buffer.readVarint32();
- return this.resolvedType.decode(buffer, nBytes);
- }
- // Legacy group
- case ProtoBuf.TYPES["group"]:
- return this.resolvedType.decode(buffer, -1, id);
- }
- // We should never end here
- throw Error("[INTERNAL] Illegal decode type");
- };
- /**
- * Converts a value from a string to the canonical element type.
- *
- * Legal only when isMapKey is true.
- *
- * @param {string} str The string value
- * @returns {*} The value
- */
- ElementPrototype.valueFromString = function(str) {
- if (!this.isMapKey) {
- throw Error("valueFromString() called on non-map-key element");
- }
- switch (this.type) {
- case ProtoBuf.TYPES["int32"]:
- case ProtoBuf.TYPES["sint32"]:
- case ProtoBuf.TYPES["sfixed32"]:
- case ProtoBuf.TYPES["uint32"]:
- case ProtoBuf.TYPES["fixed32"]:
- return this.verifyValue(parseInt(str));
- case ProtoBuf.TYPES["int64"]:
- case ProtoBuf.TYPES["sint64"]:
- case ProtoBuf.TYPES["sfixed64"]:
- case ProtoBuf.TYPES["uint64"]:
- case ProtoBuf.TYPES["fixed64"]:
- // Long-based fields support conversions from string already.
- return this.verifyValue(str);
- case ProtoBuf.TYPES["bool"]:
- return str === "true";
- case ProtoBuf.TYPES["string"]:
- return this.verifyValue(str);
- case ProtoBuf.TYPES["bytes"]:
- return ByteBuffer.fromBinary(str);
- }
- };
- /**
- * Converts a value from the canonical element type to a string.
- *
- * It should be the case that `valueFromString(valueToString(val))` returns
- * a value equivalent to `verifyValue(val)` for every legal value of `val`
- * according to this element type.
- *
- * This may be used when the element must be stored or used as a string,
- * e.g., as a map key on an Object.
- *
- * Legal only when isMapKey is true.
- *
- * @param {*} val The value
- * @returns {string} The string form of the value.
- */
- ElementPrototype.valueToString = function(value) {
- if (!this.isMapKey) {
- throw Error("valueToString() called on non-map-key element");
- }
- if (this.type === ProtoBuf.TYPES["bytes"]) {
- return value.toString("binary");
- } else {
- return value.toString();
- }
- };
- /**
- * @alias ProtoBuf.Reflect.Element
- * @expose
- */
- Reflect.Element = Element;
- /**
- * Constructs a new Message.
- * @exports ProtoBuf.Reflect.Message
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
- * @param {string} name Message name
- * @param {Object.<string,*>=} options Message options
- * @param {boolean=} isGroup `true` if this is a legacy group
- * @param {string?} syntax The syntax level of this definition (e.g., proto3)
- * @constructor
- * @extends ProtoBuf.Reflect.Namespace
- */
- var Message = function(builder, parent, name, options, isGroup, syntax) {
- Namespace.call(this, builder, parent, name, options, syntax);
- /**
- * @override
- */
- this.className = "Message";
- /**
- * Extensions range.
- * @type {!Array.<number>|undefined}
- * @expose
- */
- this.extensions = undefined;
- /**
- * Runtime message class.
- * @type {?function(new:ProtoBuf.Builder.Message)}
- * @expose
- */
- this.clazz = null;
- /**
- * Whether this is a legacy group or not.
- * @type {boolean}
- * @expose
- */
- this.isGroup = !!isGroup;
- // The following cached collections are used to efficiently iterate over or look up fields when decoding.
- /**
- * Cached fields.
- * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
- * @private
- */
- this._fields = null;
- /**
- * Cached fields by id.
- * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
- * @private
- */
- this._fieldsById = null;
- /**
- * Cached fields by name.
- * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
- * @private
- */
- this._fieldsByName = null;
- };
- /**
- * @alias ProtoBuf.Reflect.Message.prototype
- * @inner
- */
- var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
- /**
- * Builds the message and returns the runtime counterpart, which is a fully functional class.
- * @see ProtoBuf.Builder.Message
- * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
- * @return {ProtoBuf.Reflect.Message} Message class
- * @throws {Error} If the message cannot be built
- * @expose
- */
- MessagePrototype.build = function(rebuild) {
- if (this.clazz && !rebuild)
- return this.clazz;
- // Create the runtime Message class in its own scope
- var clazz = (function(ProtoBuf, T) {
- var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
- oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
- /**
- * Constructs a new runtime Message.
- * @name ProtoBuf.Builder.Message
- * @class Barebone of all runtime messages.
- * @param {!Object.<string,*>|string} values Preset values
- * @param {...string} var_args
- * @constructor
- * @throws {Error} If the message cannot be created
- */
- var Message = function(values, var_args) {
- ProtoBuf.Builder.Message.call(this);
- // Create virtual oneof properties
- for (var i=0, k=oneofs.length; i<k; ++i)
- this[oneofs[i].name] = null;
- // Create fields and set default values
- for (i=0, k=fields.length; i<k; ++i) {
- var field = fields[i];
- this[field.name] =
- field.repeated ? [] :
- (field.map ? new ProtoBuf.Map(field) : null);
- if ((field.required || T.syntax === 'proto3') &&
- field.defaultValue !== null)
- this[field.name] = field.defaultValue;
- }
- if (arguments.length > 0) {
- var value;
- // Set field values from a values object
- if (arguments.length === 1 && values !== null && typeof values === 'object' &&
- /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
- /* not a repeated field */ !Array.isArray(values) &&
- /* not a Map */ !(values instanceof ProtoBuf.Map) &&
- /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
- /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
- /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
- this.$set(values);
- } else // Set field values from arguments, in declaration order
- for (i=0, k=arguments.length; i<k; ++i)
- if (typeof (value = arguments[i]) !== 'undefined')
- this.$set(fields[i].name, value); // May throw
- }
- };
- /**
- * @alias ProtoBuf.Builder.Message.prototype
- * @inner
- */
- var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
- /**
- * Adds a value to a repeated field.
- * @name ProtoBuf.Builder.Message#add
- * @function
- * @param {string} key Field name
- * @param {*} value Value to add
- * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
- * @returns {!ProtoBuf.Builder.Message} this
- * @throws {Error} If the value cannot be added
- * @expose
- */
- MessagePrototype.add = function(key, value, noAssert) {
- var field = T._fieldsByName[key];
- if (!noAssert) {
- if (!field)
- throw Error(this+"#"+key+" is undefined");
- if (!(field instanceof ProtoBuf.Reflect.Message.Field))
- throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
- if (!field.repeated)
- throw Error(this+"#"+key+" is not a repeated field");
- value = field.verifyValue(value, true);
- }
- if (this[key] === null)
- this[key] = [];
- this[key].push(value);
- return this;
- };
- /**
- * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
- * @name ProtoBuf.Builder.Message#$add
- * @function
- * @param {string} key Field name
- * @param {*} value Value to add
- * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
- * @returns {!ProtoBuf.Builder.Message} this
- * @throws {Error} If the value cannot be added
- * @expose
- */
- MessagePrototype.$add = MessagePrototype.add;
- /**
- * Sets a field's value.
- * @name ProtoBuf.Builder.Message#set
- * @function
- * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
- * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
- * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
- * @returns {!ProtoBuf.Builder.Message} this
- * @throws {Error} If the value cannot be set
- * @expose
- */
- MessagePrototype.set = function(keyOrObj, value, noAssert) {
- if (keyOrObj && typeof keyOrObj === 'object') {
- noAssert = value;
- for (var ikey in keyOrObj) {
- // Check if virtual oneof field - don't set these
- if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
- this.$set(ikey, value, noAssert);
- }
- return this;
- }
- var field = T._fieldsByName[keyOrObj];
- if (!noAssert) {
- if (!field)
- throw Error(this+"#"+keyOrObj+" is not a field: undefined");
- if (!(field instanceof ProtoBuf.Reflect.Message.Field))
- throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
- this[field.name] = (value = field.verifyValue(value)); // May throw
- } else
- this[keyOrObj] = value;
- if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
- var currentField = this[field.oneof.name]; // Virtual field references currently set field
- if (value !== null) {
- if (currentField !== null && currentField !== field.name)
- this[currentField] = null; // Clear currently set field
- this[field.oneof.name] = field.name; // Point virtual field at this field
- } else if (/* value === null && */currentField === keyOrObj)
- this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
- }
- return this;
- };
- /**
- * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
- * @name ProtoBuf.Builder.Message#$set
- * @function
- * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
- * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
- * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
- * @throws {Error} If the value cannot be set
- * @expose
- */
- MessagePrototype.$set = MessagePrototype.set;
- /**
- * Gets a field's value.
- * @name ProtoBuf.Builder.Message#get
- * @function
- * @param {string} key Key
- * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
- * @return {*} Value
- * @throws {Error} If there is no such field
- * @expose
- */
- MessagePrototype.get = function(key, noAssert) {
- if (noAssert)
- return this[key];
- var field = T._fieldsByName[key];
- if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
- throw Error(this+"#"+key+" is not a field: undefined");
- if (!(field instanceof ProtoBuf.Reflect.Message.Field))
- throw Error(this+"#"+key+" is not a field: "+field.toString(true));
- return this[field.name];
- };
- /**
- * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
- * @name ProtoBuf.Builder.Message#$get
- * @function
- * @param {string} key Key
- * @return {*} Value
- * @throws {Error} If there is no such field
- * @expose
- */
- MessagePrototype.$get = MessagePrototype.get;
- // Getters and setters
- for (var i=0; i<fields.length; i++) {
- var field = fields[i];
- // no setters for extension fields as these are named by their fqn
- if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
- continue;
- if (T.builder.options['populateAccessors'])
- (function(field) {
- // set/get[SomeValue]
- var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
- return match.toUpperCase().replace('_','');
- });
- Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
- // set/get_[some_value] FIXME: Do we really need these?
- var name = field.originalName.replace(/([A-Z])/g, function(match) {
- return "_"+match;
- });
- /**
- * The current field's unbound setter function.
- * @function
- * @param {*} value
- * @param {boolean=} noAssert
- * @returns {!ProtoBuf.Builder.Message}
- * @inner
- */
- var setter = function(value, noAssert) {
- this[field.name] = noAssert ? value : field.verifyValue(value);
- return this;
- };
- /**
- * The current field's unbound getter function.
- * @function
- * @returns {*}
- * @inner
- */
- var getter = function() {
- return this[field.name];
- };
- if (T.getChild("set"+Name) === null)
- /**
- * Sets a value. This method is present for each field, but only if there is no name conflict with
- * another field.
- * @name ProtoBuf.Builder.Message#set[SomeField]
- * @function
- * @param {*} value Value to set
- * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
- * @returns {!ProtoBuf.Builder.Message} this
- * @abstract
- * @throws {Error} If the value cannot be set
- */
- MessagePrototype["set"+Name] = setter;
- if (T.getChild("set_"+name) === null)
- /**
- * Sets a value. This method is present for each field, but only if there is no name conflict with
- * another field.
- * @name ProtoBuf.Builder.Message#set_[some_field]
- * @function
- * @param {*} value Value to set
- * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
- * @returns {!ProtoBuf.Builder.Message} this
- * @abstract
- * @throws {Error} If the value cannot be set
- */
- MessagePrototype["set_"+name] = setter;
- if (T.getChild("get"+Name) === null)
- /**
- * Gets a value. This method is present for each field, but only if there is no name conflict with
- * another field.
- * @name ProtoBuf.Builder.Message#get[SomeField]
- * @function
- * @abstract
- * @return {*} The value
- */
- MessagePrototype["get"+Name] = getter;
- if (T.getChild("get_"+name) === null)
- /**
- * Gets a value. This method is present for each field, but only if there is no name conflict with
- * another field.
- * @name ProtoBuf.Builder.Message#get_[some_field]
- * @function
- * @return {*} The value
- * @abstract
- */
- MessagePrototype["get_"+name] = getter;
- })(field);
- }
- // En-/decoding
- /**
- * Encodes the message.
- * @name ProtoBuf.Builder.Message#$encode
- * @function
- * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
- * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
- * @return {!ByteBuffer} Encoded message as a ByteBuffer
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded ByteBuffer in the `encoded` property on the error.
- * @expose
- * @see ProtoBuf.Builder.Message#encode64
- * @see ProtoBuf.Builder.Message#encodeHex
- * @see ProtoBuf.Builder.Message#encodeAB
- */
- MessagePrototype.encode = function(buffer, noVerify) {
- if (typeof buffer === 'boolean')
- noVerify = buffer,
- buffer = undefined;
- var isNew = false;
- if (!buffer)
- buffer = new ByteBuffer(),
- isNew = true;
- var le = buffer.littleEndian;
- try {
- T.encode(this, buffer.LE(), noVerify);
- return (isNew ? buffer.flip() : buffer).LE(le);
- } catch (e) {
- buffer.LE(le);
- throw(e);
- }
- };
- /**
- * Encodes a message using the specified data payload.
- * @param {!Object.<string,*>} data Data payload
- * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
- * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
- * @return {!ByteBuffer} Encoded message as a ByteBuffer
- * @expose
- */
- Message.encode = function(data, buffer, noVerify) {
- return new Message(data).encode(buffer, noVerify);
- };
- /**
- * Calculates the byte length of the message.
- * @name ProtoBuf.Builder.Message#calculate
- * @function
- * @returns {number} Byte length
- * @throws {Error} If the message cannot be calculated or if required fields are missing.
- * @expose
- */
- MessagePrototype.calculate = function() {
- return T.calculate(this);
- };
- /**
- * Encodes the varint32 length-delimited message.
- * @name ProtoBuf.Builder.Message#encodeDelimited
- * @function
- * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
- * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
- * @return {!ByteBuffer} Encoded message as a ByteBuffer
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded ByteBuffer in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.encodeDelimited = function(buffer, noVerify) {
- var isNew = false;
- if (!buffer)
- buffer = new ByteBuffer(),
- isNew = true;
- var enc = new ByteBuffer().LE();
- T.encode(this, enc, noVerify).flip();
- buffer.writeVarint32(enc.remaining());
- buffer.append(enc);
- return isNew ? buffer.flip() : buffer;
- };
- /**
- * Directly encodes the message to an ArrayBuffer.
- * @name ProtoBuf.Builder.Message#encodeAB
- * @function
- * @return {ArrayBuffer} Encoded message as ArrayBuffer
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded ArrayBuffer in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.encodeAB = function() {
- try {
- return this.encode().toArrayBuffer();
- } catch (e) {
- if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
- throw(e);
- }
- };
- /**
- * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
- * @name ProtoBuf.Builder.Message#toArrayBuffer
- * @function
- * @return {ArrayBuffer} Encoded message as ArrayBuffer
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded ArrayBuffer in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
- /**
- * Directly encodes the message to a node Buffer.
- * @name ProtoBuf.Builder.Message#encodeNB
- * @function
- * @return {!Buffer}
- * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
- * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.encodeNB = function() {
- try {
- return this.encode().toBuffer();
- } catch (e) {
- if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
- throw(e);
- }
- };
- /**
- * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
- * @name ProtoBuf.Builder.Message#toBuffer
- * @function
- * @return {!Buffer}
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded node Buffer in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.toBuffer = MessagePrototype.encodeNB;
- /**
- * Directly encodes the message to a base64 encoded string.
- * @name ProtoBuf.Builder.Message#encode64
- * @function
- * @return {string} Base64 encoded string
- * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
- * still returns the encoded base64 string in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.encode64 = function() {
- try {
- return this.encode().toBase64();
- } catch (e) {
- if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
- throw(e);
- }
- };
- /**
- * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
- * @name ProtoBuf.Builder.Message#toBase64
- * @function
- * @return {string} Base64 encoded string
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded base64 string in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.toBase64 = MessagePrototype.encode64;
- /**
- * Directly encodes the message to a hex encoded string.
- * @name ProtoBuf.Builder.Message#encodeHex
- * @function
- * @return {string} Hex encoded string
- * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
- * still returns the encoded hex string in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.encodeHex = function() {
- try {
- return this.encode().toHex();
- } catch (e) {
- if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
- throw(e);
- }
- };
- /**
- * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
- * @name ProtoBuf.Builder.Message#toHex
- * @function
- * @return {string} Hex encoded string
- * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
- * returns the encoded hex string in the `encoded` property on the error.
- * @expose
- */
- MessagePrototype.toHex = MessagePrototype.encodeHex;
- /**
- * Clones a message object or field value to a raw object.
- * @param {*} obj Object to clone
- * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
- * @param {boolean} longsAsStrings Whether to encode longs as strings
- * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
- * @returns {*} Cloned object
- * @inner
- */
- function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
- if (obj === null || typeof obj !== 'object') {
- // Convert enum values to their respective names
- if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
- var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
- if (name !== null)
- return name;
- }
- // Pass-through string, number, boolean, null...
- return obj;
- }
- // Convert ByteBuffers to raw buffer or strings
- if (ByteBuffer.isByteBuffer(obj))
- return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
- // Convert Longs to proper objects or strings
- if (ProtoBuf.Long.isLong(obj))
- return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
- var clone;
- // Clone arrays
- if (Array.isArray(obj)) {
- clone = [];
- obj.forEach(function(v, k) {
- clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
- });
- return clone;
- }
- clone = {};
- // Convert maps to objects
- if (obj instanceof ProtoBuf.Map) {
- var it = obj.entries();
- for (var e = it.next(); !e.done; e = it.next())
- clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
- return clone;
- }
- // Everything else is a non-null object
- var type = obj.$type,
- field = undefined;
- for (var i in obj)
- if (obj.hasOwnProperty(i)) {
- if (type && (field = type.getChild(i)))
- clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
- else
- clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
- }
- return clone;
- }
- /**
- * Returns the message's raw payload.
- * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
- * @param {boolean} longsAsStrings Whether to encode longs as strings
- * @returns {Object.<string,*>} Raw payload
- * @expose
- */
- MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
- return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
- };
- /**
- * Encodes a message to JSON.
- * @returns {string} JSON string
- * @expose
- */
- MessagePrototype.encodeJSON = function() {
- return JSON.stringify(
- cloneRaw(this,
- /* binary-as-base64 */ true,
- /* longs-as-strings */ true,
- this.$type
- )
- );
- };
- /**
- * Decodes a message from the specified buffer or string.
- * @name ProtoBuf.Builder.Message.decode
- * @function
- * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
- * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
- * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
- * @return {!ProtoBuf.Builder.Message} Decoded message
- * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
- * returns the decoded message with missing fields in the `decoded` property on the error.
- * @expose
- * @see ProtoBuf.Builder.Message.decode64
- * @see ProtoBuf.Builder.Message.decodeHex
- */
- Message.decode = function(buffer, length, enc) {
- if (typeof length === 'string')
- enc = length,
- length = -1;
- if (typeof buffer === 'string')
- buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
- else if (!ByteBuffer.isByteBuffer(buffer))
- buffer = ByteBuffer.wrap(buffer); // May throw
- var le = buffer.littleEndian;
- try {
- var msg = T.decode(buffer.LE(), length);
- buffer.LE(le);
- return msg;
- } catch (e) {
- buffer.LE(le);
- throw(e);
- }
- };
- /**
- * Decodes a varint32 length-delimited message from the specified buffer or string.
- * @name ProtoBuf.Builder.Message.decodeDelimited
- * @function
- * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
- * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
- * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
- * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
- * returns the decoded message with missing fields in the `decoded` property on the error.
- * @expose
- */
- Message.decodeDelimited = function(buffer, enc) {
- if (typeof buffer === 'string')
- buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
- else if (!ByteBuffer.isByteBuffer(buffer))
- buffer = ByteBuffer.wrap(buffer); // May throw
- if (buffer.remaining() < 1)
- return null;
- var off = buffer.offset,
- len = buffer.readVarint32();
- if (buffer.remaining() < len) {
- buffer.offset = off;
- return null;
- }
- try {
- var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
- buffer.offset += len;
- return msg;
- } catch (err) {
- buffer.offset += len;
- throw err;
- }
- };
- /**
- * Decodes the message from the specified base64 encoded string.
- * @name ProtoBuf.Builder.Message.decode64
- * @function
- * @param {string} str String to decode from
- * @return {!ProtoBuf.Builder.Message} Decoded message
- * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
- * returns the decoded message with missing fields in the `decoded` property on the error.
- * @expose
- */
- Message.decode64 = function(str) {
- return Message.decode(str, "base64");
- };
- /**
- * Decodes the message from the specified hex encoded string.
- * @name ProtoBuf.Builder.Message.decodeHex
- * @function
- * @param {string} str String to decode from
- * @return {!ProtoBuf.Builder.Message} Decoded message
- * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
- * returns the decoded message with missing fields in the `decoded` property on the error.
- * @expose
- */
- Message.decodeHex = function(str) {
- return Message.decode(str, "hex");
- };
- /**
- * Decodes the message from a JSON string.
- * @name ProtoBuf.Builder.Message.decodeJSON
- * @function
- * @param {string} str String to decode from
- * @return {!ProtoBuf.Builder.Message} Decoded message
- * @throws {Error} If the message cannot be decoded or if required fields are
- * missing.
- * @expose
- */
- Message.decodeJSON = function(str) {
- return new Message(JSON.parse(str));
- };
- // Utility
- /**
- * Returns a string representation of this Message.
- * @name ProtoBuf.Builder.Message#toString
- * @function
- * @return {string} String representation as of ".Fully.Qualified.MessageName"
- * @expose
- */
- MessagePrototype.toString = function() {
- return T.toString();
- };
- // Properties
- /**
- * Message options.
- * @name ProtoBuf.Builder.Message.$options
- * @type {Object.<string,*>}
- * @expose
- */
- var $optionsS; // cc needs this
- /**
- * Message options.
- * @name ProtoBuf.Builder.Message#$options
- * @type {Object.<string,*>}
- * @expose
- */
- var $options;
- /**
- * Reflection type.
- * @name ProtoBuf.Builder.Message.$type
- * @type {!ProtoBuf.Reflect.Message}
- * @expose
- */
- var $typeS;
- /**
- * Reflection type.
- * @name ProtoBuf.Builder.Message#$type
- * @type {!ProtoBuf.Reflect.Message}
- * @expose
- */
- var $type;
- if (Object.defineProperty)
- Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
- Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
- Object.defineProperty(Message, "$type", { "value": T }),
- Object.defineProperty(MessagePrototype, "$type", { "value": T });
- return Message;
- })(ProtoBuf, this);
- // Static enums and prototyped sub-messages / cached collections
- this._fields = [];
- this._fieldsById = {};
- this._fieldsByName = {};
- this._oneofsByName = {};
- for (var i=0, k=this.children.length, child; i<k; i++) {
- child = this.children[i];
- if (child instanceof Enum || child instanceof Message || child instanceof Service) {
- if (clazz.hasOwnProperty(child.name))
- throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
- clazz[child.name] = child.build();
- } else if (child instanceof Message.Field)
- child.build(),
- this._fields.push(child),
- this._fieldsById[child.id] = child,
- this._fieldsByName[child.name] = child;
- else if (child instanceof Message.OneOf) {
- this._oneofsByName[child.name] = child;
- }
- else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
- throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
- }
- return this.clazz = clazz;
- };
- /**
- * Encodes a runtime message's contents to the specified buffer.
- * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
- * @param {ByteBuffer} buffer ByteBuffer to write to
- * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
- * @return {ByteBuffer} The ByteBuffer for chaining
- * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
- * @expose
- */
- MessagePrototype.encode = function(message, buffer, noVerify) {
- var fieldMissing = null,
- field;
- for (var i=0, k=this._fields.length, val; i<k; ++i) {
- field = this._fields[i];
- val = message[field.name];
- if (field.required && val === null) {
- if (fieldMissing === null)
- fieldMissing = field;
- } else
- field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
- }
- if (fieldMissing !== null) {
- var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
- err["encoded"] = buffer; // Still expose what we got
- throw(err);
- }
- return buffer;
- };
- /**
- * Calculates a runtime message's byte length.
- * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
- * @returns {number} Byte length
- * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
- * @expose
- */
- MessagePrototype.calculate = function(message) {
- for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
- field = this._fields[i];
- val = message[field.name];
- if (field.required && val === null)
- throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
- else
- n += field.calculate(val, message);
- }
- return n;
- };
- /**
- * Skips all data until the end of the specified group has been reached.
- * @param {number} expectedId Expected GROUPEND id
- * @param {!ByteBuffer} buf ByteBuffer
- * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
- * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
- * @inner
- */
- function skipTillGroupEnd(expectedId, buf) {
- var tag = buf.readVarint32(), // Throws on OOB
- wireType = tag & 0x07,
- id = tag >>> 3;
- switch (wireType) {
- case ProtoBuf.WIRE_TYPES.VARINT:
- do tag = buf.readUint8();
- while ((tag & 0x80) === 0x80);
- break;
- case ProtoBuf.WIRE_TYPES.BITS64:
- buf.offset += 8;
- break;
- case ProtoBuf.WIRE_TYPES.LDELIM:
- tag = buf.readVarint32(); // reads the varint
- buf.offset += tag; // skips n bytes
- break;
- case ProtoBuf.WIRE_TYPES.STARTGROUP:
- skipTillGroupEnd(id, buf);
- break;
- case ProtoBuf.WIRE_TYPES.ENDGROUP:
- if (id === expectedId)
- return false;
- else
- throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
- case ProtoBuf.WIRE_TYPES.BITS32:
- buf.offset += 4;
- break;
- default:
- throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
- }
- return true;
- }
- /**
- * Decodes an encoded message and returns the decoded message.
- * @param {ByteBuffer} buffer ByteBuffer to decode from
- * @param {number=} length Message length. Defaults to decode all remaining data.
- * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
- * @return {ProtoBuf.Builder.Message} Decoded message
- * @throws {Error} If the message cannot be decoded
- * @expose
- */
- MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
- if (typeof length !== 'number')
- length = -1;
- var start = buffer.offset,
- msg = new (this.clazz)(),
- tag, wireType, id, field;
- while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
- tag = buffer.readVarint32();
- wireType = tag & 0x07;
- id = tag >>> 3;
- if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
- if (id !== expectedGroupEndId)
- throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
- break;
- }
- if (!(field = this._fieldsById[id])) {
- // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
- switch (wireType) {
- case ProtoBuf.WIRE_TYPES.VARINT:
- buffer.readVarint32();
- break;
- case ProtoBuf.WIRE_TYPES.BITS32:
- buffer.offset += 4;
- break;
- case ProtoBuf.WIRE_TYPES.BITS64:
- buffer.offset += 8;
- break;
- case ProtoBuf.WIRE_TYPES.LDELIM:
- var len = buffer.readVarint32();
- buffer.offset += len;
- break;
- case ProtoBuf.WIRE_TYPES.STARTGROUP:
- while (skipTillGroupEnd(id, buffer)) {}
- break;
- default:
- throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
- }
- continue;
- }
- if (field.repeated && !field.options["packed"]) {
- msg[field.name].push(field.decode(wireType, buffer));
- } else if (field.map) {
- var keyval = field.decode(wireType, buffer);
- msg[field.name].set(keyval[0], keyval[1]);
- } else {
- msg[field.name] = field.decode(wireType, buffer);
- if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
- var currentField = msg[field.oneof.name]; // Virtual field references currently set field
- if (currentField !== null && currentField !== field.name)
- msg[currentField] = null; // Clear currently set field
- msg[field.oneof.name] = field.name; // Point virtual field at this field
- }
- }
- }
- // Check if all required fields are present and set default values for optional fields that are not
- for (var i=0, k=this._fields.length; i<k; ++i) {
- field = this._fields[i];
- if (msg[field.name] === null) {
- if (this.syntax === "proto3") { // Proto3 sets default values by specification
- msg[field.name] = field.defaultValue;
- } else if (field.required) {
- var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
- err["decoded"] = msg; // Still expose what we got
- throw(err);
- } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
- msg[field.name] = field.defaultValue;
- }
- }
- return msg;
- };
- /**
- * @alias ProtoBuf.Reflect.Message
- * @expose
- */
- Reflect.Message = Message;
- /**
- * Constructs a new Message Field.
- * @exports ProtoBuf.Reflect.Message.Field
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Message} message Message reference
- * @param {string} rule Rule, one of requried, optional, repeated
- * @param {string?} keytype Key data type, if any.
- * @param {string} type Data type, e.g. int32
- * @param {string} name Field name
- * @param {number} id Unique field id
- * @param {Object.<string,*>=} options Options
- * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
- * @param {string?} syntax The syntax level of this definition (e.g., proto3)
- * @constructor
- * @extends ProtoBuf.Reflect.T
- */
- var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
- T.call(this, builder, message, name);
- /**
- * @override
- */
- this.className = "Message.Field";
- /**
- * Message field required flag.
- * @type {boolean}
- * @expose
- */
- this.required = rule === "required";
- /**
- * Message field repeated flag.
- * @type {boolean}
- * @expose
- */
- this.repeated = rule === "repeated";
- /**
- * Message field map flag.
- * @type {boolean}
- * @expose
- */
- this.map = rule === "map";
- /**
- * Message field key type. Type reference string if unresolved, protobuf
- * type if resolved. Valid only if this.map === true, null otherwise.
- * @type {string|{name: string, wireType: number}|null}
- * @expose
- */
- this.keyType = keytype || null;
- /**
- * Message field type. Type reference string if unresolved, protobuf type if
- * resolved. In a map field, this is the value type.
- * @type {string|{name: string, wireType: number}}
- * @expose
- */
- this.type = type;
- /**
- * Resolved type reference inside the global namespace.
- * @type {ProtoBuf.Reflect.T|null}
- * @expose
- */
- this.resolvedType = null;
- /**
- * Unique message field id.
- * @type {number}
- * @expose
- */
- this.id = id;
- /**
- * Message field options.
- * @type {!Object.<string,*>}
- * @dict
- * @expose
- */
- this.options = options || {};
- /**
- * Default value.
- * @type {*}
- * @expose
- */
- this.defaultValue = null;
- /**
- * Enclosing OneOf.
- * @type {?ProtoBuf.Reflect.Message.OneOf}
- * @expose
- */
- this.oneof = oneof || null;
- /**
- * Syntax level of this definition (e.g., proto3).
- * @type {string}
- * @expose
- */
- this.syntax = syntax || 'proto2';
- /**
- * Original field name.
- * @type {string}
- * @expose
- */
- this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
- /**
- * Element implementation. Created in build() after types are resolved.
- * @type {ProtoBuf.Element}
- * @expose
- */
- this.element = null;
- /**
- * Key element implementation, for map fields. Created in build() after
- * types are resolved.
- * @type {ProtoBuf.Element}
- * @expose
- */
- this.keyElement = null;
- // Convert field names to camel case notation if the override is set
- if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
- this.name = ProtoBuf.Util.toCamelCase(this.name);
- };
- /**
- * @alias ProtoBuf.Reflect.Message.Field.prototype
- * @inner
- */
- var FieldPrototype = Field.prototype = Object.create(T.prototype);
- /**
- * Builds the field.
- * @override
- * @expose
- */
- FieldPrototype.build = function() {
- this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
- if (this.map)
- this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
- // In proto3, fields do not have field presence, and every field is set to
- // its type's default value ("", 0, 0.0, or false).
- if (this.syntax === 'proto3' && !this.repeated && !this.map)
- this.defaultValue = Element.defaultFieldValue(this.type);
- // Otherwise, default values are present when explicitly specified
- else if (typeof this.options['default'] !== 'undefined')
- this.defaultValue = this.verifyValue(this.options['default']);
- };
- /**
- * Checks if the given value can be set for this field.
- * @param {*} value Value to check
- * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
- * @return {*} Verified, maybe adjusted, value
- * @throws {Error} If the value cannot be set for this field
- * @expose
- */
- FieldPrototype.verifyValue = function(value, skipRepeated) {
- skipRepeated = skipRepeated || false;
- var self = this;
- function fail(val, msg) {
- throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
- }
- if (value === null) { // NULL values for optional fields
- if (this.required)
- fail(typeof value, "required");
- if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
- fail(typeof value, "proto3 field without field presence cannot be null");
- return null;
- }
- var i;
- if (this.repeated && !skipRepeated) { // Repeated values as arrays
- if (!Array.isArray(value))
- value = [value];
- var res = [];
- for (i=0; i<value.length; i++)
- res.push(this.element.verifyValue(value[i]));
- return res;
- }
- if (this.map && !skipRepeated) { // Map values as objects
- if (!(value instanceof ProtoBuf.Map)) {
- // If not already a Map, attempt to convert.
- if (!(value instanceof Object)) {
- fail(typeof value,
- "expected ProtoBuf.Map or raw object for map field");
- }
- return new ProtoBuf.Map(this, value);
- } else {
- return value;
- }
- }
- // All non-repeated fields expect no array
- if (!this.repeated && Array.isArray(value))
- fail(typeof value, "no array expected");
- return this.element.verifyValue(value);
- };
- /**
- * Determines whether the field will have a presence on the wire given its
- * value.
- * @param {*} value Verified field value
- * @param {!ProtoBuf.Builder.Message} message Runtime message
- * @return {boolean} Whether the field will be present on the wire
- */
- FieldPrototype.hasWirePresence = function(value, message) {
- if (this.syntax !== 'proto3')
- return (value !== null);
- if (this.oneof && message[this.oneof.name] === this.name)
- return true;
- switch (this.type) {
- case ProtoBuf.TYPES["int32"]:
- case ProtoBuf.TYPES["sint32"]:
- case ProtoBuf.TYPES["sfixed32"]:
- case ProtoBuf.TYPES["uint32"]:
- case ProtoBuf.TYPES["fixed32"]:
- return value !== 0;
- case ProtoBuf.TYPES["int64"]:
- case ProtoBuf.TYPES["sint64"]:
- case ProtoBuf.TYPES["sfixed64"]:
- case ProtoBuf.TYPES["uint64"]:
- case ProtoBuf.TYPES["fixed64"]:
- return value.low !== 0 || value.high !== 0;
- case ProtoBuf.TYPES["bool"]:
- return value;
- case ProtoBuf.TYPES["float"]:
- case ProtoBuf.TYPES["double"]:
- return value !== 0.0;
- case ProtoBuf.TYPES["string"]:
- return value.length > 0;
- case ProtoBuf.TYPES["bytes"]:
- return value.remaining() > 0;
- case ProtoBuf.TYPES["enum"]:
- return value !== 0;
- case ProtoBuf.TYPES["message"]:
- return value !== null;
- default:
- return true;
- }
- };
- /**
- * Encodes the specified field value to the specified buffer.
- * @param {*} value Verified field value
- * @param {ByteBuffer} buffer ByteBuffer to encode to
- * @param {!ProtoBuf.Builder.Message} message Runtime message
- * @return {ByteBuffer} The ByteBuffer for chaining
- * @throws {Error} If the field cannot be encoded
- * @expose
- */
- FieldPrototype.encode = function(value, buffer, message) {
- if (this.type === null || typeof this.type !== 'object')
- throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
- if (value === null || (this.repeated && value.length == 0))
- return buffer; // Optional omitted
- try {
- if (this.repeated) {
- var i;
- // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
- // types) can be declared 'packed'."
- if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
- // "All of the elements of the field are packed into a single key-value pair with wire type 2
- // (length-delimited). Each element is encoded the same way it would be normally, except without a
- // tag preceding it."
- buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
- buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
- var start = buffer.offset; // Remember where the contents begin
- for (i=0; i<value.length; i++)
- this.element.encodeValue(this.id, value[i], buffer);
- var len = buffer.offset-start,
- varintLen = ByteBuffer.calculateVarint32(len);
- if (varintLen > 1) { // We need to move the contents
- var contents = buffer.slice(start, buffer.offset);
- start += varintLen-1;
- buffer.offset = start;
- buffer.append(contents);
- }
- buffer.writeVarint32(len, start-varintLen);
- } else {
- // "If your message definition has repeated elements (without the [packed=true] option), the encoded
- // message has zero or more key-value pairs with the same tag number"
- for (i=0; i<value.length; i++)
- buffer.writeVarint32((this.id << 3) | this.type.wireType),
- this.element.encodeValue(this.id, value[i], buffer);
- }
- } else if (this.map) {
- // Write out each map entry as a submessage.
- value.forEach(function(val, key, m) {
- // Compute the length of the submessage (key, val) pair.
- var length =
- ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
- this.keyElement.calculateLength(1, key) +
- ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
- this.element.calculateLength(2, val);
- // Submessage with wire type of length-delimited.
- buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
- buffer.writeVarint32(length);
- // Write out the key and val.
- buffer.writeVarint32((1 << 3) | this.keyType.wireType);
- this.keyElement.encodeValue(1, key, buffer);
- buffer.writeVarint32((2 << 3) | this.type.wireType);
- this.element.encodeValue(2, val, buffer);
- }, this);
- } else {
- if (this.hasWirePresence(value, message)) {
- buffer.writeVarint32((this.id << 3) | this.type.wireType);
- this.element.encodeValue(this.id, value, buffer);
- }
- }
- } catch (e) {
- throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
- }
- return buffer;
- };
- /**
- * Calculates the length of this field's value on the network level.
- * @param {*} value Field value
- * @param {!ProtoBuf.Builder.Message} message Runtime message
- * @returns {number} Byte length
- * @expose
- */
- FieldPrototype.calculate = function(value, message) {
- value = this.verifyValue(value); // May throw
- if (this.type === null || typeof this.type !== 'object')
- throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
- if (value === null || (this.repeated && value.length == 0))
- return 0; // Optional omitted
- var n = 0;
- try {
- if (this.repeated) {
- var i, ni;
- if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
- n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
- ni = 0;
- for (i=0; i<value.length; i++)
- ni += this.element.calculateLength(this.id, value[i]);
- n += ByteBuffer.calculateVarint32(ni);
- n += ni;
- } else {
- for (i=0; i<value.length; i++)
- n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
- n += this.element.calculateLength(this.id, value[i]);
- }
- } else if (this.map) {
- // Each map entry becomes a submessage.
- value.forEach(function(val, key, m) {
- // Compute the length of the submessage (key, val) pair.
- var length =
- ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
- this.keyElement.calculateLength(1, key) +
- ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
- this.element.calculateLength(2, val);
- n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
- n += ByteBuffer.calculateVarint32(length);
- n += length;
- }, this);
- } else {
- if (this.hasWirePresence(value, message)) {
- n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
- n += this.element.calculateLength(this.id, value);
- }
- }
- } catch (e) {
- throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
- }
- return n;
- };
- /**
- * Decode the field value from the specified buffer.
- * @param {number} wireType Leading wire type
- * @param {ByteBuffer} buffer ByteBuffer to decode from
- * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
- * @return {*} Decoded value: array for packed repeated fields, [key, value] for
- * map fields, or an individual value otherwise.
- * @throws {Error} If the field cannot be decoded
- * @expose
- */
- FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
- var value, nBytes;
- // We expect wireType to match the underlying type's wireType unless we see
- // a packed repeated field, or unless this is a map field.
- var wireTypeOK =
- (!this.map && wireType == this.type.wireType) ||
- (!skipRepeated && this.repeated && this.options["packed"] &&
- wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
- (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
- if (!wireTypeOK)
- throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
- // Handle packed repeated fields.
- if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
- if (!skipRepeated) {
- nBytes = buffer.readVarint32();
- nBytes = buffer.offset + nBytes; // Limit
- var values = [];
- while (buffer.offset < nBytes)
- values.push(this.decode(this.type.wireType, buffer, true));
- return values;
- }
- // Read the next value otherwise...
- }
- // Handle maps.
- if (this.map) {
- // Read one (key, value) submessage, and return [key, value]
- var key = Element.defaultFieldValue(this.keyType);
- value = Element.defaultFieldValue(this.type);
- // Read the length
- nBytes = buffer.readVarint32();
- if (buffer.remaining() < nBytes)
- throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
- // Get a sub-buffer of this key/value submessage
- var msgbuf = buffer.clone();
- msgbuf.limit = msgbuf.offset + nBytes;
- buffer.offset += nBytes;
- while (msgbuf.remaining() > 0) {
- var tag = msgbuf.readVarint32();
- wireType = tag & 0x07;
- var id = tag >>> 3;
- if (id === 1) {
- key = this.keyElement.decode(msgbuf, wireType, id);
- } else if (id === 2) {
- value = this.element.decode(msgbuf, wireType, id);
- } else {
- throw Error("Unexpected tag in map field key/value submessage");
- }
- }
- return [key, value];
- }
- // Handle singular and non-packed repeated field values.
- return this.element.decode(buffer, wireType, this.id);
- };
- /**
- * @alias ProtoBuf.Reflect.Message.Field
- * @expose
- */
- Reflect.Message.Field = Field;
- /**
- * Constructs a new Message ExtensionField.
- * @exports ProtoBuf.Reflect.Message.ExtensionField
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Message} message Message reference
- * @param {string} rule Rule, one of requried, optional, repeated
- * @param {string} type Data type, e.g. int32
- * @param {string} name Field name
- * @param {number} id Unique field id
- * @param {!Object.<string,*>=} options Options
- * @constructor
- * @extends ProtoBuf.Reflect.Message.Field
- */
- var ExtensionField = function(builder, message, rule, type, name, id, options) {
- Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
- /**
- * Extension reference.
- * @type {!ProtoBuf.Reflect.Extension}
- * @expose
- */
- this.extension;
- };
- // Extends Field
- ExtensionField.prototype = Object.create(Field.prototype);
- /**
- * @alias ProtoBuf.Reflect.Message.ExtensionField
- * @expose
- */
- Reflect.Message.ExtensionField = ExtensionField;
- /**
- * Constructs a new Message OneOf.
- * @exports ProtoBuf.Reflect.Message.OneOf
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Message} message Message reference
- * @param {string} name OneOf name
- * @constructor
- * @extends ProtoBuf.Reflect.T
- */
- var OneOf = function(builder, message, name) {
- T.call(this, builder, message, name);
- /**
- * Enclosed fields.
- * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
- * @expose
- */
- this.fields = [];
- };
- /**
- * @alias ProtoBuf.Reflect.Message.OneOf
- * @expose
- */
- Reflect.Message.OneOf = OneOf;
- /**
- * Constructs a new Enum.
- * @exports ProtoBuf.Reflect.Enum
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
- * @param {string} name Enum name
- * @param {Object.<string,*>=} options Enum options
- * @param {string?} syntax The syntax level (e.g., proto3)
- * @constructor
- * @extends ProtoBuf.Reflect.Namespace
- */
- var Enum = function(builder, parent, name, options, syntax) {
- Namespace.call(this, builder, parent, name, options, syntax);
- /**
- * @override
- */
- this.className = "Enum";
- /**
- * Runtime enum object.
- * @type {Object.<string,number>|null}
- * @expose
- */
- this.object = null;
- };
- /**
- * Gets the string name of an enum value.
- * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
- * @param {number} value Enum value
- * @returns {?string} Name or `null` if not present
- * @expose
- */
- Enum.getName = function(enm, value) {
- var keys = Object.keys(enm);
- for (var i=0, key; i<keys.length; ++i)
- if (enm[key = keys[i]] === value)
- return key;
- return null;
- };
- /**
- * @alias ProtoBuf.Reflect.Enum.prototype
- * @inner
- */
- var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
- /**
- * Builds this enum and returns the runtime counterpart.
- * @param {boolean} rebuild Whether to rebuild or not, defaults to false
- * @returns {!Object.<string,number>}
- * @expose
- */
- EnumPrototype.build = function(rebuild) {
- if (this.object && !rebuild)
- return this.object;
- var enm = new ProtoBuf.Builder.Enum(),
- values = this.getChildren(Enum.Value);
- for (var i=0, k=values.length; i<k; ++i)
- enm[values[i]['name']] = values[i]['id'];
- if (Object.defineProperty)
- Object.defineProperty(enm, '$options', {
- "value": this.buildOpt(),
- "enumerable": false
- });
- return this.object = enm;
- };
- /**
- * @alias ProtoBuf.Reflect.Enum
- * @expose
- */
- Reflect.Enum = Enum;
- /**
- * Constructs a new Enum Value.
- * @exports ProtoBuf.Reflect.Enum.Value
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
- * @param {string} name Field name
- * @param {number} id Unique field id
- * @constructor
- * @extends ProtoBuf.Reflect.T
- */
- var Value = function(builder, enm, name, id) {
- T.call(this, builder, enm, name);
- /**
- * @override
- */
- this.className = "Enum.Value";
- /**
- * Unique enum value id.
- * @type {number}
- * @expose
- */
- this.id = id;
- };
- // Extends T
- Value.prototype = Object.create(T.prototype);
- /**
- * @alias ProtoBuf.Reflect.Enum.Value
- * @expose
- */
- Reflect.Enum.Value = Value;
- /**
- * An extension (field).
- * @exports ProtoBuf.Reflect.Extension
- * @constructor
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.T} parent Parent object
- * @param {string} name Object name
- * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
- */
- var Extension = function(builder, parent, name, field) {
- T.call(this, builder, parent, name);
- /**
- * Extended message field.
- * @type {!ProtoBuf.Reflect.Message.Field}
- * @expose
- */
- this.field = field;
- };
- // Extends T
- Extension.prototype = Object.create(T.prototype);
- /**
- * @alias ProtoBuf.Reflect.Extension
- * @expose
- */
- Reflect.Extension = Extension;
- /**
- * Constructs a new Service.
- * @exports ProtoBuf.Reflect.Service
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Namespace} root Root
- * @param {string} name Service name
- * @param {Object.<string,*>=} options Options
- * @constructor
- * @extends ProtoBuf.Reflect.Namespace
- */
- var Service = function(builder, root, name, options) {
- Namespace.call(this, builder, root, name, options);
- /**
- * @override
- */
- this.className = "Service";
- /**
- * Built runtime service class.
- * @type {?function(new:ProtoBuf.Builder.Service)}
- */
- this.clazz = null;
- };
- /**
- * @alias ProtoBuf.Reflect.Service.prototype
- * @inner
- */
- var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
- /**
- * Builds the service and returns the runtime counterpart, which is a fully functional class.
- * @see ProtoBuf.Builder.Service
- * @param {boolean=} rebuild Whether to rebuild or not
- * @return {Function} Service class
- * @throws {Error} If the message cannot be built
- * @expose
- */
- ServicePrototype.build = function(rebuild) {
- if (this.clazz && !rebuild)
- return this.clazz;
- // Create the runtime Service class in its own scope
- return this.clazz = (function(ProtoBuf, T) {
- /**
- * Constructs a new runtime Service.
- * @name ProtoBuf.Builder.Service
- * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
- * @class Barebone of all runtime services.
- * @constructor
- * @throws {Error} If the service cannot be created
- */
- var Service = function(rpcImpl) {
- ProtoBuf.Builder.Service.call(this);
- /**
- * Service implementation.
- * @name ProtoBuf.Builder.Service#rpcImpl
- * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
- * @expose
- */
- this.rpcImpl = rpcImpl || function(name, msg, callback) {
- // This is what a user has to implement: A function receiving the method name, the actual message to
- // send (type checked) and the callback that's either provided with the error as its first
- // argument or null and the actual response message.
- setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
- };
- };
- /**
- * @alias ProtoBuf.Builder.Service.prototype
- * @inner
- */
- var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
- /**
- * Asynchronously performs an RPC call using the given RPC implementation.
- * @name ProtoBuf.Builder.Service.[Method]
- * @function
- * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
- * @param {ProtoBuf.Builder.Message} req Request
- * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
- * the error if any and the response either as a pre-parsed message or as its raw bytes
- * @abstract
- */
- /**
- * Asynchronously performs an RPC call using the instance's RPC implementation.
- * @name ProtoBuf.Builder.Service#[Method]
- * @function
- * @param {ProtoBuf.Builder.Message} req Request
- * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
- * the error if any and the response either as a pre-parsed message or as its raw bytes
- * @abstract
- */
- var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
- for (var i=0; i<rpc.length; i++) {
- (function(method) {
- // service#Method(message, callback)
- ServicePrototype[method.name] = function(req, callback) {
- try {
- try {
- // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
- req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
- } catch (err) {
- if (!(err instanceof TypeError))
- throw err;
- }
- if (req === null || typeof req !== 'object')
- throw Error("Illegal arguments");
- if (!(req instanceof method.resolvedRequestType.clazz))
- req = new method.resolvedRequestType.clazz(req);
- this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
- if (err) {
- callback(err);
- return;
- }
- // Coalesce to empty string when service response has empty content
- if (res === null)
- res = ''
- try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
- if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
- callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
- return;
- }
- callback(null, res);
- });
- } catch (err) {
- setTimeout(callback.bind(this, err), 0);
- }
- };
- // Service.Method(rpcImpl, message, callback)
- Service[method.name] = function(rpcImpl, req, callback) {
- new Service(rpcImpl)[method.name](req, callback);
- };
- if (Object.defineProperty)
- Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
- Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
- })(rpc[i]);
- }
- // Properties
- /**
- * Service options.
- * @name ProtoBuf.Builder.Service.$options
- * @type {Object.<string,*>}
- * @expose
- */
- var $optionsS; // cc needs this
- /**
- * Service options.
- * @name ProtoBuf.Builder.Service#$options
- * @type {Object.<string,*>}
- * @expose
- */
- var $options;
- /**
- * Reflection type.
- * @name ProtoBuf.Builder.Service.$type
- * @type {!ProtoBuf.Reflect.Service}
- * @expose
- */
- var $typeS;
- /**
- * Reflection type.
- * @name ProtoBuf.Builder.Service#$type
- * @type {!ProtoBuf.Reflect.Service}
- * @expose
- */
- var $type;
- if (Object.defineProperty)
- Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
- Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
- Object.defineProperty(Service, "$type", { "value": T }),
- Object.defineProperty(ServicePrototype, "$type", { "value": T });
- return Service;
- })(ProtoBuf, this);
- };
- /**
- * @alias ProtoBuf.Reflect.Service
- * @expose
- */
- Reflect.Service = Service;
- /**
- * Abstract service method.
- * @exports ProtoBuf.Reflect.Service.Method
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Service} svc Service
- * @param {string} name Method name
- * @param {Object.<string,*>=} options Options
- * @constructor
- * @extends ProtoBuf.Reflect.T
- */
- var Method = function(builder, svc, name, options) {
- T.call(this, builder, svc, name);
- /**
- * @override
- */
- this.className = "Service.Method";
- /**
- * Options.
- * @type {Object.<string, *>}
- * @expose
- */
- this.options = options || {};
- };
- /**
- * @alias ProtoBuf.Reflect.Service.Method.prototype
- * @inner
- */
- var MethodPrototype = Method.prototype = Object.create(T.prototype);
- /**
- * Builds the method's '$options' property.
- * @name ProtoBuf.Reflect.Service.Method#buildOpt
- * @function
- * @return {Object.<string,*>}
- */
- MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
- /**
- * @alias ProtoBuf.Reflect.Service.Method
- * @expose
- */
- Reflect.Service.Method = Method;
- /**
- * RPC service method.
- * @exports ProtoBuf.Reflect.Service.RPCMethod
- * @param {!ProtoBuf.Builder} builder Builder reference
- * @param {!ProtoBuf.Reflect.Service} svc Service
- * @param {string} name Method name
- * @param {string} request Request message name
- * @param {string} response Response message name
- * @param {boolean} request_stream Whether requests are streamed
- * @param {boolean} response_stream Whether responses are streamed
- * @param {Object.<string,*>=} options Options
- * @constructor
- * @extends ProtoBuf.Reflect.Service.Method
- */
- var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
- Method.call(this, builder, svc, name, options);
- /**
- * @override
- */
- this.className = "Service.RPCMethod";
- /**
- * Request message name.
- * @type {string}
- * @expose
- */
- this.requestName = request;
- /**
- * Response message name.
- * @type {string}
- * @expose
- */
- this.responseName = response;
- /**
- * Whether requests are streamed
- * @type {bool}
- * @expose
- */
- this.requestStream = request_stream;
- /**
- * Whether responses are streamed
- * @type {bool}
- * @expose
- */
- this.responseStream = response_stream;
- /**
- * Resolved request message type.
- * @type {ProtoBuf.Reflect.Message}
- * @expose
- */
- this.resolvedRequestType = null;
- /**
- * Resolved response message type.
- * @type {ProtoBuf.Reflect.Message}
- * @expose
- */
- this.resolvedResponseType = null;
- };
- // Extends Method
- RPCMethod.prototype = Object.create(Method.prototype);
- /**
- * @alias ProtoBuf.Reflect.Service.RPCMethod
- * @expose
- */
- Reflect.Service.RPCMethod = RPCMethod;
- return Reflect;
- })(ProtoBuf);
- /**
- * @alias ProtoBuf.Builder
- * @expose
- */
- ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
- "use strict";
- /**
- * Constructs a new Builder.
- * @exports ProtoBuf.Builder
- * @class Provides the functionality to build protocol messages.
- * @param {Object.<string,*>=} options Options
- * @constructor
- */
- var Builder = function(options) {
- /**
- * Namespace.
- * @type {ProtoBuf.Reflect.Namespace}
- * @expose
- */
- this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
- /**
- * Namespace pointer.
- * @type {ProtoBuf.Reflect.T}
- * @expose
- */
- this.ptr = this.ns;
- /**
- * Resolved flag.
- * @type {boolean}
- * @expose
- */
- this.resolved = false;
- /**
- * The current building result.
- * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
- * @expose
- */
- this.result = null;
- /**
- * Imported files.
- * @type {Array.<string>}
- * @expose
- */
- this.files = {};
- /**
- * Import root override.
- * @type {?string}
- * @expose
- */
- this.importRoot = null;
- /**
- * Options.
- * @type {!Object.<string, *>}
- * @expose
- */
- this.options = options || {};
- };
- /**
- * @alias ProtoBuf.Builder.prototype
- * @inner
- */
- var BuilderPrototype = Builder.prototype;
- // ----- Definition tests -----
- /**
- * Tests if a definition most likely describes a message.
- * @param {!Object} def
- * @returns {boolean}
- * @expose
- */
- Builder.isMessage = function(def) {
- // Messages require a string name
- if (typeof def["name"] !== 'string')
- return false;
- // Messages do not contain values (enum) or rpc methods (service)
- if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
- return false;
- return true;
- };
- /**
- * Tests if a definition most likely describes a message field.
- * @param {!Object} def
- * @returns {boolean}
- * @expose
- */
- Builder.isMessageField = function(def) {
- // Message fields require a string rule, name and type and an id
- if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
- return false;
- return true;
- };
- /**
- * Tests if a definition most likely describes an enum.
- * @param {!Object} def
- * @returns {boolean}
- * @expose
- */
- Builder.isEnum = function(def) {
- // Enums require a string name
- if (typeof def["name"] !== 'string')
- return false;
- // Enums require at least one value
- if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
- return false;
- return true;
- };
- /**
- * Tests if a definition most likely describes a service.
- * @param {!Object} def
- * @returns {boolean}
- * @expose
- */
- Builder.isService = function(def) {
- // Services require a string name and an rpc object
- if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
- return false;
- return true;
- };
- /**
- * Tests if a definition most likely describes an extended message
- * @param {!Object} def
- * @returns {boolean}
- * @expose
- */
- Builder.isExtend = function(def) {
- // Extends rquire a string ref
- if (typeof def["ref"] !== 'string')
- return false;
- return true;
- };
- // ----- Building -----
- /**
- * Resets the pointer to the root namespace.
- * @returns {!ProtoBuf.Builder} this
- * @expose
- */
- BuilderPrototype.reset = function() {
- this.ptr = this.ns;
- return this;
- };
- /**
- * Defines a namespace on top of the current pointer position and places the pointer on it.
- * @param {string} namespace
- * @return {!ProtoBuf.Builder} this
- * @expose
- */
- BuilderPrototype.define = function(namespace) {
- if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
- throw Error("illegal namespace: "+namespace);
- namespace.split(".").forEach(function(part) {
- var ns = this.ptr.getChild(part);
- if (ns === null) // Keep existing
- this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
- this.ptr = ns;
- }, this);
- return this;
- };
- /**
- * Creates the specified definitions at the current pointer position.
- * @param {!Array.<!Object>} defs Messages, enums or services to create
- * @returns {!ProtoBuf.Builder} this
- * @throws {Error} If a message definition is invalid
- * @expose
- */
- BuilderPrototype.create = function(defs) {
- if (!defs)
- return this; // Nothing to create
- if (!Array.isArray(defs))
- defs = [defs];
- else {
- if (defs.length === 0)
- return this;
- defs = defs.slice();
- }
- // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
- var stack = [defs];
- while (stack.length > 0) {
- defs = stack.pop();
- if (!Array.isArray(defs)) // Stack always contains entire namespaces
- throw Error("not a valid namespace: "+JSON.stringify(defs));
- while (defs.length > 0) {
- var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
- if (Builder.isMessage(def)) {
- var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
- // Create OneOfs
- var oneofs = {};
- if (def["oneofs"])
- Object.keys(def["oneofs"]).forEach(function(name) {
- obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
- }, this);
- // Create fields
- if (def["fields"])
- def["fields"].forEach(function(fld) {
- if (obj.getChild(fld["id"]|0) !== null)
- throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
- if (fld["options"] && typeof fld["options"] !== 'object')
- throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
- var oneof = null;
- if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
- throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
- fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
- if (oneof)
- oneof.fields.push(fld);
- obj.addChild(fld);
- }, this);
- // Push children to stack
- var subObj = [];
- if (def["enums"])
- def["enums"].forEach(function(enm) {
- subObj.push(enm);
- });
- if (def["messages"])
- def["messages"].forEach(function(msg) {
- subObj.push(msg);
- });
- if (def["services"])
- def["services"].forEach(function(svc) {
- subObj.push(svc);
- });
- // Set extension ranges
- if (def["extensions"]) {
- if (typeof def["extensions"][0] === 'number') // pre 5.0.1
- obj.extensions = [ def["extensions"] ];
- else
- obj.extensions = def["extensions"];
- }
- // Create on top of current namespace
- this.ptr.addChild(obj);
- if (subObj.length > 0) {
- stack.push(defs); // Push the current level back
- defs = subObj; // Continue processing sub level
- subObj = null;
- this.ptr = obj; // And move the pointer to this namespace
- obj = null;
- continue;
- }
- subObj = null;
- } else if (Builder.isEnum(def)) {
- obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
- def["values"].forEach(function(val) {
- obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
- }, this);
- this.ptr.addChild(obj);
- } else if (Builder.isService(def)) {
- obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
- Object.keys(def["rpc"]).forEach(function(name) {
- var mtd = def["rpc"][name];
- obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
- }, this);
- this.ptr.addChild(obj);
- } else if (Builder.isExtend(def)) {
- obj = this.ptr.resolve(def["ref"], true);
- if (obj) {
- def["fields"].forEach(function(fld) {
- if (obj.getChild(fld['id']|0) !== null)
- throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
- // Check if field id is allowed to be extended
- if (obj.extensions) {
- var valid = false;
- obj.extensions.forEach(function(range) {
- if (fld["id"] >= range[0] && fld["id"] <= range[1])
- valid = true;
- });
- if (!valid)
- throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
- }
- // Convert extension field names to camel case notation if the override is set
- var name = fld["name"];
- if (this.options['convertFieldsToCamelCase'])
- name = ProtoBuf.Util.toCamelCase(name);
- // see #161: Extensions use their fully qualified name as their runtime key and...
- var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
- // ...are added on top of the current namespace as an extension which is used for
- // resolving their type later on (the extension always keeps the original name to
- // prevent naming collisions)
- var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
- field.extension = ext;
- this.ptr.addChild(ext);
- obj.addChild(field);
- }, this);
- } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
- throw Error("extended message "+def["ref"]+" is not defined");
- } else
- throw Error("not a valid definition: "+JSON.stringify(def));
- def = null;
- obj = null;
- }
- // Break goes here
- defs = null;
- this.ptr = this.ptr.parent; // Namespace done, continue at parent
- }
- this.resolved = false; // Require re-resolve
- this.result = null; // Require re-build
- return this;
- };
- /**
- * Propagates syntax to all children.
- * @param {!Object} parent
- * @inner
- */
- function propagateSyntax(parent) {
- if (parent['messages']) {
- parent['messages'].forEach(function(child) {
- child["syntax"] = parent["syntax"];
- propagateSyntax(child);
- });
- }
- if (parent['enums']) {
- parent['enums'].forEach(function(child) {
- child["syntax"] = parent["syntax"];
- });
- }
- }
- /**
- * Imports another definition into this builder.
- * @param {Object.<string,*>} json Parsed import
- * @param {(string|{root: string, file: string})=} filename Imported file name
- * @returns {!ProtoBuf.Builder} this
- * @throws {Error} If the definition or file cannot be imported
- * @expose
- */
- BuilderPrototype["import"] = function(json, filename) {
- var delim = '/';
- // Make sure to skip duplicate imports
- if (typeof filename === 'string') {
- if (ProtoBuf.Util.IS_NODE)
- filename = __webpack_require__(117)['resolve'](filename);
- if (this.files[filename] === true)
- return this.reset();
- this.files[filename] = true;
- } else if (typeof filename === 'object') { // Object with root, file.
- var root = filename.root;
- if (ProtoBuf.Util.IS_NODE)
- root = __webpack_require__(117)['resolve'](root);
- if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
- delim = '\\';
- var fname;
- if (ProtoBuf.Util.IS_NODE)
- fname = __webpack_require__(117)['join'](root, filename.file);
- else
- fname = root + delim + filename.file;
- if (this.files[fname] === true)
- return this.reset();
- this.files[fname] = true;
- }
- // Import imports
- if (json['imports'] && json['imports'].length > 0) {
- var importRoot,
- resetRoot = false;
- if (typeof filename === 'object') { // If an import root is specified, override
- this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
- importRoot = this.importRoot;
- filename = filename["file"];
- if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
- delim = '\\';
- } else if (typeof filename === 'string') {
- if (this.importRoot) // If import root is overridden, use it
- importRoot = this.importRoot;
- else { // Otherwise compute from filename
- if (filename.indexOf("/") >= 0) { // Unix
- importRoot = filename.replace(/\/[^\/]*$/, "");
- if (/* /file.proto */ importRoot === "")
- importRoot = "/";
- } else if (filename.indexOf("\\") >= 0) { // Windows
- importRoot = filename.replace(/\\[^\\]*$/, "");
- delim = '\\';
- } else
- importRoot = ".";
- }
- } else
- importRoot = null;
- for (var i=0; i<json['imports'].length; i++) {
- if (typeof json['imports'][i] === 'string') { // Import file
- if (!importRoot)
- throw Error("cannot determine import root");
- var importFilename = json['imports'][i];
- if (importFilename === "google/protobuf/descriptor.proto")
- continue; // Not needed and therefore not used
- if (ProtoBuf.Util.IS_NODE)
- importFilename = __webpack_require__(117)['join'](importRoot, importFilename);
- else
- importFilename = importRoot + delim + importFilename;
- if (this.files[importFilename] === true)
- continue; // Already imported
- if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
- importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
- var contents = ProtoBuf.Util.fetch(importFilename);
- if (contents === null)
- throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
- if (/\.json$/i.test(importFilename)) // Always possible
- this["import"](JSON.parse(contents+""), importFilename); // May throw
- else
- this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
- } else // Import structure
- if (!filename)
- this["import"](json['imports'][i]);
- else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
- this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
- else // Without extension: Append _importN to make it unique
- this["import"](json['imports'][i], filename+"_import"+i);
- }
- if (resetRoot) // Reset import root override when all imports are done
- this.importRoot = null;
- }
- // Import structures
- if (json['package'])
- this.define(json['package']);
- if (json['syntax'])
- propagateSyntax(json);
- var base = this.ptr;
- if (json['options'])
- Object.keys(json['options']).forEach(function(key) {
- base.options[key] = json['options'][key];
- });
- if (json['messages'])
- this.create(json['messages']),
- this.ptr = base;
- if (json['enums'])
- this.create(json['enums']),
- this.ptr = base;
- if (json['services'])
- this.create(json['services']),
- this.ptr = base;
- if (json['extends'])
- this.create(json['extends']);
- return this.reset();
- };
- /**
- * Resolves all namespace objects.
- * @throws {Error} If a type cannot be resolved
- * @returns {!ProtoBuf.Builder} this
- * @expose
- */
- BuilderPrototype.resolveAll = function() {
- // Resolve all reflected objects
- var res;
- if (this.ptr == null || typeof this.ptr.type === 'object')
- return this; // Done (already resolved)
- if (this.ptr instanceof Reflect.Namespace) { // Resolve children
- this.ptr.children.forEach(function(child) {
- this.ptr = child;
- this.resolveAll();
- }, this);
- } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
- if (!Lang.TYPE.test(this.ptr.type)) {
- if (!Lang.TYPEREF.test(this.ptr.type))
- throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
- res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
- if (!res)
- throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
- this.ptr.resolvedType = res;
- if (res instanceof Reflect.Enum) {
- this.ptr.type = ProtoBuf.TYPES["enum"];
- if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
- throw Error("proto3 message cannot reference proto2 enum");
- }
- else if (res instanceof Reflect.Message)
- this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
- else
- throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
- } else
- this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
- // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
- // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
- if (this.ptr.map) {
- if (!Lang.TYPE.test(this.ptr.keyType))
- throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
- this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
- }
- // If it's a repeated and packable field then proto3 mandates it should be packed by
- // default
- if (
- this.ptr.syntax === 'proto3' &&
- this.ptr.repeated && this.ptr.options.packed === undefined &&
- ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
- ) {
- this.ptr.options.packed = true;
- }
- } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
- if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
- res = this.ptr.parent.resolve(this.ptr.requestName, true);
- if (!res || !(res instanceof ProtoBuf.Reflect.Message))
- throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
- this.ptr.resolvedRequestType = res;
- res = this.ptr.parent.resolve(this.ptr.responseName, true);
- if (!res || !(res instanceof ProtoBuf.Reflect.Message))
- throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
- this.ptr.resolvedResponseType = res;
- } else // Should not happen as nothing else is implemented
- throw Error("illegal service type in "+this.ptr.toString(true));
- } else if (
- !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
- !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
- !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
- )
- throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
- return this.reset();
- };
- /**
- * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
- * return the built package.
- * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
- * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
- * @throws {Error} If a type could not be resolved
- * @expose
- */
- BuilderPrototype.build = function(path) {
- this.reset();
- if (!this.resolved)
- this.resolveAll(),
- this.resolved = true,
- this.result = null; // Require re-build
- if (this.result === null) // (Re-)Build
- this.result = this.ns.build();
- if (!path)
- return this.result;
- var part = typeof path === 'string' ? path.split(".") : path,
- ptr = this.result; // Build namespace pointer (no hasChild etc.)
- for (var i=0; i<part.length; i++)
- if (ptr[part[i]])
- ptr = ptr[part[i]];
- else {
- ptr = null;
- break;
- }
- return ptr;
- };
- /**
- * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
- * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
- * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
- * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
- */
- BuilderPrototype.lookup = function(path, excludeNonNamespace) {
- return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
- };
- /**
- * Returns a string representation of this object.
- * @return {string} String representation as of "Builder"
- * @expose
- */
- BuilderPrototype.toString = function() {
- return "Builder";
- };
- // ----- Base classes -----
- // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
- /**
- * @alias ProtoBuf.Builder.Message
- */
- Builder.Message = function() {};
- /**
- * @alias ProtoBuf.Builder.Enum
- */
- Builder.Enum = function() {};
- /**
- * @alias ProtoBuf.Builder.Message
- */
- Builder.Service = function() {};
- return Builder;
- })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
- /**
- * @alias ProtoBuf.Map
- * @expose
- */
- ProtoBuf.Map = (function(ProtoBuf, Reflect) {
- "use strict";
- /**
- * Constructs a new Map. A Map is a container that is used to implement map
- * fields on message objects. It closely follows the ES6 Map API; however,
- * it is distinct because we do not want to depend on external polyfills or
- * on ES6 itself.
- *
- * @exports ProtoBuf.Map
- * @param {!ProtoBuf.Reflect.Field} field Map field
- * @param {Object.<string,*>=} contents Initial contents
- * @constructor
- */
- var Map = function(field, contents) {
- if (!field.map)
- throw Error("field is not a map");
- /**
- * The field corresponding to this map.
- * @type {!ProtoBuf.Reflect.Field}
- */
- this.field = field;
- /**
- * Element instance corresponding to key type.
- * @type {!ProtoBuf.Reflect.Element}
- */
- this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
- /**
- * Element instance corresponding to value type.
- * @type {!ProtoBuf.Reflect.Element}
- */
- this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
- /**
- * Internal map: stores mapping of (string form of key) -> (key, value)
- * pair.
- *
- * We provide map semantics for arbitrary key types, but we build on top
- * of an Object, which has only string keys. In order to avoid the need
- * to convert a string key back to its native type in many situations,
- * we store the native key value alongside the value. Thus, we only need
- * a one-way mapping from a key type to its string form that guarantees
- * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
- * === K2).
- *
- * @type {!Object<string, {key: *, value: *}>}
- */
- this.map = {};
- /**
- * Returns the number of elements in the map.
- */
- Object.defineProperty(this, "size", {
- get: function() { return Object.keys(this.map).length; }
- });
- // Fill initial contents from a raw object.
- if (contents) {
- var keys = Object.keys(contents);
- for (var i = 0; i < keys.length; i++) {
- var key = this.keyElem.valueFromString(keys[i]);
- var val = this.valueElem.verifyValue(contents[keys[i]]);
- this.map[this.keyElem.valueToString(key)] =
- { key: key, value: val };
- }
- }
- };
- var MapPrototype = Map.prototype;
- /**
- * Helper: return an iterator over an array.
- * @param {!Array<*>} arr the array
- * @returns {!Object} an iterator
- * @inner
- */
- function arrayIterator(arr) {
- var idx = 0;
- return {
- next: function() {
- if (idx < arr.length)
- return { done: false, value: arr[idx++] };
- return { done: true };
- }
- }
- }
- /**
- * Clears the map.
- */
- MapPrototype.clear = function() {
- this.map = {};
- };
- /**
- * Deletes a particular key from the map.
- * @returns {boolean} Whether any entry with this key was deleted.
- */
- MapPrototype["delete"] = function(key) {
- var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
- var hadKey = keyValue in this.map;
- delete this.map[keyValue];
- return hadKey;
- };
- /**
- * Returns an iterator over [key, value] pairs in the map.
- * @returns {Object} The iterator
- */
- MapPrototype.entries = function() {
- var entries = [];
- var strKeys = Object.keys(this.map);
- for (var i = 0, entry; i < strKeys.length; i++)
- entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
- return arrayIterator(entries);
- };
- /**
- * Returns an iterator over keys in the map.
- * @returns {Object} The iterator
- */
- MapPrototype.keys = function() {
- var keys = [];
- var strKeys = Object.keys(this.map);
- for (var i = 0; i < strKeys.length; i++)
- keys.push(this.map[strKeys[i]].key);
- return arrayIterator(keys);
- };
- /**
- * Returns an iterator over values in the map.
- * @returns {!Object} The iterator
- */
- MapPrototype.values = function() {
- var values = [];
- var strKeys = Object.keys(this.map);
- for (var i = 0; i < strKeys.length; i++)
- values.push(this.map[strKeys[i]].value);
- return arrayIterator(values);
- };
- /**
- * Iterates over entries in the map, calling a function on each.
- * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
- * @param {Object=} thisArg The `this` value for the callback
- */
- MapPrototype.forEach = function(cb, thisArg) {
- var strKeys = Object.keys(this.map);
- for (var i = 0, entry; i < strKeys.length; i++)
- cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
- };
- /**
- * Sets a key in the map to the given value.
- * @param {*} key The key
- * @param {*} value The value
- * @returns {!ProtoBuf.Map} The map instance
- */
- MapPrototype.set = function(key, value) {
- var keyValue = this.keyElem.verifyValue(key);
- var valValue = this.valueElem.verifyValue(value);
- this.map[this.keyElem.valueToString(keyValue)] =
- { key: keyValue, value: valValue };
- return this;
- };
- /**
- * Gets the value corresponding to a key in the map.
- * @param {*} key The key
- * @returns {*|undefined} The value, or `undefined` if key not present
- */
- MapPrototype.get = function(key) {
- var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
- if (!(keyValue in this.map))
- return undefined;
- return this.map[keyValue].value;
- };
- /**
- * Determines whether the given key is present in the map.
- * @param {*} key The key
- * @returns {boolean} `true` if the key is present
- */
- MapPrototype.has = function(key) {
- var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
- return (keyValue in this.map);
- };
- return Map;
- })(ProtoBuf, ProtoBuf.Reflect);
- /**
- * Constructs a new empty Builder.
- * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
- * @return {!ProtoBuf.Builder} Builder
- * @expose
- */
- ProtoBuf.newBuilder = function(options) {
- options = options || {};
- if (typeof options['convertFieldsToCamelCase'] === 'undefined')
- options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
- if (typeof options['populateAccessors'] === 'undefined')
- options['populateAccessors'] = ProtoBuf.populateAccessors;
- return new ProtoBuf.Builder(options);
- };
- /**
- * Loads a .json definition and returns the Builder.
- * @param {!*|string} json JSON definition
- * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
- * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
- * @return {ProtoBuf.Builder} Builder to create new messages
- * @throws {Error} If the definition cannot be parsed or built
- * @expose
- */
- ProtoBuf.loadJson = function(json, builder, filename) {
- if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
- filename = builder,
- builder = null;
- if (!builder || typeof builder !== 'object')
- builder = ProtoBuf.newBuilder();
- if (typeof json === 'string')
- json = JSON.parse(json);
- builder["import"](json, filename);
- builder.resolveAll();
- return builder;
- };
- /**
- * Loads a .json file and returns the Builder.
- * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
- * an overridden 'root' path for all imported files.
- * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
- * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
- * file will be read synchronously and this function will return the Builder.
- * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
- * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
- * request has failed), else undefined
- * @expose
- */
- ProtoBuf.loadJsonFile = function(filename, callback, builder) {
- if (callback && typeof callback === 'object')
- builder = callback,
- callback = null;
- else if (!callback || typeof callback !== 'function')
- callback = null;
- if (callback)
- return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
- if (contents === null) {
- callback(Error("Failed to fetch file"));
- return;
- }
- try {
- callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
- } catch (e) {
- callback(e);
- }
- });
- var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
- return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
- };
- return ProtoBuf;
- });
- /***/ }),
- /* 613 */
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
- Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
- * Backing buffer: ArrayBuffer, Accessor: Uint8Array
- * Released under the Apache License, Version 2.0
- * see: https://github.com/dcodeIO/bytebuffer.js for details
- */
- (function(global, factory) {
- /* AMD */ if (true)
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(614)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
- module['exports'] = (function() {
- var Long; try { Long = require("long"); } catch (e) {}
- return factory(Long);
- })();
- /* Global */ else
- (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
- })(this, function(Long) {
- "use strict";
- /**
- * Constructs a new ByteBuffer.
- * @class The swiss army knife for binary data in JavaScript.
- * @exports ByteBuffer
- * @constructor
- * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @expose
- */
- var ByteBuffer = function(capacity, littleEndian, noAssert) {
- if (typeof capacity === 'undefined')
- capacity = ByteBuffer.DEFAULT_CAPACITY;
- if (typeof littleEndian === 'undefined')
- littleEndian = ByteBuffer.DEFAULT_ENDIAN;
- if (typeof noAssert === 'undefined')
- noAssert = ByteBuffer.DEFAULT_NOASSERT;
- if (!noAssert) {
- capacity = capacity | 0;
- if (capacity < 0)
- throw RangeError("Illegal capacity");
- littleEndian = !!littleEndian;
- noAssert = !!noAssert;
- }
- /**
- * Backing ArrayBuffer.
- * @type {!ArrayBuffer}
- * @expose
- */
- this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
- /**
- * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
- * @type {?Uint8Array}
- * @expose
- */
- this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
- /**
- * Absolute read/write offset.
- * @type {number}
- * @expose
- * @see ByteBuffer#flip
- * @see ByteBuffer#clear
- */
- this.offset = 0;
- /**
- * Marked offset.
- * @type {number}
- * @expose
- * @see ByteBuffer#mark
- * @see ByteBuffer#reset
- */
- this.markedOffset = -1;
- /**
- * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
- * @type {number}
- * @expose
- * @see ByteBuffer#flip
- * @see ByteBuffer#clear
- */
- this.limit = capacity;
- /**
- * Whether to use little endian byte order, defaults to `false` for big endian.
- * @type {boolean}
- * @expose
- */
- this.littleEndian = littleEndian;
- /**
- * Whether to skip assertions of offsets and values, defaults to `false`.
- * @type {boolean}
- * @expose
- */
- this.noAssert = noAssert;
- };
- /**
- * ByteBuffer version.
- * @type {string}
- * @const
- * @expose
- */
- ByteBuffer.VERSION = "5.0.1";
- /**
- * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
- * @type {boolean}
- * @const
- * @expose
- */
- ByteBuffer.LITTLE_ENDIAN = true;
- /**
- * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
- * @type {boolean}
- * @const
- * @expose
- */
- ByteBuffer.BIG_ENDIAN = false;
- /**
- * Default initial capacity of `16`.
- * @type {number}
- * @expose
- */
- ByteBuffer.DEFAULT_CAPACITY = 16;
- /**
- * Default endianess of `false` for big endian.
- * @type {boolean}
- * @expose
- */
- ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
- /**
- * Default no assertions flag of `false`.
- * @type {boolean}
- * @expose
- */
- ByteBuffer.DEFAULT_NOASSERT = false;
- /**
- * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
- * and int64 support is not available.
- * @type {?Long}
- * @const
- * @see https://github.com/dcodeIO/long.js
- * @expose
- */
- ByteBuffer.Long = Long || null;
- /**
- * @alias ByteBuffer.prototype
- * @inner
- */
- var ByteBufferPrototype = ByteBuffer.prototype;
- /**
- * An indicator used to reliably determine if an object is a ByteBuffer or not.
- * @type {boolean}
- * @const
- * @expose
- * @private
- */
- ByteBufferPrototype.__isByteBuffer__;
- Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
- value: true,
- enumerable: false,
- configurable: false
- });
- // helpers
- /**
- * @type {!ArrayBuffer}
- * @inner
- */
- var EMPTY_BUFFER = new ArrayBuffer(0);
- /**
- * String.fromCharCode reference for compile-time renaming.
- * @type {function(...number):string}
- * @inner
- */
- var stringFromCharCode = String.fromCharCode;
- /**
- * Creates a source function for a string.
- * @param {string} s String to read from
- * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
- * no more characters left.
- * @throws {TypeError} If the argument is invalid
- * @inner
- */
- function stringSource(s) {
- var i=0; return function() {
- return i < s.length ? s.charCodeAt(i++) : null;
- };
- }
- /**
- * Creates a destination function for a string.
- * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
- * Returns the final string when called without arguments.
- * @inner
- */
- function stringDestination() {
- var cs = [], ps = []; return function() {
- if (arguments.length === 0)
- return ps.join('')+stringFromCharCode.apply(String, cs);
- if (cs.length + arguments.length > 1024)
- ps.push(stringFromCharCode.apply(String, cs)),
- cs.length = 0;
- Array.prototype.push.apply(cs, arguments);
- };
- }
- /**
- * Gets the accessor type.
- * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
- * @expose
- */
- ByteBuffer.accessor = function() {
- return Uint8Array;
- };
- /**
- * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
- * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @returns {!ByteBuffer}
- * @expose
- */
- ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
- return new ByteBuffer(capacity, littleEndian, noAssert);
- };
- /**
- * Concatenates multiple ByteBuffers into one.
- * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
- * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
- * defaults to "utf8")
- * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
- * to {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @returns {!ByteBuffer} Concatenated ByteBuffer
- * @expose
- */
- ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
- if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
- noAssert = littleEndian;
- littleEndian = encoding;
- encoding = undefined;
- }
- var capacity = 0;
- for (var i=0, k=buffers.length, length; i<k; ++i) {
- if (!ByteBuffer.isByteBuffer(buffers[i]))
- buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
- length = buffers[i].limit - buffers[i].offset;
- if (length > 0) capacity += length;
- }
- if (capacity === 0)
- return new ByteBuffer(0, littleEndian, noAssert);
- var bb = new ByteBuffer(capacity, littleEndian, noAssert),
- bi;
- i=0; while (i<k) {
- bi = buffers[i++];
- length = bi.limit - bi.offset;
- if (length <= 0) continue;
- bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
- bb.offset += length;
- }
- bb.limit = bb.offset;
- bb.offset = 0;
- return bb;
- };
- /**
- * Tests if the specified type is a ByteBuffer.
- * @param {*} bb ByteBuffer to test
- * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
- * @expose
- */
- ByteBuffer.isByteBuffer = function(bb) {
- return (bb && bb["__isByteBuffer__"]) === true;
- };
- /**
- * Gets the backing buffer type.
- * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
- * @expose
- */
- ByteBuffer.type = function() {
- return ArrayBuffer;
- };
- /**
- * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
- * {@link ByteBuffer#limit} to the length of the wrapped data.
- * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
- * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
- * "utf8")
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
- * @expose
- */
- ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
- if (typeof encoding !== 'string') {
- noAssert = littleEndian;
- littleEndian = encoding;
- encoding = undefined;
- }
- if (typeof buffer === 'string') {
- if (typeof encoding === 'undefined')
- encoding = "utf8";
- switch (encoding) {
- case "base64":
- return ByteBuffer.fromBase64(buffer, littleEndian);
- case "hex":
- return ByteBuffer.fromHex(buffer, littleEndian);
- case "binary":
- return ByteBuffer.fromBinary(buffer, littleEndian);
- case "utf8":
- return ByteBuffer.fromUTF8(buffer, littleEndian);
- case "debug":
- return ByteBuffer.fromDebug(buffer, littleEndian);
- default:
- throw Error("Unsupported encoding: "+encoding);
- }
- }
- if (buffer === null || typeof buffer !== 'object')
- throw TypeError("Illegal buffer");
- var bb;
- if (ByteBuffer.isByteBuffer(buffer)) {
- bb = ByteBufferPrototype.clone.call(buffer);
- bb.markedOffset = -1;
- return bb;
- }
- if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
- bb = new ByteBuffer(0, littleEndian, noAssert);
- if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
- bb.buffer = buffer.buffer;
- bb.offset = buffer.byteOffset;
- bb.limit = buffer.byteOffset + buffer.byteLength;
- bb.view = new Uint8Array(buffer.buffer);
- }
- } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
- bb = new ByteBuffer(0, littleEndian, noAssert);
- if (buffer.byteLength > 0) {
- bb.buffer = buffer;
- bb.offset = 0;
- bb.limit = buffer.byteLength;
- bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
- }
- } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
- bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
- bb.limit = buffer.length;
- for (var i=0; i<buffer.length; ++i)
- bb.view[i] = buffer[i];
- } else
- throw TypeError("Illegal buffer"); // Otherwise fail
- return bb;
- };
- /**
- * Writes the array as a bitset.
- * @param {Array<boolean>} value Array of booleans to write
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
- * @returns {!ByteBuffer}
- * @expose
- */
- ByteBufferPrototype.writeBitSet = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (!(value instanceof Array))
- throw TypeError("Illegal BitSet: Not an array");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- var start = offset,
- bits = value.length,
- bytes = (bits >> 3),
- bit = 0,
- k;
- offset += this.writeVarint32(bits,offset);
- while(bytes--) {
- k = (!!value[bit++] & 1) |
- ((!!value[bit++] & 1) << 1) |
- ((!!value[bit++] & 1) << 2) |
- ((!!value[bit++] & 1) << 3) |
- ((!!value[bit++] & 1) << 4) |
- ((!!value[bit++] & 1) << 5) |
- ((!!value[bit++] & 1) << 6) |
- ((!!value[bit++] & 1) << 7);
- this.writeByte(k,offset++);
- }
- if(bit < bits) {
- var m = 0; k = 0;
- while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
- this.writeByte(k,offset++);
- }
- if (relative) {
- this.offset = offset;
- return this;
- }
- return offset - start;
- }
- /**
- * Reads a BitSet as an array of booleans.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
- * @returns {Array<boolean>
- * @expose
- */
- ByteBufferPrototype.readBitSet = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- var ret = this.readVarint32(offset),
- bits = ret.value,
- bytes = (bits >> 3),
- bit = 0,
- value = [],
- k;
- offset += ret.length;
- while(bytes--) {
- k = this.readByte(offset++);
- value[bit++] = !!(k & 0x01);
- value[bit++] = !!(k & 0x02);
- value[bit++] = !!(k & 0x04);
- value[bit++] = !!(k & 0x08);
- value[bit++] = !!(k & 0x10);
- value[bit++] = !!(k & 0x20);
- value[bit++] = !!(k & 0x40);
- value[bit++] = !!(k & 0x80);
- }
- if(bit < bits) {
- var m = 0;
- k = this.readByte(offset++);
- while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
- }
- if (relative) {
- this.offset = offset;
- }
- return value;
- }
- /**
- * Reads the specified number of bytes.
- * @param {number} length Number of bytes to read
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
- * @returns {!ByteBuffer}
- * @expose
- */
- ByteBufferPrototype.readBytes = function(length, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + length > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
- }
- var slice = this.slice(offset, offset + length);
- if (relative) this.offset += length;
- return slice;
- };
- /**
- * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
- * @function
- * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
- * will be modified according to the performed read operation.
- * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
- // types/ints/int8
- /**
- * Writes an 8bit signed integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeInt8 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value |= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 1;
- var capacity0 = this.buffer.byteLength;
- if (offset > capacity0)
- this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
- offset -= 1;
- this.view[offset] = value;
- if (relative) this.offset += 1;
- return this;
- };
- /**
- * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
- /**
- * Reads an 8bit signed integer.
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readInt8 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 1 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
- }
- var value = this.view[offset];
- if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
- if (relative) this.offset += 1;
- return value;
- };
- /**
- * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
- * @function
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
- /**
- * Writes an 8bit unsigned integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeUint8 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value >>>= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 1;
- var capacity1 = this.buffer.byteLength;
- if (offset > capacity1)
- this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
- offset -= 1;
- this.view[offset] = value;
- if (relative) this.offset += 1;
- return this;
- };
- /**
- * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
- /**
- * Reads an 8bit unsigned integer.
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readUint8 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 1 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
- }
- var value = this.view[offset];
- if (relative) this.offset += 1;
- return value;
- };
- /**
- * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
- * @function
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
- // types/ints/int16
- /**
- * Writes a 16bit signed integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @throws {TypeError} If `offset` or `value` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.writeInt16 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value |= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 2;
- var capacity2 = this.buffer.byteLength;
- if (offset > capacity2)
- this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
- offset -= 2;
- if (this.littleEndian) {
- this.view[offset+1] = (value & 0xFF00) >>> 8;
- this.view[offset ] = value & 0x00FF;
- } else {
- this.view[offset] = (value & 0xFF00) >>> 8;
- this.view[offset+1] = value & 0x00FF;
- }
- if (relative) this.offset += 2;
- return this;
- };
- /**
- * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @throws {TypeError} If `offset` or `value` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
- /**
- * Reads a 16bit signed integer.
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @returns {number} Value read
- * @throws {TypeError} If `offset` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.readInt16 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 2 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
- }
- var value = 0;
- if (this.littleEndian) {
- value = this.view[offset ];
- value |= this.view[offset+1] << 8;
- } else {
- value = this.view[offset ] << 8;
- value |= this.view[offset+1];
- }
- if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
- if (relative) this.offset += 2;
- return value;
- };
- /**
- * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
- * @function
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @returns {number} Value read
- * @throws {TypeError} If `offset` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
- /**
- * Writes a 16bit unsigned integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @throws {TypeError} If `offset` or `value` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.writeUint16 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value >>>= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 2;
- var capacity3 = this.buffer.byteLength;
- if (offset > capacity3)
- this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
- offset -= 2;
- if (this.littleEndian) {
- this.view[offset+1] = (value & 0xFF00) >>> 8;
- this.view[offset ] = value & 0x00FF;
- } else {
- this.view[offset] = (value & 0xFF00) >>> 8;
- this.view[offset+1] = value & 0x00FF;
- }
- if (relative) this.offset += 2;
- return this;
- };
- /**
- * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @throws {TypeError} If `offset` or `value` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
- /**
- * Reads a 16bit unsigned integer.
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @returns {number} Value read
- * @throws {TypeError} If `offset` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.readUint16 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 2 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
- }
- var value = 0;
- if (this.littleEndian) {
- value = this.view[offset ];
- value |= this.view[offset+1] << 8;
- } else {
- value = this.view[offset ] << 8;
- value |= this.view[offset+1];
- }
- if (relative) this.offset += 2;
- return value;
- };
- /**
- * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
- * @function
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
- * @returns {number} Value read
- * @throws {TypeError} If `offset` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @expose
- */
- ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
- // types/ints/int32
- /**
- * Writes a 32bit signed integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @expose
- */
- ByteBufferPrototype.writeInt32 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value |= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 4;
- var capacity4 = this.buffer.byteLength;
- if (offset > capacity4)
- this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
- offset -= 4;
- if (this.littleEndian) {
- this.view[offset+3] = (value >>> 24) & 0xFF;
- this.view[offset+2] = (value >>> 16) & 0xFF;
- this.view[offset+1] = (value >>> 8) & 0xFF;
- this.view[offset ] = value & 0xFF;
- } else {
- this.view[offset ] = (value >>> 24) & 0xFF;
- this.view[offset+1] = (value >>> 16) & 0xFF;
- this.view[offset+2] = (value >>> 8) & 0xFF;
- this.view[offset+3] = value & 0xFF;
- }
- if (relative) this.offset += 4;
- return this;
- };
- /**
- * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @expose
- */
- ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
- /**
- * Reads a 32bit signed integer.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readInt32 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 4 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
- }
- var value = 0;
- if (this.littleEndian) {
- value = this.view[offset+2] << 16;
- value |= this.view[offset+1] << 8;
- value |= this.view[offset ];
- value += this.view[offset+3] << 24 >>> 0;
- } else {
- value = this.view[offset+1] << 16;
- value |= this.view[offset+2] << 8;
- value |= this.view[offset+3];
- value += this.view[offset ] << 24 >>> 0;
- }
- value |= 0; // Cast to signed
- if (relative) this.offset += 4;
- return value;
- };
- /**
- * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
- * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
- /**
- * Writes a 32bit unsigned integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @expose
- */
- ByteBufferPrototype.writeUint32 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value >>>= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 4;
- var capacity5 = this.buffer.byteLength;
- if (offset > capacity5)
- this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
- offset -= 4;
- if (this.littleEndian) {
- this.view[offset+3] = (value >>> 24) & 0xFF;
- this.view[offset+2] = (value >>> 16) & 0xFF;
- this.view[offset+1] = (value >>> 8) & 0xFF;
- this.view[offset ] = value & 0xFF;
- } else {
- this.view[offset ] = (value >>> 24) & 0xFF;
- this.view[offset+1] = (value >>> 16) & 0xFF;
- this.view[offset+2] = (value >>> 8) & 0xFF;
- this.view[offset+3] = value & 0xFF;
- }
- if (relative) this.offset += 4;
- return this;
- };
- /**
- * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @expose
- */
- ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
- /**
- * Reads a 32bit unsigned integer.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readUint32 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 4 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
- }
- var value = 0;
- if (this.littleEndian) {
- value = this.view[offset+2] << 16;
- value |= this.view[offset+1] << 8;
- value |= this.view[offset ];
- value += this.view[offset+3] << 24 >>> 0;
- } else {
- value = this.view[offset+1] << 16;
- value |= this.view[offset+2] << 8;
- value |= this.view[offset+3];
- value += this.view[offset ] << 24 >>> 0;
- }
- if (relative) this.offset += 4;
- return value;
- };
- /**
- * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
- * @function
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {number} Value read
- * @expose
- */
- ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
- // types/ints/int64
- if (Long) {
- /**
- * Writes a 64bit signed integer.
- * @param {number|!Long} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeInt64 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value === 'number')
- value = Long.fromNumber(value);
- else if (typeof value === 'string')
- value = Long.fromString(value);
- else if (!(value && value instanceof Long))
- throw TypeError("Illegal value: "+value+" (not an integer or Long)");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- if (typeof value === 'number')
- value = Long.fromNumber(value);
- else if (typeof value === 'string')
- value = Long.fromString(value);
- offset += 8;
- var capacity6 = this.buffer.byteLength;
- if (offset > capacity6)
- this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
- offset -= 8;
- var lo = value.low,
- hi = value.high;
- if (this.littleEndian) {
- this.view[offset+3] = (lo >>> 24) & 0xFF;
- this.view[offset+2] = (lo >>> 16) & 0xFF;
- this.view[offset+1] = (lo >>> 8) & 0xFF;
- this.view[offset ] = lo & 0xFF;
- offset += 4;
- this.view[offset+3] = (hi >>> 24) & 0xFF;
- this.view[offset+2] = (hi >>> 16) & 0xFF;
- this.view[offset+1] = (hi >>> 8) & 0xFF;
- this.view[offset ] = hi & 0xFF;
- } else {
- this.view[offset ] = (hi >>> 24) & 0xFF;
- this.view[offset+1] = (hi >>> 16) & 0xFF;
- this.view[offset+2] = (hi >>> 8) & 0xFF;
- this.view[offset+3] = hi & 0xFF;
- offset += 4;
- this.view[offset ] = (lo >>> 24) & 0xFF;
- this.view[offset+1] = (lo >>> 16) & 0xFF;
- this.view[offset+2] = (lo >>> 8) & 0xFF;
- this.view[offset+3] = lo & 0xFF;
- }
- if (relative) this.offset += 8;
- return this;
- };
- /**
- * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
- * @param {number|!Long} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
- /**
- * Reads a 64bit signed integer.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!Long}
- * @expose
- */
- ByteBufferPrototype.readInt64 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 8 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
- }
- var lo = 0,
- hi = 0;
- if (this.littleEndian) {
- lo = this.view[offset+2] << 16;
- lo |= this.view[offset+1] << 8;
- lo |= this.view[offset ];
- lo += this.view[offset+3] << 24 >>> 0;
- offset += 4;
- hi = this.view[offset+2] << 16;
- hi |= this.view[offset+1] << 8;
- hi |= this.view[offset ];
- hi += this.view[offset+3] << 24 >>> 0;
- } else {
- hi = this.view[offset+1] << 16;
- hi |= this.view[offset+2] << 8;
- hi |= this.view[offset+3];
- hi += this.view[offset ] << 24 >>> 0;
- offset += 4;
- lo = this.view[offset+1] << 16;
- lo |= this.view[offset+2] << 8;
- lo |= this.view[offset+3];
- lo += this.view[offset ] << 24 >>> 0;
- }
- var value = new Long(lo, hi, false);
- if (relative) this.offset += 8;
- return value;
- };
- /**
- * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!Long}
- * @expose
- */
- ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
- /**
- * Writes a 64bit unsigned integer.
- * @param {number|!Long} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeUint64 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value === 'number')
- value = Long.fromNumber(value);
- else if (typeof value === 'string')
- value = Long.fromString(value);
- else if (!(value && value instanceof Long))
- throw TypeError("Illegal value: "+value+" (not an integer or Long)");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- if (typeof value === 'number')
- value = Long.fromNumber(value);
- else if (typeof value === 'string')
- value = Long.fromString(value);
- offset += 8;
- var capacity7 = this.buffer.byteLength;
- if (offset > capacity7)
- this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
- offset -= 8;
- var lo = value.low,
- hi = value.high;
- if (this.littleEndian) {
- this.view[offset+3] = (lo >>> 24) & 0xFF;
- this.view[offset+2] = (lo >>> 16) & 0xFF;
- this.view[offset+1] = (lo >>> 8) & 0xFF;
- this.view[offset ] = lo & 0xFF;
- offset += 4;
- this.view[offset+3] = (hi >>> 24) & 0xFF;
- this.view[offset+2] = (hi >>> 16) & 0xFF;
- this.view[offset+1] = (hi >>> 8) & 0xFF;
- this.view[offset ] = hi & 0xFF;
- } else {
- this.view[offset ] = (hi >>> 24) & 0xFF;
- this.view[offset+1] = (hi >>> 16) & 0xFF;
- this.view[offset+2] = (hi >>> 8) & 0xFF;
- this.view[offset+3] = hi & 0xFF;
- offset += 4;
- this.view[offset ] = (lo >>> 24) & 0xFF;
- this.view[offset+1] = (lo >>> 16) & 0xFF;
- this.view[offset+2] = (lo >>> 8) & 0xFF;
- this.view[offset+3] = lo & 0xFF;
- }
- if (relative) this.offset += 8;
- return this;
- };
- /**
- * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
- * @function
- * @param {number|!Long} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
- /**
- * Reads a 64bit unsigned integer.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!Long}
- * @expose
- */
- ByteBufferPrototype.readUint64 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 8 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
- }
- var lo = 0,
- hi = 0;
- if (this.littleEndian) {
- lo = this.view[offset+2] << 16;
- lo |= this.view[offset+1] << 8;
- lo |= this.view[offset ];
- lo += this.view[offset+3] << 24 >>> 0;
- offset += 4;
- hi = this.view[offset+2] << 16;
- hi |= this.view[offset+1] << 8;
- hi |= this.view[offset ];
- hi += this.view[offset+3] << 24 >>> 0;
- } else {
- hi = this.view[offset+1] << 16;
- hi |= this.view[offset+2] << 8;
- hi |= this.view[offset+3];
- hi += this.view[offset ] << 24 >>> 0;
- offset += 4;
- lo = this.view[offset+1] << 16;
- lo |= this.view[offset+2] << 8;
- lo |= this.view[offset+3];
- lo += this.view[offset ] << 24 >>> 0;
- }
- var value = new Long(lo, hi, true);
- if (relative) this.offset += 8;
- return value;
- };
- /**
- * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
- * @function
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!Long}
- * @expose
- */
- ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
- } // Long
- // types/floats/float32
- /*
- ieee754 - https://github.com/feross/ieee754
- The MIT License (MIT)
- Copyright (c) Feross Aboukhadijeh
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- */
- /**
- * Reads an IEEE754 float from a byte array.
- * @param {!Array} buffer
- * @param {number} offset
- * @param {boolean} isLE
- * @param {number} mLen
- * @param {number} nBytes
- * @returns {number}
- * @inner
- */
- function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
- var e, m,
- eLen = nBytes * 8 - mLen - 1,
- eMax = (1 << eLen) - 1,
- eBias = eMax >> 1,
- nBits = -7,
- i = isLE ? (nBytes - 1) : 0,
- d = isLE ? -1 : 1,
- s = buffer[offset + i];
- i += d;
- e = s & ((1 << (-nBits)) - 1);
- s >>= (-nBits);
- nBits += eLen;
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
- m = e & ((1 << (-nBits)) - 1);
- e >>= (-nBits);
- nBits += mLen;
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
- if (e === 0) {
- e = 1 - eBias;
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity);
- } else {
- m = m + Math.pow(2, mLen);
- e = e - eBias;
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
- }
- /**
- * Writes an IEEE754 float to a byte array.
- * @param {!Array} buffer
- * @param {number} value
- * @param {number} offset
- * @param {boolean} isLE
- * @param {number} mLen
- * @param {number} nBytes
- * @inner
- */
- function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c,
- eLen = nBytes * 8 - mLen - 1,
- eMax = (1 << eLen) - 1,
- eBias = eMax >> 1,
- rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
- i = isLE ? 0 : (nBytes - 1),
- d = isLE ? 1 : -1,
- s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
- value = Math.abs(value);
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0;
- e = eMax;
- } else {
- e = Math.floor(Math.log(value) / Math.LN2);
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--;
- c *= 2;
- }
- if (e + eBias >= 1) {
- value += rt / c;
- } else {
- value += rt * Math.pow(2, 1 - eBias);
- }
- if (value * c >= 2) {
- e++;
- c /= 2;
- }
- if (e + eBias >= eMax) {
- m = 0;
- e = eMax;
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * Math.pow(2, mLen);
- e = e + eBias;
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
- e = 0;
- }
- }
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
- e = (e << mLen) | m;
- eLen += mLen;
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
- buffer[offset + i - d] |= s * 128;
- }
- /**
- * Writes a 32bit float.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeFloat32 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number')
- throw TypeError("Illegal value: "+value+" (not a number)");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 4;
- var capacity8 = this.buffer.byteLength;
- if (offset > capacity8)
- this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
- offset -= 4;
- ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
- if (relative) this.offset += 4;
- return this;
- };
- /**
- * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
- /**
- * Reads a 32bit float.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {number}
- * @expose
- */
- ByteBufferPrototype.readFloat32 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 4 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
- }
- var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
- if (relative) this.offset += 4;
- return value;
- };
- /**
- * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
- * @function
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
- * @returns {number}
- * @expose
- */
- ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
- // types/floats/float64
- /**
- * Writes a 64bit float.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeFloat64 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number')
- throw TypeError("Illegal value: "+value+" (not a number)");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- offset += 8;
- var capacity9 = this.buffer.byteLength;
- if (offset > capacity9)
- this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
- offset -= 8;
- ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
- if (relative) this.offset += 8;
- return this;
- };
- /**
- * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
- * @function
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
- /**
- * Reads a 64bit float.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {number}
- * @expose
- */
- ByteBufferPrototype.readFloat64 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 8 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
- }
- var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
- if (relative) this.offset += 8;
- return value;
- };
- /**
- * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
- * @function
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
- * @returns {number}
- * @expose
- */
- ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
- // types/varints/varint32
- /**
- * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
- * @type {number}
- * @const
- * @expose
- */
- ByteBuffer.MAX_VARINT32_BYTES = 5;
- /**
- * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
- * @param {number} value Value to encode
- * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
- * @expose
- */
- ByteBuffer.calculateVarint32 = function(value) {
- // ref: src/google/protobuf/io/coded_stream.cc
- value = value >>> 0;
- if (value < 1 << 7 ) return 1;
- else if (value < 1 << 14) return 2;
- else if (value < 1 << 21) return 3;
- else if (value < 1 << 28) return 4;
- else return 5;
- };
- /**
- * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
- * @param {number} n Signed 32bit integer
- * @returns {number} Unsigned zigzag encoded 32bit integer
- * @expose
- */
- ByteBuffer.zigZagEncode32 = function(n) {
- return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
- };
- /**
- * Decodes a zigzag encoded signed 32bit integer.
- * @param {number} n Unsigned zigzag encoded 32bit integer
- * @returns {number} Signed 32bit integer
- * @expose
- */
- ByteBuffer.zigZagDecode32 = function(n) {
- return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
- };
- /**
- * Writes a 32bit base 128 variable-length integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
- * @expose
- */
- ByteBufferPrototype.writeVarint32 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value |= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- var size = ByteBuffer.calculateVarint32(value),
- b;
- offset += size;
- var capacity10 = this.buffer.byteLength;
- if (offset > capacity10)
- this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
- offset -= size;
- value >>>= 0;
- while (value >= 0x80) {
- b = (value & 0x7f) | 0x80;
- this.view[offset++] = b;
- value >>>= 7;
- }
- this.view[offset++] = value;
- if (relative) {
- this.offset = offset;
- return this;
- }
- return size;
- };
- /**
- * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
- * @param {number} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
- * @expose
- */
- ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
- return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
- };
- /**
- * Reads a 32bit base 128 variable-length integer.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
- * and the actual number of bytes read.
- * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
- * to fully decode the varint.
- * @expose
- */
- ByteBufferPrototype.readVarint32 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 1 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
- }
- var c = 0,
- value = 0 >>> 0,
- b;
- do {
- if (!this.noAssert && offset > this.limit) {
- var err = Error("Truncated");
- err['truncated'] = true;
- throw err;
- }
- b = this.view[offset++];
- if (c < 5)
- value |= (b & 0x7f) << (7*c);
- ++c;
- } while ((b & 0x80) !== 0);
- value |= 0;
- if (relative) {
- this.offset = offset;
- return value;
- }
- return {
- "value": value,
- "length": c
- };
- };
- /**
- * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
- * and the actual number of bytes read.
- * @throws {Error} If it's not a valid varint
- * @expose
- */
- ByteBufferPrototype.readVarint32ZigZag = function(offset) {
- var val = this.readVarint32(offset);
- if (typeof val === 'object')
- val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
- else
- val = ByteBuffer.zigZagDecode32(val);
- return val;
- };
- // types/varints/varint64
- if (Long) {
- /**
- * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
- * @type {number}
- * @const
- * @expose
- */
- ByteBuffer.MAX_VARINT64_BYTES = 10;
- /**
- * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
- * @param {number|!Long} value Value to encode
- * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
- * @expose
- */
- ByteBuffer.calculateVarint64 = function(value) {
- if (typeof value === 'number')
- value = Long.fromNumber(value);
- else if (typeof value === 'string')
- value = Long.fromString(value);
- // ref: src/google/protobuf/io/coded_stream.cc
- var part0 = value.toInt() >>> 0,
- part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
- part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
- if (part2 == 0) {
- if (part1 == 0) {
- if (part0 < 1 << 14)
- return part0 < 1 << 7 ? 1 : 2;
- else
- return part0 < 1 << 21 ? 3 : 4;
- } else {
- if (part1 < 1 << 14)
- return part1 < 1 << 7 ? 5 : 6;
- else
- return part1 < 1 << 21 ? 7 : 8;
- }
- } else
- return part2 < 1 << 7 ? 9 : 10;
- };
- /**
- * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
- * @param {number|!Long} value Signed long
- * @returns {!Long} Unsigned zigzag encoded long
- * @expose
- */
- ByteBuffer.zigZagEncode64 = function(value) {
- if (typeof value === 'number')
- value = Long.fromNumber(value, false);
- else if (typeof value === 'string')
- value = Long.fromString(value, false);
- else if (value.unsigned !== false) value = value.toSigned();
- // ref: src/google/protobuf/wire_format_lite.h
- return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
- };
- /**
- * Decodes a zigzag encoded signed 64bit integer.
- * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
- * @returns {!Long} Signed long
- * @expose
- */
- ByteBuffer.zigZagDecode64 = function(value) {
- if (typeof value === 'number')
- value = Long.fromNumber(value, false);
- else if (typeof value === 'string')
- value = Long.fromString(value, false);
- else if (value.unsigned !== false) value = value.toSigned();
- // ref: src/google/protobuf/wire_format_lite.h
- return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
- };
- /**
- * Writes a 64bit base 128 variable-length integer.
- * @param {number|Long} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
- * @expose
- */
- ByteBufferPrototype.writeVarint64 = function(value, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof value === 'number')
- value = Long.fromNumber(value);
- else if (typeof value === 'string')
- value = Long.fromString(value);
- else if (!(value && value instanceof Long))
- throw TypeError("Illegal value: "+value+" (not an integer or Long)");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- if (typeof value === 'number')
- value = Long.fromNumber(value, false);
- else if (typeof value === 'string')
- value = Long.fromString(value, false);
- else if (value.unsigned !== false) value = value.toSigned();
- var size = ByteBuffer.calculateVarint64(value),
- part0 = value.toInt() >>> 0,
- part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
- part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
- offset += size;
- var capacity11 = this.buffer.byteLength;
- if (offset > capacity11)
- this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
- offset -= size;
- switch (size) {
- case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
- case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
- case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
- case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
- case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
- case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
- case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
- case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
- case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
- case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
- }
- if (relative) {
- this.offset += size;
- return this;
- } else {
- return size;
- }
- };
- /**
- * Writes a zig-zag encoded 64bit base 128 variable-length integer.
- * @param {number|Long} value Value to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
- * @expose
- */
- ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
- return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
- };
- /**
- * Reads a 64bit base 128 variable-length integer. Requires Long.js.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
- * the actual number of bytes read.
- * @throws {Error} If it's not a valid varint
- * @expose
- */
- ByteBufferPrototype.readVarint64 = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 1 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
- }
- // ref: src/google/protobuf/io/coded_stream.cc
- var start = offset,
- part0 = 0,
- part1 = 0,
- part2 = 0,
- b = 0;
- b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
- b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
- throw Error("Buffer overrun"); }}}}}}}}}}
- var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
- if (relative) {
- this.offset = offset;
- return value;
- } else {
- return {
- 'value': value,
- 'length': offset-start
- };
- }
- };
- /**
- * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
- * the actual number of bytes read.
- * @throws {Error} If it's not a valid varint
- * @expose
- */
- ByteBufferPrototype.readVarint64ZigZag = function(offset) {
- var val = this.readVarint64(offset);
- if (val && val['value'] instanceof Long)
- val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
- else
- val = ByteBuffer.zigZagDecode64(val);
- return val;
- };
- } // Long
- // types/strings/cstring
- /**
- * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
- * characters itself.
- * @param {string} str String to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * contained in `str` + 1 if omitted.
- * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
- * @expose
- */
- ByteBufferPrototype.writeCString = function(str, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- var i,
- k = str.length;
- if (!this.noAssert) {
- if (typeof str !== 'string')
- throw TypeError("Illegal str: Not a string");
- for (i=0; i<k; ++i) {
- if (str.charCodeAt(i) === 0)
- throw RangeError("Illegal str: Contains NULL-characters");
- }
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- // UTF8 strings do not contain zero bytes in between except for the zero character, so:
- k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
- offset += k+1;
- var capacity12 = this.buffer.byteLength;
- if (offset > capacity12)
- this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
- offset -= k+1;
- utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
- this.view[offset++] = b;
- }.bind(this));
- this.view[offset++] = 0;
- if (relative) {
- this.offset = offset;
- return this;
- }
- return k;
- };
- /**
- * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
- * itself.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
- * read and the actual number of bytes read.
- * @expose
- */
- ByteBufferPrototype.readCString = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 1 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
- }
- var start = offset,
- temp;
- // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
- var sd, b = -1;
- utfx.decodeUTF8toUTF16(function() {
- if (b === 0) return null;
- if (offset >= this.limit)
- throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
- b = this.view[offset++];
- return b === 0 ? null : b;
- }.bind(this), sd = stringDestination(), true);
- if (relative) {
- this.offset = offset;
- return sd();
- } else {
- return {
- "string": sd(),
- "length": offset - start
- };
- }
- };
- // types/strings/istring
- /**
- * Writes a length as uint32 prefixed UTF8 encoded string.
- * @param {string} str String to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
- * @expose
- * @see ByteBuffer#writeVarint32
- */
- ByteBufferPrototype.writeIString = function(str, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof str !== 'string')
- throw TypeError("Illegal str: Not a string");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- var start = offset,
- k;
- k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
- offset += 4+k;
- var capacity13 = this.buffer.byteLength;
- if (offset > capacity13)
- this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
- offset -= 4+k;
- if (this.littleEndian) {
- this.view[offset+3] = (k >>> 24) & 0xFF;
- this.view[offset+2] = (k >>> 16) & 0xFF;
- this.view[offset+1] = (k >>> 8) & 0xFF;
- this.view[offset ] = k & 0xFF;
- } else {
- this.view[offset ] = (k >>> 24) & 0xFF;
- this.view[offset+1] = (k >>> 16) & 0xFF;
- this.view[offset+2] = (k >>> 8) & 0xFF;
- this.view[offset+3] = k & 0xFF;
- }
- offset += 4;
- utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
- this.view[offset++] = b;
- }.bind(this));
- if (offset !== start + 4 + k)
- throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
- if (relative) {
- this.offset = offset;
- return this;
- }
- return offset - start;
- };
- /**
- * Reads a length as uint32 prefixed UTF8 encoded string.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
- * read and the actual number of bytes read.
- * @expose
- * @see ByteBuffer#readVarint32
- */
- ByteBufferPrototype.readIString = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 4 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
- }
- var start = offset;
- var len = this.readUint32(offset);
- var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
- offset += str['length'];
- if (relative) {
- this.offset = offset;
- return str['string'];
- } else {
- return {
- 'string': str['string'],
- 'length': offset - start
- };
- }
- };
- // types/strings/utf8string
- /**
- * Metrics representing number of UTF8 characters. Evaluates to `c`.
- * @type {string}
- * @const
- * @expose
- */
- ByteBuffer.METRICS_CHARS = 'c';
- /**
- * Metrics representing number of bytes. Evaluates to `b`.
- * @type {string}
- * @const
- * @expose
- */
- ByteBuffer.METRICS_BYTES = 'b';
- /**
- * Writes an UTF8 encoded string.
- * @param {string} str String to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
- * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
- * @expose
- */
- ByteBufferPrototype.writeUTF8String = function(str, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- var k;
- var start = offset;
- k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
- offset += k;
- var capacity14 = this.buffer.byteLength;
- if (offset > capacity14)
- this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
- offset -= k;
- utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
- this.view[offset++] = b;
- }.bind(this));
- if (relative) {
- this.offset = offset;
- return this;
- }
- return offset - start;
- };
- /**
- * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
- * @function
- * @param {string} str String to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
- * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
- * @expose
- */
- ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
- /**
- * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
- * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
- * @param {string} str String to calculate
- * @returns {number} Number of UTF8 characters
- * @expose
- */
- ByteBuffer.calculateUTF8Chars = function(str) {
- return utfx.calculateUTF16asUTF8(stringSource(str))[0];
- };
- /**
- * Calculates the number of UTF8 bytes of a string.
- * @param {string} str String to calculate
- * @returns {number} Number of UTF8 bytes
- * @expose
- */
- ByteBuffer.calculateUTF8Bytes = function(str) {
- return utfx.calculateUTF16asUTF8(stringSource(str))[1];
- };
- /**
- * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
- * @function
- * @param {string} str String to calculate
- * @returns {number} Number of UTF8 bytes
- * @expose
- */
- ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
- /**
- * Reads an UTF8 encoded string.
- * @param {number} length Number of characters or bytes to read.
- * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
- * {@link ByteBuffer.METRICS_CHARS}.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
- * read and the actual number of bytes read.
- * @expose
- */
- ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
- if (typeof metrics === 'number') {
- offset = metrics;
- metrics = undefined;
- }
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
- if (!this.noAssert) {
- if (typeof length !== 'number' || length % 1 !== 0)
- throw TypeError("Illegal length: "+length+" (not an integer)");
- length |= 0;
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- var i = 0,
- start = offset,
- sd;
- if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
- sd = stringDestination();
- utfx.decodeUTF8(function() {
- return i < length && offset < this.limit ? this.view[offset++] : null;
- }.bind(this), function(cp) {
- ++i; utfx.UTF8toUTF16(cp, sd);
- });
- if (i !== length)
- throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
- if (relative) {
- this.offset = offset;
- return sd();
- } else {
- return {
- "string": sd(),
- "length": offset - start
- };
- }
- } else if (metrics === ByteBuffer.METRICS_BYTES) {
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + length > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
- }
- var k = offset + length;
- utfx.decodeUTF8toUTF16(function() {
- return offset < k ? this.view[offset++] : null;
- }.bind(this), sd = stringDestination(), this.noAssert);
- if (offset !== k)
- throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
- if (relative) {
- this.offset = offset;
- return sd();
- } else {
- return {
- 'string': sd(),
- 'length': offset - start
- };
- }
- } else
- throw TypeError("Unsupported metrics: "+metrics);
- };
- /**
- * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
- * @function
- * @param {number} length Number of characters or bytes to read
- * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
- * {@link ByteBuffer.METRICS_CHARS}.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
- * read and the actual number of bytes read.
- * @expose
- */
- ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
- // types/strings/vstring
- /**
- * Writes a length as varint32 prefixed UTF8 encoded string.
- * @param {string} str String to write
- * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
- * @expose
- * @see ByteBuffer#writeVarint32
- */
- ByteBufferPrototype.writeVString = function(str, offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof str !== 'string')
- throw TypeError("Illegal str: Not a string");
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- var start = offset,
- k, l;
- k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
- l = ByteBuffer.calculateVarint32(k);
- offset += l+k;
- var capacity15 = this.buffer.byteLength;
- if (offset > capacity15)
- this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
- offset -= l+k;
- offset += this.writeVarint32(k, offset);
- utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
- this.view[offset++] = b;
- }.bind(this));
- if (offset !== start+k+l)
- throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
- if (relative) {
- this.offset = offset;
- return this;
- }
- return offset - start;
- };
- /**
- * Reads a length as varint32 prefixed UTF8 encoded string.
- * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
- * read and the actual number of bytes read.
- * @expose
- * @see ByteBuffer#readVarint32
- */
- ByteBufferPrototype.readVString = function(offset) {
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 1 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
- }
- var start = offset;
- var len = this.readVarint32(offset);
- var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
- offset += str['length'];
- if (relative) {
- this.offset = offset;
- return str['string'];
- } else {
- return {
- 'string': str['string'],
- 'length': offset - start
- };
- }
- };
- /**
- * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
- * data's length.
- * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
- * will be modified according to the performed read operation.
- * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
- * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
- * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
- */
- ByteBufferPrototype.append = function(source, encoding, offset) {
- if (typeof encoding === 'number' || typeof encoding !== 'string') {
- offset = encoding;
- encoding = undefined;
- }
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- if (!(source instanceof ByteBuffer))
- source = ByteBuffer.wrap(source, encoding);
- var length = source.limit - source.offset;
- if (length <= 0) return this; // Nothing to append
- offset += length;
- var capacity16 = this.buffer.byteLength;
- if (offset > capacity16)
- this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
- offset -= length;
- this.view.set(source.view.subarray(source.offset, source.limit), offset);
- source.offset += length;
- if (relative) this.offset += length;
- return this;
- };
- /**
- * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
- specified offset up to the length of this ByteBuffer's data.
- * @param {!ByteBuffer} target Target ByteBuffer
- * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * read if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- * @see ByteBuffer#append
- */
- ByteBufferPrototype.appendTo = function(target, offset) {
- target.append(this, offset);
- return this;
- };
- /**
- * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
- * disable them if your code already makes sure that everything is valid.
- * @param {boolean} assert `true` to enable assertions, otherwise `false`
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.assert = function(assert) {
- this.noAssert = !assert;
- return this;
- };
- /**
- * Gets the capacity of this ByteBuffer's backing buffer.
- * @returns {number} Capacity of the backing buffer
- * @expose
- */
- ByteBufferPrototype.capacity = function() {
- return this.buffer.byteLength;
- };
- /**
- * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
- * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.clear = function() {
- this.offset = 0;
- this.limit = this.buffer.byteLength;
- this.markedOffset = -1;
- return this;
- };
- /**
- * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
- * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
- * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
- * @returns {!ByteBuffer} Cloned instance
- * @expose
- */
- ByteBufferPrototype.clone = function(copy) {
- var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
- if (copy) {
- bb.buffer = new ArrayBuffer(this.buffer.byteLength);
- bb.view = new Uint8Array(bb.buffer);
- } else {
- bb.buffer = this.buffer;
- bb.view = this.view;
- }
- bb.offset = this.offset;
- bb.markedOffset = this.markedOffset;
- bb.limit = this.limit;
- return bb;
- };
- /**
- * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
- * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
- * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
- * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
- * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.compact = function(begin, end) {
- if (typeof begin === 'undefined') begin = this.offset;
- if (typeof end === 'undefined') end = this.limit;
- if (!this.noAssert) {
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- if (begin === 0 && end === this.buffer.byteLength)
- return this; // Already compacted
- var len = end - begin;
- if (len === 0) {
- this.buffer = EMPTY_BUFFER;
- this.view = null;
- if (this.markedOffset >= 0) this.markedOffset -= begin;
- this.offset = 0;
- this.limit = 0;
- return this;
- }
- var buffer = new ArrayBuffer(len);
- var view = new Uint8Array(buffer);
- view.set(this.view.subarray(begin, end));
- this.buffer = buffer;
- this.view = view;
- if (this.markedOffset >= 0) this.markedOffset -= begin;
- this.offset = 0;
- this.limit = len;
- return this;
- };
- /**
- * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
- * {@link ByteBuffer#limit}.
- * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
- * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
- * @returns {!ByteBuffer} Copy
- * @expose
- */
- ByteBufferPrototype.copy = function(begin, end) {
- if (typeof begin === 'undefined') begin = this.offset;
- if (typeof end === 'undefined') end = this.limit;
- if (!this.noAssert) {
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- if (begin === end)
- return new ByteBuffer(0, this.littleEndian, this.noAssert);
- var capacity = end - begin,
- bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
- bb.offset = 0;
- bb.limit = capacity;
- if (bb.markedOffset >= 0) bb.markedOffset -= begin;
- this.copyTo(bb, 0, begin, end);
- return bb;
- };
- /**
- * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
- * {@link ByteBuffer#limit}.
- * @param {!ByteBuffer} target Target ByteBuffer
- * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
- * by the number of bytes copied if omitted.
- * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
- * number of bytes copied if omitted.
- * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
- var relative,
- targetRelative;
- if (!this.noAssert) {
- if (!ByteBuffer.isByteBuffer(target))
- throw TypeError("Illegal target: Not a ByteBuffer");
- }
- targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
- sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
- sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
- if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
- throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
- if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
- throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
- var len = sourceLimit - sourceOffset;
- if (len === 0)
- return target; // Nothing to copy
- target.ensureCapacity(targetOffset + len);
- target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
- if (relative) this.offset += len;
- if (targetRelative) target.offset += len;
- return this;
- };
- /**
- * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
- * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
- * the required capacity will be used instead.
- * @param {number} capacity Required capacity
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.ensureCapacity = function(capacity) {
- var current = this.buffer.byteLength;
- if (current < capacity)
- return this.resize((current *= 2) > capacity ? current : capacity);
- return this;
- };
- /**
- * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
- * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
- * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
- * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
- * written if omitted. defaults to {@link ByteBuffer#offset}.
- * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
- * @returns {!ByteBuffer} this
- * @expose
- * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
- */
- ByteBufferPrototype.fill = function(value, begin, end) {
- var relative = typeof begin === 'undefined';
- if (relative) begin = this.offset;
- if (typeof value === 'string' && value.length > 0)
- value = value.charCodeAt(0);
- if (typeof begin === 'undefined') begin = this.offset;
- if (typeof end === 'undefined') end = this.limit;
- if (!this.noAssert) {
- if (typeof value !== 'number' || value % 1 !== 0)
- throw TypeError("Illegal value: "+value+" (not an integer)");
- value |= 0;
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- if (begin >= end)
- return this; // Nothing to fill
- while (begin < end) this.view[begin++] = value;
- if (relative) this.offset = begin;
- return this;
- };
- /**
- * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
- * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.flip = function() {
- this.limit = this.offset;
- this.offset = 0;
- return this;
- };
- /**
- * Marks an offset on this ByteBuffer to be used later.
- * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
- * @returns {!ByteBuffer} this
- * @throws {TypeError} If `offset` is not a valid number
- * @throws {RangeError} If `offset` is out of bounds
- * @see ByteBuffer#reset
- * @expose
- */
- ByteBufferPrototype.mark = function(offset) {
- offset = typeof offset === 'undefined' ? this.offset : offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- this.markedOffset = offset;
- return this;
- };
- /**
- * Sets the byte order.
- * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.order = function(littleEndian) {
- if (!this.noAssert) {
- if (typeof littleEndian !== 'boolean')
- throw TypeError("Illegal littleEndian: Not a boolean");
- }
- this.littleEndian = !!littleEndian;
- return this;
- };
- /**
- * Switches (to) little endian byte order.
- * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.LE = function(littleEndian) {
- this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
- return this;
- };
- /**
- * Switches (to) big endian byte order.
- * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.BE = function(bigEndian) {
- this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
- return this;
- };
- /**
- * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
- * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
- * will be resized and its contents moved accordingly.
- * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
- * modified according to the performed read operation.
- * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
- * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
- * prepended if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
- * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
- */
- ByteBufferPrototype.prepend = function(source, encoding, offset) {
- if (typeof encoding === 'number' || typeof encoding !== 'string') {
- offset = encoding;
- encoding = undefined;
- }
- var relative = typeof offset === 'undefined';
- if (relative) offset = this.offset;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: "+offset+" (not an integer)");
- offset >>>= 0;
- if (offset < 0 || offset + 0 > this.buffer.byteLength)
- throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
- }
- if (!(source instanceof ByteBuffer))
- source = ByteBuffer.wrap(source, encoding);
- var len = source.limit - source.offset;
- if (len <= 0) return this; // Nothing to prepend
- var diff = len - offset;
- if (diff > 0) { // Not enough space before offset, so resize + move
- var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
- var view = new Uint8Array(buffer);
- view.set(this.view.subarray(offset, this.buffer.byteLength), len);
- this.buffer = buffer;
- this.view = view;
- this.offset += diff;
- if (this.markedOffset >= 0) this.markedOffset += diff;
- this.limit += diff;
- offset += diff;
- } else {
- var arrayView = new Uint8Array(this.buffer);
- }
- this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
- source.offset = source.limit;
- if (relative)
- this.offset -= len;
- return this;
- };
- /**
- * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
- * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
- * will be resized and its contents moved accordingly.
- * @param {!ByteBuffer} target Target ByteBuffer
- * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
- * prepended if omitted.
- * @returns {!ByteBuffer} this
- * @expose
- * @see ByteBuffer#prepend
- */
- ByteBufferPrototype.prependTo = function(target, offset) {
- target.prepend(this, offset);
- return this;
- };
- /**
- * Prints debug information about this ByteBuffer's contents.
- * @param {function(string)=} out Output function to call, defaults to console.log
- * @expose
- */
- ByteBufferPrototype.printDebug = function(out) {
- if (typeof out !== 'function') out = console.log.bind(console);
- out(
- this.toString()+"\n"+
- "-------------------------------------------------------------------\n"+
- this.toDebug(/* columns */ true)
- );
- };
- /**
- * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
- * {@link ByteBuffer#limit}, so this returns `limit - offset`.
- * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
- * @expose
- */
- ByteBufferPrototype.remaining = function() {
- return this.limit - this.offset;
- };
- /**
- * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
- * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
- * marked, sets `offset = 0`.
- * @returns {!ByteBuffer} this
- * @see ByteBuffer#mark
- * @expose
- */
- ByteBufferPrototype.reset = function() {
- if (this.markedOffset >= 0) {
- this.offset = this.markedOffset;
- this.markedOffset = -1;
- } else {
- this.offset = 0;
- }
- return this;
- };
- /**
- * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
- * large or larger.
- * @param {number} capacity Capacity required
- * @returns {!ByteBuffer} this
- * @throws {TypeError} If `capacity` is not a number
- * @throws {RangeError} If `capacity < 0`
- * @expose
- */
- ByteBufferPrototype.resize = function(capacity) {
- if (!this.noAssert) {
- if (typeof capacity !== 'number' || capacity % 1 !== 0)
- throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
- capacity |= 0;
- if (capacity < 0)
- throw RangeError("Illegal capacity: 0 <= "+capacity);
- }
- if (this.buffer.byteLength < capacity) {
- var buffer = new ArrayBuffer(capacity);
- var view = new Uint8Array(buffer);
- view.set(this.view);
- this.buffer = buffer;
- this.view = view;
- }
- return this;
- };
- /**
- * Reverses this ByteBuffer's contents.
- * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
- * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.reverse = function(begin, end) {
- if (typeof begin === 'undefined') begin = this.offset;
- if (typeof end === 'undefined') end = this.limit;
- if (!this.noAssert) {
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- if (begin === end)
- return this; // Nothing to reverse
- Array.prototype.reverse.call(this.view.subarray(begin, end));
- return this;
- };
- /**
- * Skips the next `length` bytes. This will just advance
- * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
- * @returns {!ByteBuffer} this
- * @expose
- */
- ByteBufferPrototype.skip = function(length) {
- if (!this.noAssert) {
- if (typeof length !== 'number' || length % 1 !== 0)
- throw TypeError("Illegal length: "+length+" (not an integer)");
- length |= 0;
- }
- var offset = this.offset + length;
- if (!this.noAssert) {
- if (offset < 0 || offset > this.buffer.byteLength)
- throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
- }
- this.offset = offset;
- return this;
- };
- /**
- * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
- * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
- * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
- * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
- * @expose
- */
- ByteBufferPrototype.slice = function(begin, end) {
- if (typeof begin === 'undefined') begin = this.offset;
- if (typeof end === 'undefined') end = this.limit;
- if (!this.noAssert) {
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- var bb = this.clone();
- bb.offset = begin;
- bb.limit = end;
- return bb;
- };
- /**
- * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
- * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
- * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
- * possible. Defaults to `false`
- * @returns {!ArrayBuffer} Contents as an ArrayBuffer
- * @expose
- */
- ByteBufferPrototype.toBuffer = function(forceCopy) {
- var offset = this.offset,
- limit = this.limit;
- if (!this.noAssert) {
- if (typeof offset !== 'number' || offset % 1 !== 0)
- throw TypeError("Illegal offset: Not an integer");
- offset >>>= 0;
- if (typeof limit !== 'number' || limit % 1 !== 0)
- throw TypeError("Illegal limit: Not an integer");
- limit >>>= 0;
- if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
- }
- // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
- // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
- if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
- return this.buffer;
- if (offset === limit)
- return EMPTY_BUFFER;
- var buffer = new ArrayBuffer(limit - offset);
- new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
- return buffer;
- };
- /**
- * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
- * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
- * @function
- * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
- * Defaults to `false`
- * @returns {!ArrayBuffer} Contents as an ArrayBuffer
- * @expose
- */
- ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
- /**
- * Converts the ByteBuffer's contents to a string.
- * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
- * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
- * highlighted offsets.
- * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
- * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
- * @returns {string} String representation
- * @throws {Error} If `encoding` is invalid
- * @expose
- */
- ByteBufferPrototype.toString = function(encoding, begin, end) {
- if (typeof encoding === 'undefined')
- return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
- if (typeof encoding === 'number')
- encoding = "utf8",
- begin = encoding,
- end = begin;
- switch (encoding) {
- case "utf8":
- return this.toUTF8(begin, end);
- case "base64":
- return this.toBase64(begin, end);
- case "hex":
- return this.toHex(begin, end);
- case "binary":
- return this.toBinary(begin, end);
- case "debug":
- return this.toDebug();
- case "columns":
- return this.toColumns();
- default:
- throw Error("Unsupported encoding: "+encoding);
- }
- };
- // lxiv-embeddable
- /**
- * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
- * Released under the Apache License, Version 2.0
- * see: https://github.com/dcodeIO/lxiv for details
- */
- var lxiv = function() {
- "use strict";
- /**
- * lxiv namespace.
- * @type {!Object.<string,*>}
- * @exports lxiv
- */
- var lxiv = {};
- /**
- * Character codes for output.
- * @type {!Array.<number>}
- * @inner
- */
- var aout = [
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
- 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
- 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
- ];
- /**
- * Character codes for input.
- * @type {!Array.<number>}
- * @inner
- */
- var ain = [];
- for (var i=0, k=aout.length; i<k; ++i)
- ain[aout[i]] = i;
- /**
- * Encodes bytes to base64 char codes.
- * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
- * there are no more bytes left.
- * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
- * code.
- */
- lxiv.encode = function(src, dst) {
- var b, t;
- while ((b = src()) !== null) {
- dst(aout[(b>>2)&0x3f]);
- t = (b&0x3)<<4;
- if ((b = src()) !== null) {
- t |= (b>>4)&0xf;
- dst(aout[(t|((b>>4)&0xf))&0x3f]);
- t = (b&0xf)<<2;
- if ((b = src()) !== null)
- dst(aout[(t|((b>>6)&0x3))&0x3f]),
- dst(aout[b&0x3f]);
- else
- dst(aout[t&0x3f]),
- dst(61);
- } else
- dst(aout[t&0x3f]),
- dst(61),
- dst(61);
- }
- };
- /**
- * Decodes base64 char codes to bytes.
- * @param {!function():number|null} src Characters source as a function returning the next char code respectively
- * `null` if there are no more characters left.
- * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
- * @throws {Error} If a character code is invalid
- */
- lxiv.decode = function(src, dst) {
- var c, t1, t2;
- function fail(c) {
- throw Error("Illegal character code: "+c);
- }
- while ((c = src()) !== null) {
- t1 = ain[c];
- if (typeof t1 === 'undefined') fail(c);
- if ((c = src()) !== null) {
- t2 = ain[c];
- if (typeof t2 === 'undefined') fail(c);
- dst((t1<<2)>>>0|(t2&0x30)>>4);
- if ((c = src()) !== null) {
- t1 = ain[c];
- if (typeof t1 === 'undefined')
- if (c === 61) break; else fail(c);
- dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
- if ((c = src()) !== null) {
- t2 = ain[c];
- if (typeof t2 === 'undefined')
- if (c === 61) break; else fail(c);
- dst(((t1&0x3)<<6)>>>0|t2);
- }
- }
- }
- }
- };
- /**
- * Tests if a string is valid base64.
- * @param {string} str String to test
- * @returns {boolean} `true` if valid, otherwise `false`
- */
- lxiv.test = function(str) {
- return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
- };
- return lxiv;
- }();
- // encodings/base64
- /**
- * Encodes this ByteBuffer's contents to a base64 encoded string.
- * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
- * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
- * @returns {string} Base64 encoded string
- * @throws {RangeError} If `begin` or `end` is out of bounds
- * @expose
- */
- ByteBufferPrototype.toBase64 = function(begin, end) {
- if (typeof begin === 'undefined')
- begin = this.offset;
- if (typeof end === 'undefined')
- end = this.limit;
- begin = begin | 0; end = end | 0;
- if (begin < 0 || end > this.capacity || begin > end)
- throw RangeError("begin, end");
- var sd; lxiv.encode(function() {
- return begin < end ? this.view[begin++] : null;
- }.bind(this), sd = stringDestination());
- return sd();
- };
- /**
- * Decodes a base64 encoded string to a ByteBuffer.
- * @param {string} str String to decode
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @returns {!ByteBuffer} ByteBuffer
- * @expose
- */
- ByteBuffer.fromBase64 = function(str, littleEndian) {
- if (typeof str !== 'string')
- throw TypeError("str");
- var bb = new ByteBuffer(str.length/4*3, littleEndian),
- i = 0;
- lxiv.decode(stringSource(str), function(b) {
- bb.view[i++] = b;
- });
- bb.limit = i;
- return bb;
- };
- /**
- * Encodes a binary string to base64 like `window.btoa` does.
- * @param {string} str Binary string
- * @returns {string} Base64 encoded string
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
- * @expose
- */
- ByteBuffer.btoa = function(str) {
- return ByteBuffer.fromBinary(str).toBase64();
- };
- /**
- * Decodes a base64 encoded string to binary like `window.atob` does.
- * @param {string} b64 Base64 encoded string
- * @returns {string} Binary string
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
- * @expose
- */
- ByteBuffer.atob = function(b64) {
- return ByteBuffer.fromBase64(b64).toBinary();
- };
- // encodings/binary
- /**
- * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
- * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
- * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
- * @returns {string} Binary encoded string
- * @throws {RangeError} If `offset > limit`
- * @expose
- */
- ByteBufferPrototype.toBinary = function(begin, end) {
- if (typeof begin === 'undefined')
- begin = this.offset;
- if (typeof end === 'undefined')
- end = this.limit;
- begin |= 0; end |= 0;
- if (begin < 0 || end > this.capacity() || begin > end)
- throw RangeError("begin, end");
- if (begin === end)
- return "";
- var chars = [],
- parts = [];
- while (begin < end) {
- chars.push(this.view[begin++]);
- if (chars.length >= 1024)
- parts.push(String.fromCharCode.apply(String, chars)),
- chars = [];
- }
- return parts.join('') + String.fromCharCode.apply(String, chars);
- };
- /**
- * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
- * @param {string} str String to decode
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @returns {!ByteBuffer} ByteBuffer
- * @expose
- */
- ByteBuffer.fromBinary = function(str, littleEndian) {
- if (typeof str !== 'string')
- throw TypeError("str");
- var i = 0,
- k = str.length,
- charCode,
- bb = new ByteBuffer(k, littleEndian);
- while (i<k) {
- charCode = str.charCodeAt(i);
- if (charCode > 0xff)
- throw RangeError("illegal char code: "+charCode);
- bb.view[i++] = charCode;
- }
- bb.limit = k;
- return bb;
- };
- // encodings/debug
- /**
- * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
- * * `<` : offset,
- * * `'` : markedOffset,
- * * `>` : limit,
- * * `|` : offset and limit,
- * * `[` : offset and markedOffset,
- * * `]` : markedOffset and limit,
- * * `!` : offset, markedOffset and limit
- * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
- * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
- * @expose
- * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
- * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
- * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
- * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
- */
- ByteBufferPrototype.toDebug = function(columns) {
- var i = -1,
- k = this.buffer.byteLength,
- b,
- hex = "",
- asc = "",
- out = "";
- while (i<k) {
- if (i !== -1) {
- b = this.view[i];
- if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
- else hex += b.toString(16).toUpperCase();
- if (columns)
- asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
- }
- ++i;
- if (columns) {
- if (i > 0 && i % 16 === 0 && i !== k) {
- while (hex.length < 3*16+3) hex += " ";
- out += hex+asc+"\n";
- hex = asc = "";
- }
- }
- if (i === this.offset && i === this.limit)
- hex += i === this.markedOffset ? "!" : "|";
- else if (i === this.offset)
- hex += i === this.markedOffset ? "[" : "<";
- else if (i === this.limit)
- hex += i === this.markedOffset ? "]" : ">";
- else
- hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
- }
- if (columns && hex !== " ") {
- while (hex.length < 3*16+3)
- hex += " ";
- out += hex + asc + "\n";
- }
- return columns ? out : hex;
- };
- /**
- * Decodes a hex encoded string with marked offsets to a ByteBuffer.
- * @param {string} str Debug string to decode (not be generated with `columns = true`)
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @returns {!ByteBuffer} ByteBuffer
- * @expose
- * @see ByteBuffer#toDebug
- */
- ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
- var k = str.length,
- bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
- var i = 0, j = 0, ch, b,
- rs = false, // Require symbol next
- ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
- fail = false;
- while (i<k) {
- switch (ch = str.charAt(i++)) {
- case '!':
- if (!noAssert) {
- if (ho || hm || hl) {
- fail = true;
- break;
- }
- ho = hm = hl = true;
- }
- bb.offset = bb.markedOffset = bb.limit = j;
- rs = false;
- break;
- case '|':
- if (!noAssert) {
- if (ho || hl) {
- fail = true;
- break;
- }
- ho = hl = true;
- }
- bb.offset = bb.limit = j;
- rs = false;
- break;
- case '[':
- if (!noAssert) {
- if (ho || hm) {
- fail = true;
- break;
- }
- ho = hm = true;
- }
- bb.offset = bb.markedOffset = j;
- rs = false;
- break;
- case '<':
- if (!noAssert) {
- if (ho) {
- fail = true;
- break;
- }
- ho = true;
- }
- bb.offset = j;
- rs = false;
- break;
- case ']':
- if (!noAssert) {
- if (hl || hm) {
- fail = true;
- break;
- }
- hl = hm = true;
- }
- bb.limit = bb.markedOffset = j;
- rs = false;
- break;
- case '>':
- if (!noAssert) {
- if (hl) {
- fail = true;
- break;
- }
- hl = true;
- }
- bb.limit = j;
- rs = false;
- break;
- case "'":
- if (!noAssert) {
- if (hm) {
- fail = true;
- break;
- }
- hm = true;
- }
- bb.markedOffset = j;
- rs = false;
- break;
- case ' ':
- rs = false;
- break;
- default:
- if (!noAssert) {
- if (rs) {
- fail = true;
- break;
- }
- }
- b = parseInt(ch+str.charAt(i++), 16);
- if (!noAssert) {
- if (isNaN(b) || b < 0 || b > 255)
- throw TypeError("Illegal str: Not a debug encoded string");
- }
- bb.view[j++] = b;
- rs = true;
- }
- if (fail)
- throw TypeError("Illegal str: Invalid symbol at "+i);
- }
- if (!noAssert) {
- if (!ho || !hl)
- throw TypeError("Illegal str: Missing offset or limit");
- if (j<bb.buffer.byteLength)
- throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
- }
- return bb;
- };
- // encodings/hex
- /**
- * Encodes this ByteBuffer's contents to a hex encoded string.
- * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
- * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
- * @returns {string} Hex encoded string
- * @expose
- */
- ByteBufferPrototype.toHex = function(begin, end) {
- begin = typeof begin === 'undefined' ? this.offset : begin;
- end = typeof end === 'undefined' ? this.limit : end;
- if (!this.noAssert) {
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- var out = new Array(end - begin),
- b;
- while (begin < end) {
- b = this.view[begin++];
- if (b < 0x10)
- out.push("0", b.toString(16));
- else out.push(b.toString(16));
- }
- return out.join('');
- };
- /**
- * Decodes a hex encoded string to a ByteBuffer.
- * @param {string} str String to decode
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @returns {!ByteBuffer} ByteBuffer
- * @expose
- */
- ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
- if (!noAssert) {
- if (typeof str !== 'string')
- throw TypeError("Illegal str: Not a string");
- if (str.length % 2 !== 0)
- throw TypeError("Illegal str: Length not a multiple of 2");
- }
- var k = str.length,
- bb = new ByteBuffer((k / 2) | 0, littleEndian),
- b;
- for (var i=0, j=0; i<k; i+=2) {
- b = parseInt(str.substring(i, i+2), 16);
- if (!noAssert)
- if (!isFinite(b) || b < 0 || b > 255)
- throw TypeError("Illegal str: Contains non-hex characters");
- bb.view[j++] = b;
- }
- bb.limit = j;
- return bb;
- };
- // utfx-embeddable
- /**
- * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
- * Released under the Apache License, Version 2.0
- * see: https://github.com/dcodeIO/utfx for details
- */
- var utfx = function() {
- "use strict";
- /**
- * utfx namespace.
- * @inner
- * @type {!Object.<string,*>}
- */
- var utfx = {};
- /**
- * Maximum valid code point.
- * @type {number}
- * @const
- */
- utfx.MAX_CODEPOINT = 0x10FFFF;
- /**
- * Encodes UTF8 code points to UTF8 bytes.
- * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
- * respectively `null` if there are no more code points left or a single numeric code point.
- * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
- */
- utfx.encodeUTF8 = function(src, dst) {
- var cp = null;
- if (typeof src === 'number')
- cp = src,
- src = function() { return null; };
- while (cp !== null || (cp = src()) !== null) {
- if (cp < 0x80)
- dst(cp&0x7F);
- else if (cp < 0x800)
- dst(((cp>>6)&0x1F)|0xC0),
- dst((cp&0x3F)|0x80);
- else if (cp < 0x10000)
- dst(((cp>>12)&0x0F)|0xE0),
- dst(((cp>>6)&0x3F)|0x80),
- dst((cp&0x3F)|0x80);
- else
- dst(((cp>>18)&0x07)|0xF0),
- dst(((cp>>12)&0x3F)|0x80),
- dst(((cp>>6)&0x3F)|0x80),
- dst((cp&0x3F)|0x80);
- cp = null;
- }
- };
- /**
- * Decodes UTF8 bytes to UTF8 code points.
- * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
- * are no more bytes left.
- * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
- * @throws {RangeError} If a starting byte is invalid in UTF8
- * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
- * remaining bytes.
- */
- utfx.decodeUTF8 = function(src, dst) {
- var a, b, c, d, fail = function(b) {
- b = b.slice(0, b.indexOf(null));
- var err = Error(b.toString());
- err.name = "TruncatedError";
- err['bytes'] = b;
- throw err;
- };
- while ((a = src()) !== null) {
- if ((a&0x80) === 0)
- dst(a);
- else if ((a&0xE0) === 0xC0)
- ((b = src()) === null) && fail([a, b]),
- dst(((a&0x1F)<<6) | (b&0x3F));
- else if ((a&0xF0) === 0xE0)
- ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
- dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
- else if ((a&0xF8) === 0xF0)
- ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
- dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
- else throw RangeError("Illegal starting byte: "+a);
- }
- };
- /**
- * Converts UTF16 characters to UTF8 code points.
- * @param {!function():number|null} src Characters source as a function returning the next char code respectively
- * `null` if there are no more characters left.
- * @param {!function(number)} dst Code points destination as a function successively called with each converted code
- * point.
- */
- utfx.UTF16toUTF8 = function(src, dst) {
- var c1, c2 = null;
- while (true) {
- if ((c1 = c2 !== null ? c2 : src()) === null)
- break;
- if (c1 >= 0xD800 && c1 <= 0xDFFF) {
- if ((c2 = src()) !== null) {
- if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
- dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
- c2 = null; continue;
- }
- }
- }
- dst(c1);
- }
- if (c2 !== null) dst(c2);
- };
- /**
- * Converts UTF8 code points to UTF16 characters.
- * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
- * respectively `null` if there are no more code points left or a single numeric code point.
- * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
- * @throws {RangeError} If a code point is out of range
- */
- utfx.UTF8toUTF16 = function(src, dst) {
- var cp = null;
- if (typeof src === 'number')
- cp = src, src = function() { return null; };
- while (cp !== null || (cp = src()) !== null) {
- if (cp <= 0xFFFF)
- dst(cp);
- else
- cp -= 0x10000,
- dst((cp>>10)+0xD800),
- dst((cp%0x400)+0xDC00);
- cp = null;
- }
- };
- /**
- * Converts and encodes UTF16 characters to UTF8 bytes.
- * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
- * if there are no more characters left.
- * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
- */
- utfx.encodeUTF16toUTF8 = function(src, dst) {
- utfx.UTF16toUTF8(src, function(cp) {
- utfx.encodeUTF8(cp, dst);
- });
- };
- /**
- * Decodes and converts UTF8 bytes to UTF16 characters.
- * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
- * are no more bytes left.
- * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
- * @throws {RangeError} If a starting byte is invalid in UTF8
- * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
- */
- utfx.decodeUTF8toUTF16 = function(src, dst) {
- utfx.decodeUTF8(src, function(cp) {
- utfx.UTF8toUTF16(cp, dst);
- });
- };
- /**
- * Calculates the byte length of an UTF8 code point.
- * @param {number} cp UTF8 code point
- * @returns {number} Byte length
- */
- utfx.calculateCodePoint = function(cp) {
- return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
- };
- /**
- * Calculates the number of UTF8 bytes required to store UTF8 code points.
- * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
- * `null` if there are no more code points left.
- * @returns {number} The number of UTF8 bytes required
- */
- utfx.calculateUTF8 = function(src) {
- var cp, l=0;
- while ((cp = src()) !== null)
- l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
- return l;
- };
- /**
- * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
- * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
- * `null` if there are no more characters left.
- * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
- */
- utfx.calculateUTF16asUTF8 = function(src) {
- var n=0, l=0;
- utfx.UTF16toUTF8(src, function(cp) {
- ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
- });
- return [n,l];
- };
- return utfx;
- }();
- // encodings/utf8
- /**
- * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
- * string.
- * @returns {string} Hex encoded string
- * @throws {RangeError} If `offset > limit`
- * @expose
- */
- ByteBufferPrototype.toUTF8 = function(begin, end) {
- if (typeof begin === 'undefined') begin = this.offset;
- if (typeof end === 'undefined') end = this.limit;
- if (!this.noAssert) {
- if (typeof begin !== 'number' || begin % 1 !== 0)
- throw TypeError("Illegal begin: Not an integer");
- begin >>>= 0;
- if (typeof end !== 'number' || end % 1 !== 0)
- throw TypeError("Illegal end: Not an integer");
- end >>>= 0;
- if (begin < 0 || begin > end || end > this.buffer.byteLength)
- throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
- }
- var sd; try {
- utfx.decodeUTF8toUTF16(function() {
- return begin < end ? this.view[begin++] : null;
- }.bind(this), sd = stringDestination());
- } catch (e) {
- if (begin !== end)
- throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
- }
- return sd();
- };
- /**
- * Decodes an UTF8 encoded string to a ByteBuffer.
- * @param {string} str String to decode
- * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
- * {@link ByteBuffer.DEFAULT_ENDIAN}.
- * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
- * {@link ByteBuffer.DEFAULT_NOASSERT}.
- * @returns {!ByteBuffer} ByteBuffer
- * @expose
- */
- ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
- if (!noAssert)
- if (typeof str !== 'string')
- throw TypeError("Illegal str: Not a string");
- var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
- i = 0;
- utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
- bb.view[i++] = b;
- });
- bb.limit = i;
- return bb;
- };
- return ByteBuffer;
- });
- /***/ }),
- /* 614 */
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
- Copyright 2013 Daniel Wirtz <dcode@dcode.io>
- Copyright 2009 The Closure Library Authors. All Rights Reserved.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS-IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
- * Released under the Apache License, Version 2.0
- * see: https://github.com/dcodeIO/long.js for details
- */
- (function(global, factory) {
- /* AMD */ if (true)
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
- module["exports"] = factory();
- /* Global */ else
- (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
- })(this, function() {
- "use strict";
- /**
- * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
- * See the from* functions below for more convenient ways of constructing Longs.
- * @exports Long
- * @class A Long class for representing a 64 bit two's-complement integer value.
- * @param {number} low The low (signed) 32 bits of the long
- * @param {number} high The high (signed) 32 bits of the long
- * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
- * @constructor
- */
- function Long(low, high, unsigned) {
- /**
- * The low 32 bits as a signed value.
- * @type {number}
- */
- this.low = low | 0;
- /**
- * The high 32 bits as a signed value.
- * @type {number}
- */
- this.high = high | 0;
- /**
- * Whether unsigned or not.
- * @type {boolean}
- */
- this.unsigned = !!unsigned;
- }
- // The internal representation of a long is the two given signed, 32-bit values.
- // We use 32-bit pieces because these are the size of integers on which
- // Javascript performs bit-operations. For operations like addition and
- // multiplication, we split each number into 16 bit pieces, which can easily be
- // multiplied within Javascript's floating-point representation without overflow
- // or change in sign.
- //
- // In the algorithms below, we frequently reduce the negative case to the
- // positive case by negating the input(s) and then post-processing the result.
- // Note that we must ALWAYS check specially whether those values are MIN_VALUE
- // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
- // a positive number, it overflows back into a negative). Not handling this
- // case would often result in infinite recursion.
- //
- // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
- // methods on which they depend.
- /**
- * An indicator used to reliably determine if an object is a Long or not.
- * @type {boolean}
- * @const
- * @private
- */
- Long.prototype.__isLong__;
- Object.defineProperty(Long.prototype, "__isLong__", {
- value: true,
- enumerable: false,
- configurable: false
- });
- /**
- * @function
- * @param {*} obj Object
- * @returns {boolean}
- * @inner
- */
- function isLong(obj) {
- return (obj && obj["__isLong__"]) === true;
- }
- /**
- * Tests if the specified object is a Long.
- * @function
- * @param {*} obj Object
- * @returns {boolean}
- */
- Long.isLong = isLong;
- /**
- * A cache of the Long representations of small integer values.
- * @type {!Object}
- * @inner
- */
- var INT_CACHE = {};
- /**
- * A cache of the Long representations of small unsigned integer values.
- * @type {!Object}
- * @inner
- */
- var UINT_CACHE = {};
- /**
- * @param {number} value
- * @param {boolean=} unsigned
- * @returns {!Long}
- * @inner
- */
- function fromInt(value, unsigned) {
- var obj, cachedObj, cache;
- if (unsigned) {
- value >>>= 0;
- if (cache = (0 <= value && value < 256)) {
- cachedObj = UINT_CACHE[value];
- if (cachedObj)
- return cachedObj;
- }
- obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
- if (cache)
- UINT_CACHE[value] = obj;
- return obj;
- } else {
- value |= 0;
- if (cache = (-128 <= value && value < 128)) {
- cachedObj = INT_CACHE[value];
- if (cachedObj)
- return cachedObj;
- }
- obj = fromBits(value, value < 0 ? -1 : 0, false);
- if (cache)
- INT_CACHE[value] = obj;
- return obj;
- }
- }
- /**
- * Returns a Long representing the given 32 bit integer value.
- * @function
- * @param {number} value The 32 bit integer in question
- * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
- * @returns {!Long} The corresponding Long value
- */
- Long.fromInt = fromInt;
- /**
- * @param {number} value
- * @param {boolean=} unsigned
- * @returns {!Long}
- * @inner
- */
- function fromNumber(value, unsigned) {
- if (isNaN(value) || !isFinite(value))
- return unsigned ? UZERO : ZERO;
- if (unsigned) {
- if (value < 0)
- return UZERO;
- if (value >= TWO_PWR_64_DBL)
- return MAX_UNSIGNED_VALUE;
- } else {
- if (value <= -TWO_PWR_63_DBL)
- return MIN_VALUE;
- if (value + 1 >= TWO_PWR_63_DBL)
- return MAX_VALUE;
- }
- if (value < 0)
- return fromNumber(-value, unsigned).neg();
- return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
- }
- /**
- * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
- * @function
- * @param {number} value The number in question
- * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
- * @returns {!Long} The corresponding Long value
- */
- Long.fromNumber = fromNumber;
- /**
- * @param {number} lowBits
- * @param {number} highBits
- * @param {boolean=} unsigned
- * @returns {!Long}
- * @inner
- */
- function fromBits(lowBits, highBits, unsigned) {
- return new Long(lowBits, highBits, unsigned);
- }
- /**
- * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
- * assumed to use 32 bits.
- * @function
- * @param {number} lowBits The low 32 bits
- * @param {number} highBits The high 32 bits
- * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
- * @returns {!Long} The corresponding Long value
- */
- Long.fromBits = fromBits;
- /**
- * @function
- * @param {number} base
- * @param {number} exponent
- * @returns {number}
- * @inner
- */
- var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
- /**
- * @param {string} str
- * @param {(boolean|number)=} unsigned
- * @param {number=} radix
- * @returns {!Long}
- * @inner
- */
- function fromString(str, unsigned, radix) {
- if (str.length === 0)
- throw Error('empty string');
- if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
- return ZERO;
- if (typeof unsigned === 'number') {
- // For goog.math.long compatibility
- radix = unsigned,
- unsigned = false;
- } else {
- unsigned = !! unsigned;
- }
- radix = radix || 10;
- if (radix < 2 || 36 < radix)
- throw RangeError('radix');
- var p;
- if ((p = str.indexOf('-')) > 0)
- throw Error('interior hyphen');
- else if (p === 0) {
- return fromString(str.substring(1), unsigned, radix).neg();
- }
- // Do several (8) digits each time through the loop, so as to
- // minimize the calls to the very expensive emulated div.
- var radixToPower = fromNumber(pow_dbl(radix, 8));
- var result = ZERO;
- for (var i = 0; i < str.length; i += 8) {
- var size = Math.min(8, str.length - i),
- value = parseInt(str.substring(i, i + size), radix);
- if (size < 8) {
- var power = fromNumber(pow_dbl(radix, size));
- result = result.mul(power).add(fromNumber(value));
- } else {
- result = result.mul(radixToPower);
- result = result.add(fromNumber(value));
- }
- }
- result.unsigned = unsigned;
- return result;
- }
- /**
- * Returns a Long representation of the given string, written using the specified radix.
- * @function
- * @param {string} str The textual representation of the Long
- * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
- * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
- * @returns {!Long} The corresponding Long value
- */
- Long.fromString = fromString;
- /**
- * @function
- * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
- * @returns {!Long}
- * @inner
- */
- function fromValue(val) {
- if (val /* is compatible */ instanceof Long)
- return val;
- if (typeof val === 'number')
- return fromNumber(val);
- if (typeof val === 'string')
- return fromString(val);
- // Throws for non-objects, converts non-instanceof Long:
- return fromBits(val.low, val.high, val.unsigned);
- }
- /**
- * Converts the specified value to a Long.
- * @function
- * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
- * @returns {!Long}
- */
- Long.fromValue = fromValue;
- // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
- // no runtime penalty for these.
- /**
- * @type {number}
- * @const
- * @inner
- */
- var TWO_PWR_16_DBL = 1 << 16;
- /**
- * @type {number}
- * @const
- * @inner
- */
- var TWO_PWR_24_DBL = 1 << 24;
- /**
- * @type {number}
- * @const
- * @inner
- */
- var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
- /**
- * @type {number}
- * @const
- * @inner
- */
- var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
- /**
- * @type {number}
- * @const
- * @inner
- */
- var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
- /**
- * @type {!Long}
- * @const
- * @inner
- */
- var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
- /**
- * @type {!Long}
- * @inner
- */
- var ZERO = fromInt(0);
- /**
- * Signed zero.
- * @type {!Long}
- */
- Long.ZERO = ZERO;
- /**
- * @type {!Long}
- * @inner
- */
- var UZERO = fromInt(0, true);
- /**
- * Unsigned zero.
- * @type {!Long}
- */
- Long.UZERO = UZERO;
- /**
- * @type {!Long}
- * @inner
- */
- var ONE = fromInt(1);
- /**
- * Signed one.
- * @type {!Long}
- */
- Long.ONE = ONE;
- /**
- * @type {!Long}
- * @inner
- */
- var UONE = fromInt(1, true);
- /**
- * Unsigned one.
- * @type {!Long}
- */
- Long.UONE = UONE;
- /**
- * @type {!Long}
- * @inner
- */
- var NEG_ONE = fromInt(-1);
- /**
- * Signed negative one.
- * @type {!Long}
- */
- Long.NEG_ONE = NEG_ONE;
- /**
- * @type {!Long}
- * @inner
- */
- var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
- /**
- * Maximum signed value.
- * @type {!Long}
- */
- Long.MAX_VALUE = MAX_VALUE;
- /**
- * @type {!Long}
- * @inner
- */
- var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
- /**
- * Maximum unsigned value.
- * @type {!Long}
- */
- Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
- /**
- * @type {!Long}
- * @inner
- */
- var MIN_VALUE = fromBits(0, 0x80000000|0, false);
- /**
- * Minimum signed value.
- * @type {!Long}
- */
- Long.MIN_VALUE = MIN_VALUE;
- /**
- * @alias Long.prototype
- * @inner
- */
- var LongPrototype = Long.prototype;
- /**
- * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
- * @returns {number}
- */
- LongPrototype.toInt = function toInt() {
- return this.unsigned ? this.low >>> 0 : this.low;
- };
- /**
- * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
- * @returns {number}
- */
- LongPrototype.toNumber = function toNumber() {
- if (this.unsigned)
- return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
- return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
- };
- /**
- * Converts the Long to a string written in the specified radix.
- * @param {number=} radix Radix (2-36), defaults to 10
- * @returns {string}
- * @override
- * @throws {RangeError} If `radix` is out of range
- */
- LongPrototype.toString = function toString(radix) {
- radix = radix || 10;
- if (radix < 2 || 36 < radix)
- throw RangeError('radix');
- if (this.isZero())
- return '0';
- if (this.isNegative()) { // Unsigned Longs are never negative
- if (this.eq(MIN_VALUE)) {
- // We need to change the Long value before it can be negated, so we remove
- // the bottom-most digit in this base and then recurse to do the rest.
- var radixLong = fromNumber(radix),
- div = this.div(radixLong),
- rem1 = div.mul(radixLong).sub(this);
- return div.toString(radix) + rem1.toInt().toString(radix);
- } else
- return '-' + this.neg().toString(radix);
- }
- // Do several (6) digits each time through the loop, so as to
- // minimize the calls to the very expensive emulated div.
- var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
- rem = this;
- var result = '';
- while (true) {
- var remDiv = rem.div(radixToPower),
- intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
- digits = intval.toString(radix);
- rem = remDiv;
- if (rem.isZero())
- return digits + result;
- else {
- while (digits.length < 6)
- digits = '0' + digits;
- result = '' + digits + result;
- }
- }
- };
- /**
- * Gets the high 32 bits as a signed integer.
- * @returns {number} Signed high bits
- */
- LongPrototype.getHighBits = function getHighBits() {
- return this.high;
- };
- /**
- * Gets the high 32 bits as an unsigned integer.
- * @returns {number} Unsigned high bits
- */
- LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
- return this.high >>> 0;
- };
- /**
- * Gets the low 32 bits as a signed integer.
- * @returns {number} Signed low bits
- */
- LongPrototype.getLowBits = function getLowBits() {
- return this.low;
- };
- /**
- * Gets the low 32 bits as an unsigned integer.
- * @returns {number} Unsigned low bits
- */
- LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
- return this.low >>> 0;
- };
- /**
- * Gets the number of bits needed to represent the absolute value of this Long.
- * @returns {number}
- */
- LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
- if (this.isNegative()) // Unsigned Longs are never negative
- return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
- var val = this.high != 0 ? this.high : this.low;
- for (var bit = 31; bit > 0; bit--)
- if ((val & (1 << bit)) != 0)
- break;
- return this.high != 0 ? bit + 33 : bit + 1;
- };
- /**
- * Tests if this Long's value equals zero.
- * @returns {boolean}
- */
- LongPrototype.isZero = function isZero() {
- return this.high === 0 && this.low === 0;
- };
- /**
- * Tests if this Long's value is negative.
- * @returns {boolean}
- */
- LongPrototype.isNegative = function isNegative() {
- return !this.unsigned && this.high < 0;
- };
- /**
- * Tests if this Long's value is positive.
- * @returns {boolean}
- */
- LongPrototype.isPositive = function isPositive() {
- return this.unsigned || this.high >= 0;
- };
- /**
- * Tests if this Long's value is odd.
- * @returns {boolean}
- */
- LongPrototype.isOdd = function isOdd() {
- return (this.low & 1) === 1;
- };
- /**
- * Tests if this Long's value is even.
- * @returns {boolean}
- */
- LongPrototype.isEven = function isEven() {
- return (this.low & 1) === 0;
- };
- /**
- * Tests if this Long's value equals the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.equals = function equals(other) {
- if (!isLong(other))
- other = fromValue(other);
- if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
- return false;
- return this.high === other.high && this.low === other.low;
- };
- /**
- * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.eq = LongPrototype.equals;
- /**
- * Tests if this Long's value differs from the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.notEquals = function notEquals(other) {
- return !this.eq(/* validates */ other);
- };
- /**
- * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.neq = LongPrototype.notEquals;
- /**
- * Tests if this Long's value is less than the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.lessThan = function lessThan(other) {
- return this.comp(/* validates */ other) < 0;
- };
- /**
- * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.lt = LongPrototype.lessThan;
- /**
- * Tests if this Long's value is less than or equal the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
- return this.comp(/* validates */ other) <= 0;
- };
- /**
- * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.lte = LongPrototype.lessThanOrEqual;
- /**
- * Tests if this Long's value is greater than the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.greaterThan = function greaterThan(other) {
- return this.comp(/* validates */ other) > 0;
- };
- /**
- * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.gt = LongPrototype.greaterThan;
- /**
- * Tests if this Long's value is greater than or equal the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
- return this.comp(/* validates */ other) >= 0;
- };
- /**
- * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {boolean}
- */
- LongPrototype.gte = LongPrototype.greaterThanOrEqual;
- /**
- * Compares this Long's value with the specified's.
- * @param {!Long|number|string} other Other value
- * @returns {number} 0 if they are the same, 1 if the this is greater and -1
- * if the given one is greater
- */
- LongPrototype.compare = function compare(other) {
- if (!isLong(other))
- other = fromValue(other);
- if (this.eq(other))
- return 0;
- var thisNeg = this.isNegative(),
- otherNeg = other.isNegative();
- if (thisNeg && !otherNeg)
- return -1;
- if (!thisNeg && otherNeg)
- return 1;
- // At this point the sign bits are the same
- if (!this.unsigned)
- return this.sub(other).isNegative() ? -1 : 1;
- // Both are positive if at least one is unsigned
- return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
- };
- /**
- * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
- * @function
- * @param {!Long|number|string} other Other value
- * @returns {number} 0 if they are the same, 1 if the this is greater and -1
- * if the given one is greater
- */
- LongPrototype.comp = LongPrototype.compare;
- /**
- * Negates this Long's value.
- * @returns {!Long} Negated Long
- */
- LongPrototype.negate = function negate() {
- if (!this.unsigned && this.eq(MIN_VALUE))
- return MIN_VALUE;
- return this.not().add(ONE);
- };
- /**
- * Negates this Long's value. This is an alias of {@link Long#negate}.
- * @function
- * @returns {!Long} Negated Long
- */
- LongPrototype.neg = LongPrototype.negate;
- /**
- * Returns the sum of this and the specified Long.
- * @param {!Long|number|string} addend Addend
- * @returns {!Long} Sum
- */
- LongPrototype.add = function add(addend) {
- if (!isLong(addend))
- addend = fromValue(addend);
- // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
- var a48 = this.high >>> 16;
- var a32 = this.high & 0xFFFF;
- var a16 = this.low >>> 16;
- var a00 = this.low & 0xFFFF;
- var b48 = addend.high >>> 16;
- var b32 = addend.high & 0xFFFF;
- var b16 = addend.low >>> 16;
- var b00 = addend.low & 0xFFFF;
- var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
- c00 += a00 + b00;
- c16 += c00 >>> 16;
- c00 &= 0xFFFF;
- c16 += a16 + b16;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c32 += a32 + b32;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c48 += a48 + b48;
- c48 &= 0xFFFF;
- return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
- };
- /**
- * Returns the difference of this and the specified Long.
- * @param {!Long|number|string} subtrahend Subtrahend
- * @returns {!Long} Difference
- */
- LongPrototype.subtract = function subtract(subtrahend) {
- if (!isLong(subtrahend))
- subtrahend = fromValue(subtrahend);
- return this.add(subtrahend.neg());
- };
- /**
- * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
- * @function
- * @param {!Long|number|string} subtrahend Subtrahend
- * @returns {!Long} Difference
- */
- LongPrototype.sub = LongPrototype.subtract;
- /**
- * Returns the product of this and the specified Long.
- * @param {!Long|number|string} multiplier Multiplier
- * @returns {!Long} Product
- */
- LongPrototype.multiply = function multiply(multiplier) {
- if (this.isZero())
- return ZERO;
- if (!isLong(multiplier))
- multiplier = fromValue(multiplier);
- if (multiplier.isZero())
- return ZERO;
- if (this.eq(MIN_VALUE))
- return multiplier.isOdd() ? MIN_VALUE : ZERO;
- if (multiplier.eq(MIN_VALUE))
- return this.isOdd() ? MIN_VALUE : ZERO;
- if (this.isNegative()) {
- if (multiplier.isNegative())
- return this.neg().mul(multiplier.neg());
- else
- return this.neg().mul(multiplier).neg();
- } else if (multiplier.isNegative())
- return this.mul(multiplier.neg()).neg();
- // If both longs are small, use float multiplication
- if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
- return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
- // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
- // We can skip products that would overflow.
- var a48 = this.high >>> 16;
- var a32 = this.high & 0xFFFF;
- var a16 = this.low >>> 16;
- var a00 = this.low & 0xFFFF;
- var b48 = multiplier.high >>> 16;
- var b32 = multiplier.high & 0xFFFF;
- var b16 = multiplier.low >>> 16;
- var b00 = multiplier.low & 0xFFFF;
- var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
- c00 += a00 * b00;
- c16 += c00 >>> 16;
- c00 &= 0xFFFF;
- c16 += a16 * b00;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c16 += a00 * b16;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c32 += a32 * b00;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c32 += a16 * b16;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c32 += a00 * b32;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
- c48 &= 0xFFFF;
- return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
- };
- /**
- * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
- * @function
- * @param {!Long|number|string} multiplier Multiplier
- * @returns {!Long} Product
- */
- LongPrototype.mul = LongPrototype.multiply;
- /**
- * Returns this Long divided by the specified. The result is signed if this Long is signed or
- * unsigned if this Long is unsigned.
- * @param {!Long|number|string} divisor Divisor
- * @returns {!Long} Quotient
- */
- LongPrototype.divide = function divide(divisor) {
- if (!isLong(divisor))
- divisor = fromValue(divisor);
- if (divisor.isZero())
- throw Error('division by zero');
- if (this.isZero())
- return this.unsigned ? UZERO : ZERO;
- var approx, rem, res;
- if (!this.unsigned) {
- // This section is only relevant for signed longs and is derived from the
- // closure library as a whole.
- if (this.eq(MIN_VALUE)) {
- if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
- return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
- else if (divisor.eq(MIN_VALUE))
- return ONE;
- else {
- // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
- var halfThis = this.shr(1);
- approx = halfThis.div(divisor).shl(1);
- if (approx.eq(ZERO)) {
- return divisor.isNegative() ? ONE : NEG_ONE;
- } else {
- rem = this.sub(divisor.mul(approx));
- res = approx.add(rem.div(divisor));
- return res;
- }
- }
- } else if (divisor.eq(MIN_VALUE))
- return this.unsigned ? UZERO : ZERO;
- if (this.isNegative()) {
- if (divisor.isNegative())
- return this.neg().div(divisor.neg());
- return this.neg().div(divisor).neg();
- } else if (divisor.isNegative())
- return this.div(divisor.neg()).neg();
- res = ZERO;
- } else {
- // The algorithm below has not been made for unsigned longs. It's therefore
- // required to take special care of the MSB prior to running it.
- if (!divisor.unsigned)
- divisor = divisor.toUnsigned();
- if (divisor.gt(this))
- return UZERO;
- if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
- return UONE;
- res = UZERO;
- }
- // Repeat the following until the remainder is less than other: find a
- // floating-point that approximates remainder / other *from below*, add this
- // into the result, and subtract it from the remainder. It is critical that
- // the approximate value is less than or equal to the real value so that the
- // remainder never becomes negative.
- rem = this;
- while (rem.gte(divisor)) {
- // Approximate the result of division. This may be a little greater or
- // smaller than the actual value.
- approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
- // We will tweak the approximate result by changing it in the 48-th digit or
- // the smallest non-fractional digit, whichever is larger.
- var log2 = Math.ceil(Math.log(approx) / Math.LN2),
- delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
- // Decrease the approximation until it is smaller than the remainder. Note
- // that if it is too large, the product overflows and is negative.
- approxRes = fromNumber(approx),
- approxRem = approxRes.mul(divisor);
- while (approxRem.isNegative() || approxRem.gt(rem)) {
- approx -= delta;
- approxRes = fromNumber(approx, this.unsigned);
- approxRem = approxRes.mul(divisor);
- }
- // We know the answer can't be zero... and actually, zero would cause
- // infinite recursion since we would make no progress.
- if (approxRes.isZero())
- approxRes = ONE;
- res = res.add(approxRes);
- rem = rem.sub(approxRem);
- }
- return res;
- };
- /**
- * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
- * @function
- * @param {!Long|number|string} divisor Divisor
- * @returns {!Long} Quotient
- */
- LongPrototype.div = LongPrototype.divide;
- /**
- * Returns this Long modulo the specified.
- * @param {!Long|number|string} divisor Divisor
- * @returns {!Long} Remainder
- */
- LongPrototype.modulo = function modulo(divisor) {
- if (!isLong(divisor))
- divisor = fromValue(divisor);
- return this.sub(this.div(divisor).mul(divisor));
- };
- /**
- * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
- * @function
- * @param {!Long|number|string} divisor Divisor
- * @returns {!Long} Remainder
- */
- LongPrototype.mod = LongPrototype.modulo;
- /**
- * Returns the bitwise NOT of this Long.
- * @returns {!Long}
- */
- LongPrototype.not = function not() {
- return fromBits(~this.low, ~this.high, this.unsigned);
- };
- /**
- * Returns the bitwise AND of this Long and the specified.
- * @param {!Long|number|string} other Other Long
- * @returns {!Long}
- */
- LongPrototype.and = function and(other) {
- if (!isLong(other))
- other = fromValue(other);
- return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
- };
- /**
- * Returns the bitwise OR of this Long and the specified.
- * @param {!Long|number|string} other Other Long
- * @returns {!Long}
- */
- LongPrototype.or = function or(other) {
- if (!isLong(other))
- other = fromValue(other);
- return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
- };
- /**
- * Returns the bitwise XOR of this Long and the given one.
- * @param {!Long|number|string} other Other Long
- * @returns {!Long}
- */
- LongPrototype.xor = function xor(other) {
- if (!isLong(other))
- other = fromValue(other);
- return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
- };
- /**
- * Returns this Long with bits shifted to the left by the given amount.
- * @param {number|!Long} numBits Number of bits
- * @returns {!Long} Shifted Long
- */
- LongPrototype.shiftLeft = function shiftLeft(numBits) {
- if (isLong(numBits))
- numBits = numBits.toInt();
- if ((numBits &= 63) === 0)
- return this;
- else if (numBits < 32)
- return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
- else
- return fromBits(0, this.low << (numBits - 32), this.unsigned);
- };
- /**
- * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
- * @function
- * @param {number|!Long} numBits Number of bits
- * @returns {!Long} Shifted Long
- */
- LongPrototype.shl = LongPrototype.shiftLeft;
- /**
- * Returns this Long with bits arithmetically shifted to the right by the given amount.
- * @param {number|!Long} numBits Number of bits
- * @returns {!Long} Shifted Long
- */
- LongPrototype.shiftRight = function shiftRight(numBits) {
- if (isLong(numBits))
- numBits = numBits.toInt();
- if ((numBits &= 63) === 0)
- return this;
- else if (numBits < 32)
- return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
- else
- return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
- };
- /**
- * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
- * @function
- * @param {number|!Long} numBits Number of bits
- * @returns {!Long} Shifted Long
- */
- LongPrototype.shr = LongPrototype.shiftRight;
- /**
- * Returns this Long with bits logically shifted to the right by the given amount.
- * @param {number|!Long} numBits Number of bits
- * @returns {!Long} Shifted Long
- */
- LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
- if (isLong(numBits))
- numBits = numBits.toInt();
- numBits &= 63;
- if (numBits === 0)
- return this;
- else {
- var high = this.high;
- if (numBits < 32) {
- var low = this.low;
- return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
- } else if (numBits === 32)
- return fromBits(high, 0, this.unsigned);
- else
- return fromBits(high >>> (numBits - 32), 0, this.unsigned);
- }
- };
- /**
- * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
- * @function
- * @param {number|!Long} numBits Number of bits
- * @returns {!Long} Shifted Long
- */
- LongPrototype.shru = LongPrototype.shiftRightUnsigned;
- /**
- * Converts this Long to signed.
- * @returns {!Long} Signed long
- */
- LongPrototype.toSigned = function toSigned() {
- if (!this.unsigned)
- return this;
- return fromBits(this.low, this.high, false);
- };
- /**
- * Converts this Long to unsigned.
- * @returns {!Long} Unsigned long
- */
- LongPrototype.toUnsigned = function toUnsigned() {
- if (this.unsigned)
- return this;
- return fromBits(this.low, this.high, true);
- };
- /**
- * Converts this Long to its byte representation.
- * @param {boolean=} le Whether little or big endian, defaults to big endian
- * @returns {!Array.<number>} Byte representation
- */
- LongPrototype.toBytes = function(le) {
- return le ? this.toBytesLE() : this.toBytesBE();
- }
- /**
- * Converts this Long to its little endian byte representation.
- * @returns {!Array.<number>} Little endian byte representation
- */
- LongPrototype.toBytesLE = function() {
- var hi = this.high,
- lo = this.low;
- return [
- lo & 0xff,
- (lo >>> 8) & 0xff,
- (lo >>> 16) & 0xff,
- (lo >>> 24) & 0xff,
- hi & 0xff,
- (hi >>> 8) & 0xff,
- (hi >>> 16) & 0xff,
- (hi >>> 24) & 0xff
- ];
- }
- /**
- * Converts this Long to its big endian byte representation.
- * @returns {!Array.<number>} Big endian byte representation
- */
- LongPrototype.toBytesBE = function() {
- var hi = this.high,
- lo = this.low;
- return [
- (hi >>> 24) & 0xff,
- (hi >>> 16) & 0xff,
- (hi >>> 8) & 0xff,
- hi & 0xff,
- (lo >>> 24) & 0xff,
- (lo >>> 16) & 0xff,
- (lo >>> 8) & 0xff,
- lo & 0xff
- ];
- }
- return Long;
- });
- /***/ }),
- /* 615 */
- /***/ (function(module, exports) {
- /* (ignored) */
- /***/ }),
- /* 616 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(1);
- var _slice = _interopRequireDefault(__webpack_require__(61));
- var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var has = Object.prototype.hasOwnProperty,
- prefix = '~';
- /**
- * Constructor to create a storage for our `EE` objects.
- * An `Events` instance is a plain object whose properties are event names.
- *
- * @constructor
- * @private
- */
- function Events() {} //
- // We try to not inherit from `Object.prototype`. In some engines creating an
- // instance in this way is faster than calling `Object.create(null)` directly.
- // If `Object.create(null)` is not supported we prefix the event names with a
- // character to make sure that the built-in object properties are not
- // overridden or used as an attack vector.
- //
- if (Object.create) {
- Events.prototype = Object.create(null); //
- // This hack is needed because the `__proto__` property is still inherited in
- // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
- //
- if (!new Events().__proto__) prefix = false;
- }
- /**
- * Representation of a single event listener.
- *
- * @param {Function} fn The listener function.
- * @param {*} context The context to invoke the listener with.
- * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
- * @constructor
- * @private
- */
- function EE(fn, context, once) {
- this.fn = fn;
- this.context = context;
- this.once = once || false;
- }
- /**
- * Add a listener for a given event.
- *
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
- * @param {(String|Symbol)} event The event name.
- * @param {Function} fn The listener function.
- * @param {*} context The context to invoke the listener with.
- * @param {Boolean} once Specify if the listener is a one-time listener.
- * @returns {EventEmitter}
- * @private
- */
- function addListener(emitter, event, fn, context, once) {
- if (typeof fn !== 'function') {
- throw new TypeError('The listener must be a function');
- }
- var listener = new EE(fn, context || emitter, once),
- evt = prefix ? prefix + event : event;
- if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
- return emitter;
- }
- /**
- * Clear event by name.
- *
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
- * @param {(String|Symbol)} evt The Event name.
- * @private
- */
- function clearEvent(emitter, evt) {
- if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
- }
- /**
- * Minimal `EventEmitter` interface that is molded against the Node.js
- * `EventEmitter` interface.
- *
- * @constructor
- * @public
- */
- function EventEmitter() {
- this._events = new Events();
- this._eventsCount = 0;
- }
- /**
- * Return an array listing the events for which the emitter has registered
- * listeners.
- *
- * @returns {Array}
- * @public
- */
- EventEmitter.prototype.eventNames = function eventNames() {
- var names = [],
- events,
- name;
- if (this._eventsCount === 0) return names;
- for (name in events = this._events) {
- if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
- }
- if (_getOwnPropertySymbols.default) {
- return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
- }
- return names;
- };
- /**
- * Return the listeners registered for a given event.
- *
- * @param {(String|Symbol)} event The event name.
- * @returns {Array} The registered listeners.
- * @public
- */
- EventEmitter.prototype.listeners = function listeners(event) {
- var evt = prefix ? prefix + event : event,
- handlers = this._events[evt];
- if (!handlers) return [];
- if (handlers.fn) return [handlers.fn];
- for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
- ee[i] = handlers[i].fn;
- }
- return ee;
- };
- /**
- * Return the number of listeners listening to a given event.
- *
- * @param {(String|Symbol)} event The event name.
- * @returns {Number} The number of listeners.
- * @public
- */
- EventEmitter.prototype.listenerCount = function listenerCount(event) {
- var evt = prefix ? prefix + event : event,
- listeners = this._events[evt];
- if (!listeners) return 0;
- if (listeners.fn) return 1;
- return listeners.length;
- };
- /**
- * Calls each of the listeners registered for a given event.
- *
- * @param {(String|Symbol)} event The event name.
- * @returns {Boolean} `true` if the event had listeners, else `false`.
- * @public
- */
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
- var evt = prefix ? prefix + event : event;
- if (!this._events[evt]) return false;
- var listeners = this._events[evt],
- len = arguments.length,
- args,
- i;
- if (listeners.fn) {
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
- switch (len) {
- case 1:
- return listeners.fn.call(listeners.context), true;
- case 2:
- return listeners.fn.call(listeners.context, a1), true;
- case 3:
- return listeners.fn.call(listeners.context, a1, a2), true;
- case 4:
- return listeners.fn.call(listeners.context, a1, a2, a3), true;
- case 5:
- return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
- case 6:
- return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
- }
- for (i = 1, args = new Array(len - 1); i < len; i++) {
- args[i - 1] = arguments[i];
- }
- listeners.fn.apply(listeners.context, args);
- } else {
- var length = listeners.length,
- j;
- for (i = 0; i < length; i++) {
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
- switch (len) {
- case 1:
- listeners[i].fn.call(listeners[i].context);
- break;
- case 2:
- listeners[i].fn.call(listeners[i].context, a1);
- break;
- case 3:
- listeners[i].fn.call(listeners[i].context, a1, a2);
- break;
- case 4:
- listeners[i].fn.call(listeners[i].context, a1, a2, a3);
- break;
- default:
- if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
- args[j - 1] = arguments[j];
- }
- listeners[i].fn.apply(listeners[i].context, args);
- }
- }
- }
- return true;
- };
- /**
- * Add a listener for a given event.
- *
- * @param {(String|Symbol)} event The event name.
- * @param {Function} fn The listener function.
- * @param {*} [context=this] The context to invoke the listener with.
- * @returns {EventEmitter} `this`.
- * @public
- */
- EventEmitter.prototype.on = function on(event, fn, context) {
- return addListener(this, event, fn, context, false);
- };
- /**
- * Add a one-time listener for a given event.
- *
- * @param {(String|Symbol)} event The event name.
- * @param {Function} fn The listener function.
- * @param {*} [context=this] The context to invoke the listener with.
- * @returns {EventEmitter} `this`.
- * @public
- */
- EventEmitter.prototype.once = function once(event, fn, context) {
- return addListener(this, event, fn, context, true);
- };
- /**
- * Remove the listeners of a given event.
- *
- * @param {(String|Symbol)} event The event name.
- * @param {Function} fn Only remove the listeners that match this function.
- * @param {*} context Only remove the listeners that have this context.
- * @param {Boolean} once Only remove one-time listeners.
- * @returns {EventEmitter} `this`.
- * @public
- */
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
- var evt = prefix ? prefix + event : event;
- if (!this._events[evt]) return this;
- if (!fn) {
- clearEvent(this, evt);
- return this;
- }
- var listeners = this._events[evt];
- if (listeners.fn) {
- if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
- clearEvent(this, evt);
- }
- } else {
- for (var i = 0, events = [], length = listeners.length; i < length; i++) {
- if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
- events.push(listeners[i]);
- }
- } //
- // Reset the array, or remove it completely if we have no more listeners.
- //
- if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
- }
- return this;
- };
- /**
- * Remove all listeners, or those of the specified event.
- *
- * @param {(String|Symbol)} [event] The event name.
- * @returns {EventEmitter} `this`.
- * @public
- */
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
- var evt;
- if (event) {
- evt = prefix ? prefix + event : event;
- if (this._events[evt]) clearEvent(this, evt);
- } else {
- this._events = new Events();
- this._eventsCount = 0;
- }
- return this;
- }; //
- // Alias methods names because people roll like that.
- //
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
- EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
- // Expose the prefix.
- //
- EventEmitter.prefixed = prefix; //
- // Allow `EventEmitter` to be imported as module namespace.
- //
- EventEmitter.EventEmitter = EventEmitter; //
- // Expose the module.
- //
- if (true) {
- module.exports = EventEmitter;
- }
- /***/ }),
- /* 617 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(618);
- /***/ }),
- /* 618 */
- /***/ (function(module, exports, __webpack_require__) {
- /**
- * Copyright (c) 2014-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var runtime = (function (exports) {
- "use strict";
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined; // More compressible than void 0.
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- return obj[key];
- }
- try {
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
- define({}, "");
- } catch (err) {
- define = function(obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- // The ._invoke method unifies the implementations of the .next,
- // .throw, and .return methods.
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- exports.wrap = wrap;
- // Try/catch helper to minimize deoptimizations. Returns a completion
- // record like context.tryEntries[i].completion. This interface could
- // have been (and was previously) designed to take a closure to be
- // invoked without arguments, but in all the cases we care about we
- // already have an existing method we want to call, so there's no need
- // to create a new function object. We can even get away with assuming
- // the method takes exactly one argument, since that happens to be true
- // in every case, so we don't have to touch the arguments object. The
- // only additional allocation required is the completion record, which
- // has a stable shape and so hopefully should be cheap to allocate.
- function tryCatch(fn, obj, arg) {
- try {
- return { type: "normal", arg: fn.call(obj, arg) };
- } catch (err) {
- return { type: "throw", arg: err };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- // Returning this object from the innerFn has the same effect as
- // breaking out of the dispatch switch statement.
- var ContinueSentinel = {};
- // Dummy constructor functions that we use as the .constructor and
- // .constructor.prototype properties for functions that return Generator
- // objects. For full spec compliance, you may wish to configure your
- // minifier not to mangle the names of these two functions.
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- // This is a polyfill for %IteratorPrototype% for environments that
- // don't natively support it.
- var IteratorPrototype = {};
- IteratorPrototype[iteratorSymbol] = function () {
- return this;
- };
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype &&
- NativeIteratorPrototype !== Op &&
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- // This environment has a native %IteratorPrototype%; use it instead
- // of the polyfill.
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype =
- Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
- GeneratorFunction.displayName = define(
- GeneratorFunctionPrototype,
- toStringTagSymbol,
- "GeneratorFunction"
- );
- // Helper for defining the .next, .throw, and .return methods of the
- // Iterator interface in terms of a single ._invoke method.
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function(method) {
- define(prototype, method, function(arg) {
- return this._invoke(method, arg);
- });
- });
- }
- exports.isGeneratorFunction = function(genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor
- ? ctor === GeneratorFunction ||
- // For the native GeneratorFunction constructor, the best we can
- // do is to check its .name property.
- (ctor.displayName || ctor.name) === "GeneratorFunction"
- : false;
- };
- exports.mark = function(genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- define(genFun, toStringTagSymbol, "GeneratorFunction");
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- // Within the body of any async function, `await x` is transformed to
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
- // meant to be awaited.
- exports.awrap = function(arg) {
- return { __await: arg };
- };
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value &&
- typeof value === "object" &&
- hasOwn.call(value, "__await")) {
- return PromiseImpl.resolve(value.__await).then(function(value) {
- invoke("next", value, resolve, reject);
- }, function(err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return PromiseImpl.resolve(value).then(function(unwrapped) {
- // When a yielded Promise is resolved, its final value becomes
- // the .value of the Promise<{value,done}> result for the
- // current iteration.
- result.value = unwrapped;
- resolve(result);
- }, function(error) {
- // If a rejected Promise was yielded, throw the rejection back
- // into the async generator function so it can be handled there.
- return invoke("throw", error, resolve, reject);
- });
- }
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function(resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise =
- // If enqueue has been called before, then we want to wait until
- // all previous Promises have been resolved before calling invoke,
- // so that results are always delivered in the correct order. If
- // enqueue has not been called before, then it is important to
- // call invoke immediately, without waiting on a callback to fire,
- // so that the async generator function has the opportunity to do
- // any necessary setup in a predictable way. This predictability
- // is why the Promise constructor synchronously invokes its
- // executor callback, and why async functions synchronously
- // execute code before the first await. Since we implement simple
- // async functions in terms of async generators, it is especially
- // important to get this right, even though it requires care.
- previousPromise ? previousPromise.then(
- callInvokeWithMethodAndArg,
- // Avoid propagating failures to Promises returned by later
- // invocations of the iterator.
- callInvokeWithMethodAndArg
- ) : callInvokeWithMethodAndArg();
- }
- // Define the unified helper method that is used to implement .next,
- // .throw, and .return (see defineIteratorMethods).
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
- return this;
- };
- exports.AsyncIterator = AsyncIterator;
- // Note that simple async functions are implemented on top of
- // AsyncIterator objects; they just return a Promise for the value of
- // the final result produced by the iterator.
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- if (PromiseImpl === void 0) PromiseImpl = Promise;
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList),
- PromiseImpl
- );
- return exports.isGeneratorFunction(outerFn)
- ? iter // If outerFn is a generator, return the full iterator.
- : iter.next().then(function(result) {
- return result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- // Be forgiving, per 25.3.3.3.3 of the spec:
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- // Setting context._sent for legacy support of Babel's
- // function.sent implementation.
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- // If an exception is thrown from innerFn, we leave state ===
- // GenStateExecuting and loop back for another invocation.
- state = context.done
- ? GenStateCompleted
- : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- // Dispatch the exception by looping back around to the
- // context.dispatchException(context.arg) call above.
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- // Call delegate.iterator[context.method](context.arg) and handle the
- // result, either by returning a { value, done } result from the
- // delegate iterator, or by modifying context.method and context.arg,
- // setting context.delegate to null, and returning the ContinueSentinel.
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined) {
- // A .throw or .return when the delegate iterator has no .throw
- // method always terminates the yield* loop.
- context.delegate = null;
- if (context.method === "throw") {
- // Note: ["return"] must be used for ES3 parsing compatibility.
- if (delegate.iterator["return"]) {
- // If the delegate iterator has a return method, give it a
- // chance to clean up.
- context.method = "return";
- context.arg = undefined;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- // If maybeInvokeDelegate(context) changed context.method from
- // "return" to "throw", let that override the TypeError below.
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError(
- "The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (! info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- // Assign the result of the finished delegate to the temporary
- // variable specified by delegate.resultName (see delegateYield).
- context[delegate.resultName] = info.value;
- // Resume execution at the desired location (see delegateYield).
- context.next = delegate.nextLoc;
- // If context.method was "throw" but the delegate handled the
- // exception, let the outer generator proceed normally. If
- // context.method was "next", forget context.arg since it has been
- // "consumed" by the delegate iterator. If context.method was
- // "return", allow the original .return call to continue in the
- // outer generator.
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined;
- }
- } else {
- // Re-yield the result returned by the delegate method.
- return info;
- }
- // The delegate iterator is finished, so forget it and continue with
- // the outer generator.
- context.delegate = null;
- return ContinueSentinel;
- }
- // Define Generator.prototype.{next,throw,return} in terms of the
- // unified ._invoke helper method.
- defineIteratorMethods(Gp);
- define(Gp, toStringTagSymbol, "Generator");
- // A Generator should always return itself as the iterator object when the
- // @@iterator function is called on it. Some browsers' implementations of the
- // iterator prototype chain incorrectly implement this, causing the Generator
- // object to not be returned from this call. This ensures that doesn't happen.
- // See https://github.com/facebook/regenerator/issues/274 for more details.
- Gp[iteratorSymbol] = function() {
- return this;
- };
- Gp.toString = function() {
- return "[object Generator]";
- };
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- // The root entry object (effectively a try statement without a catch
- // or a finally block) gives us a place to store values thrown from
- // locations where there is no enclosing try statement.
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- exports.keys = function(object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- // Rather than returning an object with a next method, we keep
- // things simple and return the next function itself.
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- // To avoid creating an additional object, we just hang the .value
- // and .done properties off the next function object itself. This
- // also ensures that the minifier will not anonymize the function.
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1, next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- // Return an iterator with no values.
- return { next: doneResult };
- }
- exports.values = values;
- function doneResult() {
- return { value: undefined, done: true };
- }
- Context.prototype = {
- constructor: Context,
- reset: function(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- // Resetting context._sent for legacy support of Babel's
- // function.sent implementation.
- this.sent = this._sent = undefined;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- // Not sure about the optimal order of these conditions:
- if (name.charAt(0) === "t" &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
- stop: function() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- // If the dispatched exception was caught by a catch block,
- // then let that catch block handle the exception normally.
- context.method = "next";
- context.arg = undefined;
- }
- return !! caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- // Exception thrown outside of any try block that could handle
- // it, so set the completion value of the entire function to
- // throw the exception.
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry &&
- (type === "break" ||
- type === "continue") &&
- finallyEntry.tryLoc <= arg &&
- arg <= finallyEntry.finallyLoc) {
- // Ignore the finally entry if control is not jumping to a
- // location outside the try/catch block.
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" ||
- record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- // The context.catch method must only be called with a location
- // argument that corresponds to a known catch block.
- throw new Error("illegal catch attempt");
- },
- delegateYield: function(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- // Deliberately forget the last sent value so that we don't
- // accidentally pass it on to the delegate.
- this.arg = undefined;
- }
- return ContinueSentinel;
- }
- };
- // Regardless of whether this script is executing as a CommonJS module
- // or not, return the runtime object so that we can declare the variable
- // regeneratorRuntime in the outer scope, which allows this module to be
- // injected easily by `bin/regenerator --include-runtime script.js`.
- return exports;
- }(
- // If this script is executing as a CommonJS module, use module.exports
- // as the regeneratorRuntime namespace. Otherwise create a new empty
- // object. Either way, the resulting object will be used to initialize
- // the regeneratorRuntime variable at the top of this file.
- true ? module.exports : {}
- ));
- try {
- regeneratorRuntime = runtime;
- } catch (accidentalStrictMode) {
- // This module should not be running in strict mode, so the above
- // assignment should always work unless something is misconfigured. Just
- // in case runtime.js accidentally runs in strict mode, we can escape
- // strict mode using a global Function call. This could conceivably fail
- // if a Content Security Policy forbids using Function, but in that case
- // the proper solution is to fix the accidental strict mode problem. If
- // you've misconfigured your bundler to force strict mode and applied a
- // CSP to forbid Function, and you're not willing to fix either of those
- // problems, please detail your unique predicament in a GitHub issue.
- Function("r", "regeneratorRuntime = r")(runtime);
- }
- /***/ }),
- /* 619 */
- /***/ (function(module, exports) {
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
- }
- function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
- }
- module.exports = _asyncToGenerator;
- /***/ }),
- /* 620 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithoutHoles = __webpack_require__(621);
- var iterableToArray = __webpack_require__(266);
- var unsupportedIterableToArray = __webpack_require__(267);
- var nonIterableSpread = __webpack_require__(622);
- function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
- }
- module.exports = _toConsumableArray;
- /***/ }),
- /* 621 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayLikeToArray = __webpack_require__(265);
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
- }
- module.exports = _arrayWithoutHoles;
- /***/ }),
- /* 622 */
- /***/ (function(module, exports) {
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableSpread;
- /***/ }),
- /* 623 */
- /***/ (function(module, exports) {
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- module.exports = _defineProperty;
- /***/ }),
- /* 624 */
- /***/ (function(module, exports, __webpack_require__) {
- var objectWithoutPropertiesLoose = __webpack_require__(625);
- function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
- }
- module.exports = _objectWithoutProperties;
- /***/ }),
- /* 625 */
- /***/ (function(module, exports) {
- function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
- }
- module.exports = _objectWithoutPropertiesLoose;
- /***/ }),
- /* 626 */
- /***/ (function(module, exports) {
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- module.exports = _assertThisInitialized;
- /***/ }),
- /* 627 */
- /***/ (function(module, exports) {
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
- }
- module.exports = _inheritsLoose;
- /***/ }),
- /* 628 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayShuffle = __webpack_require__(629),
- baseShuffle = __webpack_require__(632),
- isArray = __webpack_require__(273);
- /**
- * Creates an array of shuffled values, using a version of the
- * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to shuffle.
- * @returns {Array} Returns the new shuffled array.
- * @example
- *
- * _.shuffle([1, 2, 3, 4]);
- * // => [4, 1, 3, 2]
- */
- function shuffle(collection) {
- var func = isArray(collection) ? arrayShuffle : baseShuffle;
- return func(collection);
- }
- module.exports = shuffle;
- /***/ }),
- /* 629 */
- /***/ (function(module, exports, __webpack_require__) {
- var copyArray = __webpack_require__(630),
- shuffleSelf = __webpack_require__(268);
- /**
- * A specialized version of `_.shuffle` for arrays.
- *
- * @private
- * @param {Array} array The array to shuffle.
- * @returns {Array} Returns the new shuffled array.
- */
- function arrayShuffle(array) {
- return shuffleSelf(copyArray(array));
- }
- module.exports = arrayShuffle;
- /***/ }),
- /* 630 */
- /***/ (function(module, exports) {
- /**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
- function copyArray(source, array) {
- var index = -1,
- length = source.length;
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
- }
- module.exports = copyArray;
- /***/ }),
- /* 631 */
- /***/ (function(module, exports) {
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeFloor = Math.floor,
- nativeRandom = Math.random;
- /**
- * The base implementation of `_.random` without support for returning
- * floating-point numbers.
- *
- * @private
- * @param {number} lower The lower bound.
- * @param {number} upper The upper bound.
- * @returns {number} Returns the random number.
- */
- function baseRandom(lower, upper) {
- return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
- }
- module.exports = baseRandom;
- /***/ }),
- /* 632 */
- /***/ (function(module, exports, __webpack_require__) {
- var shuffleSelf = __webpack_require__(268),
- values = __webpack_require__(269);
- /**
- * The base implementation of `_.shuffle`.
- *
- * @private
- * @param {Array|Object} collection The collection to shuffle.
- * @returns {Array} Returns the new shuffled array.
- */
- function baseShuffle(collection) {
- return shuffleSelf(values(collection));
- }
- module.exports = baseShuffle;
- /***/ }),
- /* 633 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayMap = __webpack_require__(634);
- /**
- * The base implementation of `_.values` and `_.valuesIn` which creates an
- * array of `object` property values corresponding to the property names
- * of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the array of property values.
- */
- function baseValues(object, props) {
- return arrayMap(props, function(key) {
- return object[key];
- });
- }
- module.exports = baseValues;
- /***/ }),
- /* 634 */
- /***/ (function(module, exports) {
- /**
- * A specialized version of `_.map` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
- function arrayMap(array, iteratee) {
- var index = -1,
- length = array == null ? 0 : array.length,
- result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
- module.exports = arrayMap;
- /***/ }),
- /* 635 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayLikeKeys = __webpack_require__(636),
- baseKeys = __webpack_require__(649),
- isArrayLike = __webpack_require__(652);
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- module.exports = keys;
- /***/ }),
- /* 636 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseTimes = __webpack_require__(637),
- isArguments = __webpack_require__(638),
- isArray = __webpack_require__(273),
- isBuffer = __webpack_require__(642),
- isIndex = __webpack_require__(644),
- isTypedArray = __webpack_require__(645);
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray(value),
- isArg = !isArr && isArguments(value),
- isBuff = !isArr && !isArg && isBuffer(value),
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
- skipIndexes = isArr || isArg || isBuff || isType,
- result = skipIndexes ? baseTimes(value.length, String) : [],
- length = result.length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) &&
- !(skipIndexes && (
- // Safari 9 has enumerable `arguments.length` in strict mode.
- key == 'length' ||
- // Node.js 0.10 has enumerable non-index properties on buffers.
- (isBuff && (key == 'offset' || key == 'parent')) ||
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
- // Skip index properties.
- isIndex(key, length)
- ))) {
- result.push(key);
- }
- }
- return result;
- }
- module.exports = arrayLikeKeys;
- /***/ }),
- /* 637 */
- /***/ (function(module, exports) {
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- module.exports = baseTimes;
- /***/ }),
- /* 638 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseIsArguments = __webpack_require__(639),
- isObjectLike = __webpack_require__(119);
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /** Built-in value references. */
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
- !propertyIsEnumerable.call(value, 'callee');
- };
- module.exports = isArguments;
- /***/ }),
- /* 639 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseGetTag = __webpack_require__(118),
- isObjectLike = __webpack_require__(119);
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]';
- /**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */
- function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag;
- }
- module.exports = baseIsArguments;
- /***/ }),
- /* 640 */
- /***/ (function(module, exports, __webpack_require__) {
- var Symbol = __webpack_require__(270);
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto.toString;
- /** Built-in value references. */
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
- /**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */
- function getRawTag(value) {
- var isOwn = hasOwnProperty.call(value, symToStringTag),
- tag = value[symToStringTag];
- try {
- value[symToStringTag] = undefined;
- var unmasked = true;
- } catch (e) {}
- var result = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
- }
- }
- return result;
- }
- module.exports = getRawTag;
- /***/ }),
- /* 641 */
- /***/ (function(module, exports) {
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto.toString;
- /**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
- module.exports = objectToString;
- /***/ }),
- /* 642 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(271),
- stubFalse = __webpack_require__(643);
- /** Detect free variable `exports`. */
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Built-in value references. */
- var Buffer = moduleExports ? root.Buffer : undefined;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
- /**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */
- var isBuffer = nativeIsBuffer || stubFalse;
- module.exports = isBuffer;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module)))
- /***/ }),
- /* 643 */
- /***/ (function(module, exports) {
- /**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */
- function stubFalse() {
- return false;
- }
- module.exports = stubFalse;
- /***/ }),
- /* 644 */
- /***/ (function(module, exports) {
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- var type = typeof value;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length &&
- (type == 'number' ||
- (type != 'symbol' && reIsUint.test(value))) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- module.exports = isIndex;
- /***/ }),
- /* 645 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseIsTypedArray = __webpack_require__(646),
- baseUnary = __webpack_require__(647),
- nodeUtil = __webpack_require__(648);
- /* Node.js helper references. */
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
- /**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
- module.exports = isTypedArray;
- /***/ }),
- /* 646 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseGetTag = __webpack_require__(118),
- isLength = __webpack_require__(275),
- isObjectLike = __webpack_require__(119);
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag = '[object Function]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- objectTag = '[object Object]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- weakMapTag = '[object WeakMap]';
- var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
- /** Used to identify `toStringTag` values of typed arrays. */
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
- typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
- typedArrayTags[weakMapTag] = false;
- /**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */
- function baseIsTypedArray(value) {
- return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
- }
- module.exports = baseIsTypedArray;
- /***/ }),
- /* 647 */
- /***/ (function(module, exports) {
- /**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- module.exports = baseUnary;
- /***/ }),
- /* 648 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(272);
- /** Detect free variable `exports`. */
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Detect free variable `process` from Node.js. */
- var freeProcess = moduleExports && freeGlobal.process;
- /** Used to access faster Node.js helpers. */
- var nodeUtil = (function() {
- try {
- // Use `util.types` for Node.js 10+.
- var types = freeModule && freeModule.require && freeModule.require('util').types;
- if (types) {
- return types;
- }
- // Legacy `process.binding('util')` for Node.js < 10.
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
- } catch (e) {}
- }());
- module.exports = nodeUtil;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module)))
- /***/ }),
- /* 649 */
- /***/ (function(module, exports, __webpack_require__) {
- var isPrototype = __webpack_require__(650),
- nativeKeys = __webpack_require__(651);
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- module.exports = baseKeys;
- /***/ }),
- /* 650 */
- /***/ (function(module, exports) {
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
- return value === proto;
- }
- module.exports = isPrototype;
- /***/ }),
- /* 651 */
- /***/ (function(module, exports, __webpack_require__) {
- var overArg = __webpack_require__(276);
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeKeys = overArg(Object.keys, Object);
- module.exports = nativeKeys;
- /***/ }),
- /* 652 */
- /***/ (function(module, exports, __webpack_require__) {
- var isFunction = __webpack_require__(653),
- isLength = __webpack_require__(275);
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- module.exports = isArrayLike;
- /***/ }),
- /* 653 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseGetTag = __webpack_require__(118),
- isObject = __webpack_require__(654);
- /** `Object#toString` result references. */
- var asyncTag = '[object AsyncFunction]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- proxyTag = '[object Proxy]';
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- if (!isObject(value)) {
- return false;
- }
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
- var tag = baseGetTag(value);
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
- }
- module.exports = isFunction;
- /***/ }),
- /* 654 */
- /***/ (function(module, exports) {
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
- }
- module.exports = isObject;
- /***/ }),
- /* 655 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithHoles = __webpack_require__(656);
- var iterableToArray = __webpack_require__(266);
- var unsupportedIterableToArray = __webpack_require__(267);
- var nonIterableRest = __webpack_require__(657);
- function _toArray(arr) {
- return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
- }
- module.exports = _toArray;
- /***/ }),
- /* 656 */
- /***/ (function(module, exports) {
- function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
- }
- module.exports = _arrayWithHoles;
- /***/ }),
- /* 657 */
- /***/ (function(module, exports) {
- function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableRest;
- /***/ }),
- /* 658 */
- /***/ (function(module, exports) {
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
- module.exports = _createClass;
- /***/ }),
- /* 659 */
- /***/ (function(module, exports) {
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object.keys(descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
- if (desc.initializer === void 0) {
- Object.defineProperty(target, property, desc);
- desc = null;
- }
- return desc;
- }
- module.exports = _applyDecoratedDescriptor;
- /***/ }),
- /* 660 */
- /***/ (function(module, exports, __webpack_require__) {
- /*
- Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
- Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
- Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
- */
- (function () {
- var StateMachine = {
- //---------------------------------------------------------------------------
- VERSION: "2.4.0",
- //---------------------------------------------------------------------------
- Result: {
- SUCCEEDED: 1, // the event transitioned successfully from one state to another
- NOTRANSITION: 2, // the event was successfull but no state transition was necessary
- CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
- PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
- },
- Error: {
- INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
- PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
- INVALID_CALLBACK: 300 // caller provided callback function threw an exception
- },
- WILDCARD: '*',
- ASYNC: 'async',
- //---------------------------------------------------------------------------
- create: function(cfg, target) {
- var initial = (typeof cfg.initial == 'string') ? { state: cfg.initial } : cfg.initial; // allow for a simple string, or an object with { state: 'foo', event: 'setup', defer: true|false }
- var terminal = cfg.terminal || cfg['final'];
- var fsm = target || cfg.target || {};
- var events = cfg.events || [];
- var callbacks = cfg.callbacks || {};
- var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
- var transitions = {}; // track events allowed from a state { state: [ event ] }
- var add = function(e) {
- var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
- map[e.name] = map[e.name] || {};
- for (var n = 0 ; n < from.length ; n++) {
- transitions[from[n]] = transitions[from[n]] || [];
- transitions[from[n]].push(e.name);
- map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
- }
- if (e.to)
- transitions[e.to] = transitions[e.to] || [];
- };
- if (initial) {
- initial.event = initial.event || 'startup';
- add({ name: initial.event, from: 'none', to: initial.state });
- }
- for(var n = 0 ; n < events.length ; n++)
- add(events[n]);
- for(var name in map) {
- if (map.hasOwnProperty(name))
- fsm[name] = StateMachine.buildEvent(name, map[name]);
- }
- for(var name in callbacks) {
- if (callbacks.hasOwnProperty(name))
- fsm[name] = callbacks[name]
- }
- fsm.current = 'none';
- fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
- fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
- fsm.cannot = function(event) { return !this.can(event); };
- fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
- fsm.isFinished = function() { return this.is(terminal); };
- fsm.error = cfg.error || function(name, from, to, args, error, msg, e) { throw e || msg; }; // default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired (see github issue #3 and #17)
- fsm.states = function() { return Object.keys(transitions).sort() };
- if (initial && !initial.defer)
- fsm[initial.event]();
- return fsm;
- },
- //===========================================================================
- doCallback: function(fsm, func, name, from, to, args) {
- if (func) {
- try {
- return func.apply(fsm, [name, from, to].concat(args));
- }
- catch(e) {
- return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
- }
- }
- },
- beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
- afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
- leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
- enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
- changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
- beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
- afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
- leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
- enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
- beforeEvent: function(fsm, name, from, to, args) {
- if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
- (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
- return false;
- },
- afterEvent: function(fsm, name, from, to, args) {
- StateMachine.afterThisEvent(fsm, name, from, to, args);
- StateMachine.afterAnyEvent( fsm, name, from, to, args);
- },
- leaveState: function(fsm, name, from, to, args) {
- var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
- general = StateMachine.leaveAnyState( fsm, name, from, to, args);
- if ((false === specific) || (false === general))
- return false;
- else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
- return StateMachine.ASYNC;
- },
- enterState: function(fsm, name, from, to, args) {
- StateMachine.enterThisState(fsm, name, from, to, args);
- StateMachine.enterAnyState( fsm, name, from, to, args);
- },
- //===========================================================================
- buildEvent: function(name, map) {
- return function() {
- var from = this.current;
- var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
- var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
- if (this.transition)
- return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
- if (this.cannot(name))
- return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
- if (false === StateMachine.beforeEvent(this, name, from, to, args))
- return StateMachine.Result.CANCELLED;
- if (from === to) {
- StateMachine.afterEvent(this, name, from, to, args);
- return StateMachine.Result.NOTRANSITION;
- }
- // prepare a transition method for use EITHER lower down, or by caller if they want an async transition (indicated by an ASYNC return value from leaveState)
- var fsm = this;
- this.transition = function() {
- fsm.transition = null; // this method should only ever be called once
- fsm.current = to;
- StateMachine.enterState( fsm, name, from, to, args);
- StateMachine.changeState(fsm, name, from, to, args);
- StateMachine.afterEvent( fsm, name, from, to, args);
- return StateMachine.Result.SUCCEEDED;
- };
- this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
- fsm.transition = null;
- StateMachine.afterEvent(fsm, name, from, to, args);
- }
- var leave = StateMachine.leaveState(this, name, from, to, args);
- if (false === leave) {
- this.transition = null;
- return StateMachine.Result.CANCELLED;
- }
- else if (StateMachine.ASYNC === leave) {
- return StateMachine.Result.PENDING;
- }
- else {
- if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
- return this.transition();
- }
- };
- }
- }; // StateMachine
- //===========================================================================
- //======
- // NODE
- //======
- if (true) {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = StateMachine;
- }
- exports.StateMachine = StateMachine;
- }
- //============
- // AMD/REQUIRE
- //============
- else if (typeof define === 'function' && define.amd) {
- define(function(require) { return StateMachine; });
- }
- //========
- // BROWSER
- //========
- else if (typeof window !== 'undefined') {
- window.StateMachine = StateMachine;
- }
- //===========
- // WEB WORKER
- //===========
- else if (typeof self !== 'undefined') {
- self.StateMachine = StateMachine;
- }
- }());
- /***/ }),
- /* 661 */
- /***/ (function(module, exports) {
- function _typeof(obj) {
- "@babel/helpers - typeof";
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- module.exports = _typeof = function _typeof(obj) {
- return typeof obj;
- };
- } else {
- module.exports = _typeof = function _typeof(obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
- return _typeof(obj);
- }
- module.exports = _typeof;
- /***/ }),
- /* 662 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseGetTag = __webpack_require__(118),
- getPrototype = __webpack_require__(663),
- isObjectLike = __webpack_require__(119);
- /** `Object#toString` result references. */
- var objectTag = '[object Object]';
- /** Used for built-in method references. */
- var funcProto = Function.prototype,
- objectProto = Object.prototype;
- /** Used to resolve the decompiled source of functions. */
- var funcToString = funcProto.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /** Used to infer the `Object` constructor. */
- var objectCtorString = funcToString.call(Object);
- /**
- * Checks if `value` is a plain object, that is, an object created by the
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
- *
- * @static
- * @memberOf _
- * @since 0.8.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * }
- *
- * _.isPlainObject(new Foo);
- * // => false
- *
- * _.isPlainObject([1, 2, 3]);
- * // => false
- *
- * _.isPlainObject({ 'x': 0, 'y': 0 });
- * // => true
- *
- * _.isPlainObject(Object.create(null));
- * // => true
- */
- function isPlainObject(value) {
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
- return false;
- }
- var proto = getPrototype(value);
- if (proto === null) {
- return true;
- }
- var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
- funcToString.call(Ctor) == objectCtorString;
- }
- module.exports = isPlainObject;
- /***/ }),
- /* 663 */
- /***/ (function(module, exports, __webpack_require__) {
- var overArg = __webpack_require__(276);
- /** Built-in value references. */
- var getPrototype = overArg(Object.getPrototypeOf, Object);
- module.exports = getPrototype;
- /***/ }),
- /* 664 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
- var _interopRequireDefault = __webpack_require__(1);
- var _isIterable2 = _interopRequireDefault(__webpack_require__(665));
- var _from = _interopRequireDefault(__webpack_require__(252));
- var _set = _interopRequireDefault(__webpack_require__(264));
- var _concat = _interopRequireDefault(__webpack_require__(22));
- var _assign = _interopRequireDefault(__webpack_require__(152));
- var _map = _interopRequireDefault(__webpack_require__(35));
- var _defineProperty = _interopRequireDefault(__webpack_require__(92));
- var _typeof2 = _interopRequireDefault(__webpack_require__(73));
- (function (global, factory) {
- ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(156)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(156)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
- })(void 0, function (exports, core) {
- 'use strict';
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
- }
- function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
- }
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- }
- function _iterableToArray(iter) {
- if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
- }
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
- }
- /* eslint-disable import/no-unresolved */
- if (!core.Protocals) {
- throw new Error('LeanCloud Realtime SDK not installed');
- }
- var CommandType = core.Protocals.CommandType,
- GenericCommand = core.Protocals.GenericCommand,
- AckCommand = core.Protocals.AckCommand;
- var warn = function warn(error) {
- return console.warn(error.message);
- };
- var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
- _inheritsLoose(LiveQueryClient, _EventEmitter);
- function LiveQueryClient(appId, subscriptionId, connection) {
- var _this;
- _this = _EventEmitter.call(this) || this;
- _this._appId = appId;
- _this.id = subscriptionId;
- _this._connection = connection;
- _this._eventemitter = new core.EventEmitter();
- _this._querys = new _set.default();
- return _this;
- }
- var _proto = LiveQueryClient.prototype;
- _proto._send = function _send(cmd) {
- var _context;
- var _this$_connection;
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
- appId: this._appId,
- installationId: this.id,
- service: 1
- })]).call(_context, args));
- };
- _proto._open = function _open() {
- return this._send(new GenericCommand({
- cmd: CommandType.login
- }));
- };
- _proto.close = function close() {
- var _ee = this._eventemitter;
- _ee.emit('beforeclose');
- return this._send(new GenericCommand({
- cmd: CommandType.logout
- })).then(function () {
- return _ee.emit('close');
- });
- };
- _proto.register = function register(liveQuery) {
- this._querys.add(liveQuery);
- };
- _proto.deregister = function deregister(liveQuery) {
- var _this2 = this;
- this._querys.delete(liveQuery);
- setTimeout(function () {
- if (!_this2._querys.size) _this2.close().catch(warn);
- }, 0);
- };
- _proto._dispatchCommand = function _dispatchCommand(command) {
- if (command.cmd !== CommandType.data) {
- this.emit('unhandledmessage', command);
- return core.Promise.resolve();
- }
- return this._dispatchDataCommand(command);
- };
- _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
- var _ref$dataMessage = _ref.dataMessage,
- ids = _ref$dataMessage.ids,
- msg = _ref$dataMessage.msg;
- this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
- var data = _ref2.data;
- return JSON.parse(data);
- })); // send ack
- var command = new GenericCommand({
- cmd: CommandType.ack,
- ackMessage: new AckCommand({
- ids: ids
- })
- });
- return this._send(command, false).catch(warn);
- };
- return LiveQueryClient;
- }(core.EventEmitter);
- var finalize = function finalize(callback) {
- return [// eslint-disable-next-line no-sequences
- function (value) {
- return callback(), value;
- }, function (error) {
- callback();
- throw error;
- }];
- };
- var onRealtimeCreate = function onRealtimeCreate(realtime) {
- /* eslint-disable no-param-reassign */
- realtime._liveQueryClients = {};
- realtime.createLiveQueryClient = function (subscriptionId) {
- var _realtime$_open$then;
- if (realtime._liveQueryClients[subscriptionId] !== undefined) {
- return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
- }
- var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
- var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
- connection.on('reconnect', function () {
- return client._open().then(function () {
- return client.emit('reconnect');
- }, function (error) {
- return client.emit('reconnecterror', error);
- });
- });
- client._eventemitter.on('beforeclose', function () {
- delete realtime._liveQueryClients[client.id];
- }, realtime);
- client._eventemitter.on('close', function () {
- realtime._deregister(client);
- }, realtime);
- return client._open().then(function () {
- realtime._liveQueryClients[client.id] = client;
- realtime._register(client);
- return client;
- });
- })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
- if (realtime._deregisterPending) realtime._deregisterPending(promise);
- })));
- realtime._liveQueryClients[subscriptionId] = promise;
- if (realtime._registerPending) realtime._registerPending(promise);
- return promise;
- };
- /* eslint-enable no-param-reassign */
- };
- var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
- var isLiveQueryCommand = command.installationId && command.service === 1;
- if (!isLiveQueryCommand) return true;
- var targetClient = realtime._liveQueryClients[command.installationId];
- if (targetClient) {
- targetClient._dispatchCommand(command).catch(function (error) {
- return console.warn(error);
- });
- } else {
- console.warn('Unexpected message received without any live client match: %O', command);
- }
- return false;
- }; // eslint-disable-next-line import/prefer-default-export
- var LiveQueryPlugin = {
- name: 'leancloud-realtime-plugin-live-query',
- onRealtimeCreate: onRealtimeCreate,
- beforeCommandDispatch: beforeCommandDispatch
- };
- exports.LiveQueryPlugin = LiveQueryPlugin;
- (0, _defineProperty.default)(exports, '__esModule', {
- value: true
- });
- });
- /***/ }),
- /* 665 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(666);
- /***/ }),
- /* 666 */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(667);
- /***/ }),
- /* 667 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(668);
- module.exports = parent;
- /***/ }),
- /* 668 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(669);
- module.exports = parent;
- /***/ }),
- /* 669 */
- /***/ (function(module, exports, __webpack_require__) {
- var parent = __webpack_require__(670);
- __webpack_require__(39);
- module.exports = parent;
- /***/ }),
- /* 670 */
- /***/ (function(module, exports, __webpack_require__) {
- __webpack_require__(38);
- __webpack_require__(55);
- var isIterable = __webpack_require__(671);
- module.exports = isIterable;
- /***/ }),
- /* 671 */
- /***/ (function(module, exports, __webpack_require__) {
- var classof = __webpack_require__(51);
- var hasOwn = __webpack_require__(13);
- var wellKnownSymbol = __webpack_require__(9);
- var Iterators = __webpack_require__(50);
- var ITERATOR = wellKnownSymbol('iterator');
- var $Object = Object;
- module.exports = function (it) {
- var O = $Object(it);
- return O[ITERATOR] !== undefined
- || '@@iterator' in O
- || hasOwn(Iterators, classof(O));
- };
- /***/ })
- /******/ ]);
- });
- //# sourceMappingURL=av-live-query-weapp.js.map
|